NCS: Setting MAC address to static for Mesh; UUID last bytes are zeroes

1. Is it possible to set MAC address from random to static for Mesh in nRF Connect SDK? 

CONFIG_BT_PRIVACY=n and CONFIG_BT_SETTINGS=y seems does not change the behavior.

2. We have an issue with UUID, last bytes are zeroes in default configuration. Is it a bug or how to configure SDK to avoid this?

  • We want to have more commonly looking number. How can I change it?

  • Hi,

    You would have to change the code for bt_mesh_dk_prov_init() in dk_prov.c.

    In particular, you should fill the missing bytes of dev_uuid (bytes 8 through 15) before the following lines:

    	dev_uuid[6] = (dev_uuid[6] & BIT_MASK(4)) | BIT(6);
    	dev_uuid[8] = (dev_uuid[8] & BIT_MASK(6)) | BIT(7);

    Those two lines change some of the bits, for compliance with RFC-4122.

    Please note that the UUID should stay the same for the same device, so the UUID generation should be deterministic. My main suggestion would be to use the DEVICEADDR, from FICR, which is the 48 bit default Bluetooth MAC address of the SoC. The rest of the UUID consists of the device ID, which is also taken from FICR. That leaves two bytes still zero, which you can either leave zero or fill with some other fixed, read-from-persistent-memory or reproducible value.

    Regards,
    Terje

  • Hi,

    This has been looked into by the team, and we have a patch. In a future SDK release, the UUID will no longer be hard coded to end in all zeroes, but rather generate a full 16 byte UUID from the device ID value.

    For that future release, if you want to continue using the current behaviour (with UUIDs guaranteed to end in all zeroes,) you must then use the new CONFIG_BT_MESH_DK_LEGACY_UUID_GEN kconfig. The default will be the new UUID generation.

    See https://github.com/nrfconnect/sdk-nrf/pull/8747 for the patch.

    Regards,
    Terje

Related