How to keep the same MAC address after consecutive build and flash operations

I'm developing an OpenThread Sleepy End Device (SED) that periodically sends a payload to a CoAP server, including its own MAC address as one of the values. However, I noticed that the MAC address changes every time I build and flash the firmware. How to keep the MAC address persistent across firmware flashes?

My code for retrieving the MAC address:

void get_my_mac_address(char* buf, size_t buf_size) {
  otInstance* myInstance = openthread_get_default_instance();
  const otExtAddress* ext_addr = otLinkGetExtendedAddress(myInstance);
  snprintf(buf, buf_size, "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X", ext_addr->m8[0], ext_addr->m8[1], ext_addr->m8[2], ext_addr->m8[3],
           ext_addr->m8[4], ext_addr->m8[5], ext_addr->m8[6], ext_addr->m8[7]);

  LOG_INF("My MAC: %s. (line %i)\n", buf, __LINE__);
}

Parents
  • Hi, 

    Do you mean the IEEE 802.15.4 extended address or the IEEE EUI-64 address? Check this post

    otLinkGetExtendedAddress() function would gets the IEEE 802.15.4 Extended Address. It could be that you are not setting the extended address persistent, so it is changed upon reset/flash.

    Regards,
    Amanda H.

  • If I understand correctly, the IEEE EUI-64 address is a globally unique identifier assigned by the IEEE Registration Authority and consists of a 24-bit Organizationally Unique Identifier (OUI) and a 40-bit unique extension. Nordic Semiconductor likely purchases a block of these addresses and programs one unique EUI-64 into each nRF54x device during manufacturing.

    The IEEE 802.15.4 extended address, on the other hand, is a 64-bit MAC address used in IEEE 802.15.4 networks (such as Thread or Zigbee) and it is typically derived from the EUI-64 either by hardware or during software stack initialization. This means the IEEE 802.15.4 extended address can change between resets or reinitializations unless it is explicitly stored and made persistent?

Reply
  • If I understand correctly, the IEEE EUI-64 address is a globally unique identifier assigned by the IEEE Registration Authority and consists of a 24-bit Organizationally Unique Identifier (OUI) and a 40-bit unique extension. Nordic Semiconductor likely purchases a block of these addresses and programs one unique EUI-64 into each nRF54x device during manufacturing.

    The IEEE 802.15.4 extended address, on the other hand, is a 64-bit MAC address used in IEEE 802.15.4 networks (such as Thread or Zigbee) and it is typically derived from the EUI-64 either by hardware or during software stack initialization. This means the IEEE 802.15.4 extended address can change between resets or reinitializations unless it is explicitly stored and made persistent?

Children
Related