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

Is sd_ble_gap_adv_data_set "BLE interrupt" safe?



Hi all

I am wrking in an sample be program where ble is advertising everey 5 seconds. I have configured app timer with fire period = 5 seconds in order to read
a sensor. After reading sensor, i call sd_ble_gap_adv_data_set in order to update advdata, to be broadcasted next at the time of ble adv period.

Of course, I can change the app timer fire period for a short one, but my question is:


Is it possible to be updating the advdata (sd_ble_gap_adv_data_set) and before finishing this operation, the be advertisements starts and uncomplete
written data is broadcasted?


I have looked to function

sd_ble_gap_adv_data_set
ble_gap_adv_data_set_req_enc

and I did not see any protection (semaphore or related)


Thanks a lot

Alex

  • Hi,

     

    In order to update the advertising data, you need to stop/start the advertiser to update the on-air data.

    In terms of your application data handling: All sd_ble_* prefixed calls are SVC-calls, running in interrupt level 2 (in nRF51-series devices), so as long as you do not update or overwrite the adv-data buffer in a higher priority, this should be "safe".

     

    Best regards,

    Håkon

Related