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

Stop advertising is blocking?

I'm trying to regularly change some advertising parameters (ble_gap_adv_params_t.type). The only way i can see to do so, is by stopping and starting advertising. However, I noticed that stopping advertising (sd_ble_gap_adv_stop()) takes about 5-30ms. I didn't expect this call to be blocking and take this long.

Are there any suggestions as to how to update the parameters in a quicker way?

Parents
  • I tried it with SDK 11 and S132 v2.0.0 and v2.0.1. The longest execution time I measured was ~55us. The time seems to vary slightly depending on compiler optimization settings and whether the advertising has already been stopped. I got 55us with optimization set to -O0. The code I used was the BLE template example. And I simply added this code in main() right before the main while() loop:

    nrf_delay_ms(500);
    nrf_gpio_pin_clear(LED_4);
    sd_ble_gap_adv_stop();
    nrf_gpio_pin_set(LED_4);
    

    Where in your code do you measure the time?

Reply
  • I tried it with SDK 11 and S132 v2.0.0 and v2.0.1. The longest execution time I measured was ~55us. The time seems to vary slightly depending on compiler optimization settings and whether the advertising has already been stopped. I got 55us with optimization set to -O0. The code I used was the BLE template example. And I simply added this code in main() right before the main while() loop:

    nrf_delay_ms(500);
    nrf_gpio_pin_clear(LED_4);
    sd_ble_gap_adv_stop();
    nrf_gpio_pin_set(LED_4);
    

    Where in your code do you measure the time?

Children
No Data
Related