nRF52833 MAC Address ramdonly changing while advertising

Hello,

I am experiencing instances when my device (peripheral) MAC address changes randomly while the device is running and advertising.

MAC address changed during runtime from C7:2A:7D:C9:44:39 to 17:8B:E9:C7:E4:A1
MAC address reverted back from 17:8B:E9:C7:E4:A1 to C7:2A:7D:C9:44:39  after a reset/restart.

When this happens my other BLE PC application (central) cannot connect to it. However, if I reset/restart my peripheral device the original address is restored and my central can connect again. According to the Bluetooth documentation a static address does not change until a power cycle.

Below are the boot-up logs showing the 'static' address I usually see.

[00:01:16.123,107] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
[00:01:16.123,107] <inf> bt_hci_core: HW Variant: nRF52x (0x0002)
[00:01:16.123,138] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 2.6 Build 99
[00:01:16.123,931] <inf> bt_hci_core: Identity: C7:2A:7D:C9:44:39 (random)
[00:01:16.123,931] <inf> bt_hci_core: HCI: version 5.2 (0x0b) revision 0x0000, manufacturer 0x05f1
[00:01:16.123,931] <inf> bt_hci_core: LMP: version 5.2 (0x0b) subver 0xffff

According to the above log from bt_hci_core,

[00:01:16.123,931] <inf> bt_hci_core: Identity: C7:2A:7D:C9:44:39 (random)

The MAC address is supposed to be random, yet every time I reset my device after I notice a change in its MAC address, it reverts back to the old address. This does not look like a random address. So, what is meant by 'random' in this context?

Note, I have had a look at other similar cases e.g. Case ID: 313249 but no explanation or solution has been provided yet.

I would appreciate it if you could respond as soon as possible. Thank you.

Kind regards

Mohamed

Parents
  • Hi, 

    What type of address would you like to set? Bluetooth Low Energy comes with different address types, which you can read about in our DevAcademy course: https://academy.nordicsemi.com/topic/bluetooth-address/ 

    Only public address type is liable to a fee (to the IEEE registration authority), random addresses can be used freely. The default address used by the Bluetooth Stacks in nRF52833 is a random static address obtained from the DEVICEADDR[n] FICR registers (random number programmed during chip manufacturing).

    If you want to set Resolvable Private Addresses, you could use CONFIG_BT_PRIVACY

    Regards,
    Amanda H.

  • Hi Amanda,

    Thank you for your prompt response.

    I do not want to set the MAC address. I am happy to use the default address.

    The default address used by the Bluetooth Stacks in nRF52833 is a random static address obtained from the DEVICEADDR[n] FICR registers (random number programmed during chip manufacturing).

    According to Nordic's Academy Bluetooth-address page,

    "A random static address can be allocated and then fixed throughout the lifetime of the device. It can be altered at bootup, but not during runtime. "

    So, why am I seeing the random static MAC address of my device changing at runtime?

    Then when I restart (hard reset) the device it reverts back to the original MAC address.

    As far as I can make out, I am not doing anything in my application code to change it.

    Please explain what could be happening.

    Also, according to Nordic's documentation,

    "Factory information configuration registers (FICR) are pre-programmed in factory and cannot be erased by the user. "

    However, you said in your reply a random static address can be changed at bootup. Please explain how.

    Thank you.

    Kind regards

    Mohamed

  • Hi, 

    Learner said:
    why am I seeing the random static MAC address of my device changing at runtime?

    What is your application? Do you mean in the advertising? If so, how do you set the BT_LE_ADV_PARAM? If you want to advertise using local identity (static address not new address every time you reset) you should use BT_LE_ADV_OPT_USE_IDENTITY option. Check the Advertising section in this guide.

    Learner said:

    "Factory information configuration registers (FICR) are pre-programmed in factory and cannot be erased by the user. "

    However, you said in your reply a random static address can be changed at bootup. Please explain how.

    You can set the application to use the random static address at bootuping the application. 

    -Amanda H.

  • Good Morning Amanda,

    What is your application? Do you mean in the advertising? If so, how do you set the BT_LE_ADV_PARAM?

    Yes, I am referring to the MAC address in the advertising. My device is a connectable peripheral that other devices should be able to connect to over BLE.

    This is what I am doing to set the advertising parameters,

    #define BT_LE_ADV_CONN_SLOW                BT_LE_ADV_PARAM((BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_SCANNABLE), BT_GAP_ADV_SLOW_INT_MIN, BT_GAP_ADV_SLOW_INT_MAX, NULL)

    #define BT_LE_ADV_CONN_FAST                  BT_LE_ADV_PARAM((BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_SCANNABLE), BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, NULL)

    /* ble_ad[] Can be up to 29 bytes */                                                                                                                                                         static uint8_t ble_ad[HB_BLE_AD_BUFF_SIZE_MAX] = { 0U };

    /* legacy advertisements up to 31 bytes Max */                                                                                                                                     static const struct bt_data ad[] = { BT_DATA(BT_DATA_MANUFACTURER_DATA, &ble_ad[0], sizeof(ble_ad)) }; 

    /* ble_sd[] Can be up to 29 bytes */                                                                                                                                                         static uint8_t ble_sd[HB_BLE_SD_BUFF_SIZE_MAX] = { 0U }; 

    /* legacy advertisements up to 31 bytes Max */
    static const struct bt_data sd[] = { BT_DATA(BT_DATA_MANUFACTURER_DATA, &ble_sd[0], sizeof(ble_sd)) }; 

    ...

    /* Start advertising */                                                                                                                                bt_le_adv_start(BT_LE_ADV_CONN_SLOW, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd));

    If you want to advertise using local identity (static address not new address every time you reset) you should use BT_LE_ADV_OPT_USE_IDENTITY option. 

    Sometimes, I am seeing the advertising MAC address changing at runtime without the device going through a reset. According to the documentation this should not happen. Then when I reset the device it reverts back to its old address. 

    Can you please explain what could be causing this?

    According to Nordic's Academy Bluetooth-address page,

    "A random static address can be allocated and then fixed throughout the lifetime of the device. It can be altered at bootup, but not during runtime. "

    I am still unclear about how an application can change a static random address at boot-up. Please clarify.

    Kind regards

    Mohamed

  • As I explained in the previous reply, you should use BT_LE_ADV_OPT_USE_IDENTITY option in the BT_LE_ADV_PARAM. Check the Advertising section in this guide.

  • Hi Amanda,

    Thank you for your support.

    OK, I will add BT_LE_ADV_OPT_USE_IDENTITY  to the BT_LE_ADV_PARAM parameters.

    Are you saying if I don't use the BT_LE_ADV_OPT_USE_IDENTITY option in BT_LE_ADV_PARAM then the device can randomly change its MAC address at runtime without a reset or a power cycle?

    As I already stated I am seeing the device changing its MAC address without a reset or a power cycle. Is this possible?

    Kind regards

    Mohamed

  • Yes.

    Yes.

    If you want to advertise identity you could use BT_LE_ADV_OPT_USE_IDENTITY

    -Amanda H.

Reply Children
Related