dwm_mac_addr_get
Gets MAC address list used by the device. The device uses either the address specified by the user or the default address. The default MAC address for each interface can be changed only once by calling dwm_mac_addr_set_once which writes to OTP memory. The address in the OTP becomes a new default MAC address. The user can set a custom MAC address by calling dwm_mac_addr_set. The default MAC address can be recovered by factory reset (see dwm_factory_reset) after being modified by the user. The device uses fixed mapping of the MAC address in list to the particular interface as follows:
UWB
BLE
Ethernet
Wi-Fi
The BLE address can be a Random BLE address or a Public BLE address. If a particular interface is not supported, the corresponding MAC address in the list is empty.
-
void dwm_mac_addr_get(dwm_mac_addr_list_t *mac_addr_list)
- Parameters
output – Status code, type_0, type_1, type_2, type_3, mac_addr_0, mac_addr_1, mac_addr_2, mac_addr_3
type_N – status, flags (type describing the MAC address at index 0 in the list)
status – 2 bits (* status of the MAC address: MAC_ADDR_EMPTY = 0, MAC_ADDR_DEFAULT = 1, MAC_ADDR_USER_SPECIFIED = 2, MAC_ADDR_MUTABLE_DEFAULT = 3*)
flags – 6 bits (bit 0 is set if address is PUBLIC_BLE_ADDR, rest of the bits is reserved for future use)
mac_addr_N – 48-bits value (little endian)
C code example
dwm_mac_addr_list_t mac_addr_list;
rv: dwm_mac_addr_get(&mac_addr_list);
if (rv == DWM_OK) {
printf("UWB MAC 0x%02x%02x%02x%02x%02x%02x status=x%02x\n",
mac_addr_list.mac[0][0],
mac_addr_list.mac[0][1],
mac_addr_list.mac[0][2],
mac_addr_list.mac[0][3],
mac_addr_list.mac[0][4],
mac_addr_list.mac[0][5],
mac_addr_list.type[0].status);
} else {
printf("can't get MAC address list, error %d\n", rv);
}
SPI/UART example
TLV Request |
|
---|---|
Type |
Length |
0x83 |
0x00 |
Type 0x83 (131 dec) means command dwm_mac_addr_get
TLV Response |
|||||
---|---|---|---|---|---|
Type |
Length |
Value (see error codes) |
Type |
Length |
Value |
0x40 |
0x01 |
0x00 |
0xC1 |
0x18 |
(byte 0-4) types of the MAC addresses in the list
(byte 5-10) MAC address 0 in little endian
(byte 11-16) MAC address 1 in little endian
(byte 17-22) MAC address 2 in little endian
(byte 23-28) MAC address 3 in little endian
|
… |
MAC address flags encoding
flags of the MAC address list |
||||||||
---|---|---|---|---|---|---|---|---|
byte 0 |
byte 1 |
byte 2 |
byte 3 |
|||||
bits 2-7 |
bits 0-1 |
bits 11-15 |
bit 10 |
bits 8-9 |
bits 18-23 |
bits 16-17 |
bits 26-31 |
bits 24-25 |
R |
S_0 |
R |
P_1 |
S_1 |
R |
S_2 |
R |
S_3 |
The R means reserved for future use. The S_0, S_1, S_2, S_3 describe the MAC address status. Status can have the following values:
0 - Empty MAC address
1 - Default MAC address from OTP memory.
2 - User specified MAC address
3 - Mutable default MAC address can be rewritten only once using dwm_mac_addr_set_once.
P_1 is set if the BLE address is the Public BLE address. The flag is cleared if the BLE MAC address is random. Refer to BLE specification for more information on BLE address types.