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

advertisement with random address

Hi,

I am using nrf52832 with sdk11 and s132.I am using ble_app_beacon example wherein I want to advertise with different address after one power cycle.

In ble_stack_init ()function,I am doing as below;

  ble_gap_addr_t addr;
addr.addr_type =  BLE_GAP_ADDR_TYPE_RANDOM_STATIC 
err_code = sd_ble_gap_address_set(BLE_GAP_ADDR_CYCLE_MODE_AUTO, &addr);
APP_ERROR_CHECK(err_code);

but I am not getting the advertisement.

What should be done to make it advertise with different address after one power cycle?

  • Hi Anuja!

    If you take a look at the sd_ble_gap_address_set() function, you can see that;

    NOTE:
    If the address cycle mode is BLE_GAP_ADDR_CYCLE_MODE_AUTO, the address type is required to be BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE or BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE. The given address is ignored and the SoftDevice will generate a new private address automatically every BLE_GAP_DEFAULT_PRIVATE_ADDR_CYCLE_INTERVAL_S seconds.
    If this API call is used again with the same parameters, the SoftDevice will immediately generate a new private address to replace the current address. If the application wishes to use a BLE_GAP_ADDR_TYPE_PUBLIC or BLE_GAP_ADDR_TYPE_RANDOM_STATIC address, the cycle mode must be BLE_GAP_ADDR_CYCLE_MODE_NONE.

    In short, to use the BLE_GAP_ADDR_CYCLE_MODE_AUTO, the address type must be either BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE or BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE.

    Best regards,
    Joakim.

Related