This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Assign a mesh-local EID address

Hi Everyone,

Is it possible to programmatically assign a static mesh-local EID IPv6 address to a node in a network? I would like to communicate to individual nodes in the network using the EID addresses. I know the EID IPv6 does not change when the network topology change, but does change after flashing the chip. Is there a way around this?

  • Hello Roger,

    Thread specification mandates Mesh-Local EID address to be randomly generated after node is commissioned to the network. Node stores this address in non-volatile memory, which makes it persistent over reboot. The Mesh-Local EID however changes, when node is re-commissioned again.

    Note that for development, you can always flash a new firmware without erasing Thread persistent data (where Mesh-Local EID is stored) - simply avoid using --chiperase parameter when using nrfjprog.

    All in all, I can recommend you two ways of solving described problem:

    1. Use otIp6AddUnicastAddress method to assign a new IPv6 address to the Thread interface. Then you have a full control from the application on the IPv6 addresses of the node. Note that you can create additional address based on Mesh-Local Prefix.

    Reference: openthread.io/.../api-ip6

    1. Implement mechanism for node discovery e.g. mDNS or some proprietary one, like we have in nRF5 SDK for Thread in our CoAP examples to perform provisioning.
  • Hi Lukasz,

    As always, thank you for the very helpful comment.

    You mentioned that the Thread data variables are persistent and therfore does not loose data assigned to these variables when booting the DK. I'm busy exploring this persistency between Thread data variables and tried programming the device without using --chiperase but are unable to get the device programmed. The error on the cmd is:

    Reading flash area to program to guarantee it is erased.
    ERROR: The area to write is not erased.
    

    The nrf command given is nrfjprog -f NRF52 --program _build\nrf52840_xxaa.hex

    According to the error I'm getting, it seems that some area of the flash needs to be erased before programming the device?

  • Hello Roger,

    Please add the "--sectorerase" option to the nrfjprog e.g.:

    nrfjprog -f NRF52 --sectorerase --program _build\nrf52840_xxaa.hex

Related