NRF5340: Read FICR.DEVICEADDR and set BLE MAC random address

Hi all,

NRF5340
NRF Connect 2.6.0

We would like to perform the following operations on the NRF5340:
* Read FICR.DEVICEADDR (BLE random MAC is also fine).
* Set the BLE address with type random.

Seems the FICR.DEVICEADDR is only accessible by the network core, which AFAIK is not documented anywhere in the PS. So need to call bt_enable first to get the random MAC address either via bt_id_get or bt_read_static_addr.

However, using bt_id_create after BLE has been started does not apply the new MAC address for BLE comms. There seems to be a workaround for setting the public address at runtime, but this doesn't work for random. The HCI command returns SUCCESS though.
devzone.nordicsemi.com/.../setting-nrf5340-public-ble-address

Is there a solution for this specific use case?

Parents Reply
  • I have found that it works like this:

    When you first start the device, the BLE host on the app core will retrieve the address from the network core. This addr will then be saved to app core flash using the Settings module.

    When you start the app and call settings_load() the addr will be loaded from settings.

    From bt_id_reset():
    "the default identity (BT_ID_DEFAULT) cannot be reset"

    This means that to change the MAC, you must add a second addr and advertise the second addr instead of the default ID.

    It should go something like this:

    1. call settings_load()

    2. call bt_id_create()

    3. Configure advertising to use your MAC instead of the default one.

    You might have to configure CONFIG_BT_ID_MAX to have more IDs.

    Possibly the Bluetooth: Peripheral Identity may be of some help.

    Was this answer what you are looking for?

Children
Related