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

RESOLVABLE PRIVATE RANDOM ADDRESS and BLE_GAP_EVT_ADV_SET_TERMINATED

Hi,

I'm trying to setup my nRF52832 to advertise using a RESOLVABLE RANDOM PRIVATE address and to obtain this I have used the sd_ble_gap_privacy_set() before starting advertising in this way:

le_gap_privacy_params_t privacy_params = {
	.privacy_mode = BLE_GAP_PRIVACY_MODE_DEVICE_PRIVACY,
	.private_addr_type = BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE,
	.private_addr_cycle_s = BLE_GAP_MAX_PRIVATE_ADDR_CYCLE_INTERVAL_S,
	.p_device_irk = m_irk
};
APP_ERROR_CHECK(sd_ble_gap_privacy_set(&privacy_params));

where m_irk is my IRK key.

The code works, and I can see my device (using nRF Connect app for Android) that changes its address, but the problem is that the address is changed too frequently.

In the advertising parameters I have an advertising duration of 30 seconds and when I get the  BLE_GAP_EVT_ADV_SET_TERMINATED I update some data inside the advertising packet and restart advertising. The thing that I notice is that, when I restart advertising the MAC address is changed even if in the privacy_params is configured to change after 900s. If I try to start advertising for the first time using a timeout of 0 (so that it never timeout and I never get the BLE_GAP_EVT_ADV_SET_TERMINATED event), the MAC address is changed according to the time specified in the privacy_params

Is this an expected behaviour? Are there any workarounds to get the device address changed according to the privacy_params, even if the advertising is restarted due to a BLE_GAP_EVT_ADV_SET_TERMINATED event?

Parents
  • Hi Forconi, 

    Yes, it is expected behavior from SoftDevice.

    According to the Bluetooth core specification about privacy feature in Version 5.2 Vol 3, Part C, the private address refresh timer does not need to run when there is no advertising activities. Nordic has chosen to not run the timer and that is why you see the resolvable private address changes every time you restart advertising.

    The main purpose of the privacy feature is to hide your device from others and only expose to the ones that are shared with the key. In your application, you shall track the identity address (resolved address) instead of the resolvable random private address.

    For now, there is no workaround to refresh every cycle interval if there is no BLE activities. 

    If you track the identity address, you don't need to care if the resolvable random private address has been updated or not due to restart, because you will always get the same identity address after it is resolved.

Reply
  • Hi Forconi, 

    Yes, it is expected behavior from SoftDevice.

    According to the Bluetooth core specification about privacy feature in Version 5.2 Vol 3, Part C, the private address refresh timer does not need to run when there is no advertising activities. Nordic has chosen to not run the timer and that is why you see the resolvable private address changes every time you restart advertising.

    The main purpose of the privacy feature is to hide your device from others and only expose to the ones that are shared with the key. In your application, you shall track the identity address (resolved address) instead of the resolvable random private address.

    For now, there is no workaround to refresh every cycle interval if there is no BLE activities. 

    If you track the identity address, you don't need to care if the resolvable random private address has been updated or not due to restart, because you will always get the same identity address after it is resolved.

Children
Related