dwm_mac_addr_set

Sets the MAC address of the BLE, UWB, Ethernet or Wi-Fi interface. Needs reset to take effect. It Should not be used frequently since it writes the internal non-volatile memory. Factory reset is needed (dwm_factory_reset) to use the default MAC address. The two least significant bytes of the UWB MAC address must not be equal to 0x0000 or 0xFFFF. The BLE address can be either Random or Public BLE address. The Ethernet and the Wi-Fi address must respect the EUI-48 format, and the U/I bits must be set accordingly.

void dwm_mac_addr_set(dwm_mac_addr_type_t type, dwm_mac_addr_t *addr)
Parameters
  • input – addr_type, addr_value

  • addr_type – 8-bit integer (0=UWB address, 1=BLE Random address, 2=BLE Public address, 3=ETH address, 4= WIFI address, ETH and WIFI is supported only on the gateway)

  • addr_value – 6 bytes (6 byte long MAC address)

  • output:Status code

C code example

dwm_mac_addr_t addr;
addr.bytes[0]: 0xAA;
addr.bytes[1]: 0xBB;
addr.bytes[2]: 0xCC;
addr.bytes[3]: 0xDD;
addr.bytes[4]: 0xEE;
addr.bytes[5]: 0xFF;
int rv: dwm_mac_addr_set(NODE_ADDR_TYPE_UWB, &addr);
if (rv != DWM_OK) {
  printf("can't set node address, error %d\n", rv);
}

SPI/UART example

TLV Request

Type

Length

Value

0x2D

0x07

byte 0: MAC address type
bytes 1-6: MAC address in little endian

0x00 0xEF 0xCD 0xAB 0x56 0x34 0x12

Type 0x2D (45 dec) means command dwm_mac_addr_set

TLV Response

Type

Length

Value (see error codes)

0x40

0x01

0x00

Type 0x40 means Status code of the previous command