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

How to set my nRF device to use the private resolvable address

Hello~ I'm using the nRF52832 board, s132_nrf52_6.1.0_softdevice, SDK 15.2. I'm focusing on 3 peripheral examples;

ble_app_hrs & ble_app_eddystone & ble_app_beacon

If I understood correctly, I think these examples' MAC address doesn't change.

I made this conclusion after viewing with the nRF connect mobile App.

Umm, it is possible to make these examples to change the MAC addresses as the resolvable random addresses, right?

What SoftDevice function should I call to make this happen?

Lastly, can I set a duration to make the address to change?

For example, I want to make the MAC address (which is resolvable) to change its address every 5 minutes.

Parents
  • Hello, 

    Yes, your observation is correct, the SDK examples uses the random static address by default.  In SDK 15.2.0 you can use the peer manager API to enable privacy. E.g. 

    /**@brief Function for the Peer Manager initialization.
     */
    static void peer_manager_init(void)
    {
        ble_gap_sec_params_t sec_param;
        pm_privacy_params_t  privacy_params;
        ret_code_t           err_code;
    ...
    
        err_code = pm_sec_params_set(&sec_param);
        APP_ERROR_CHECK(err_code);
    
        memset(&privacy_params, 0, sizeof(pm_privacy_params_t));
    
        privacy_params.privacy_mode         = BLE_GAP_PRIVACY_MODE_DEVICE_PRIVACY;
        privacy_params.private_addr_type    = BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE;
        privacy_params.private_addr_cycle_s = 300; // Change address every 5 minutes
    
        err_code = pm_privacy_set(&privacy_params);
    ...
    }
    

Reply
  • Hello, 

    Yes, your observation is correct, the SDK examples uses the random static address by default.  In SDK 15.2.0 you can use the peer manager API to enable privacy. E.g. 

    /**@brief Function for the Peer Manager initialization.
     */
    static void peer_manager_init(void)
    {
        ble_gap_sec_params_t sec_param;
        pm_privacy_params_t  privacy_params;
        ret_code_t           err_code;
    ...
    
        err_code = pm_sec_params_set(&sec_param);
        APP_ERROR_CHECK(err_code);
    
        memset(&privacy_params, 0, sizeof(pm_privacy_params_t));
    
        privacy_params.privacy_mode         = BLE_GAP_PRIVACY_MODE_DEVICE_PRIVACY;
        privacy_params.private_addr_type    = BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE;
        privacy_params.private_addr_cycle_s = 300; // Change address every 5 minutes
    
        err_code = pm_privacy_set(&privacy_params);
    ...
    }
    

Children
Related