Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

sd_ble_gap_adv_stop takes long sometimes

Hi,

I am working on handling multi-radio protocols like only 1 radio at a time. (https://devzone.nordicsemi.com/f/nordic-q-a/63194/when-the-timeslot-extension-could-be-failed)

Since I decided to stop advertising before other radio jobs, I am using sd_ble_gap_adv_stop() for stopping advertising but it sometimes takes long such as 6~7 seconds. (time between the logs below) 

It usually happens after the very first advertising start or after advertising is being done for a while like a minute.

[code]

 log("ble_stop_advertising begin\r\n");
 ble_advertising_tconst p_advertising = &m_advertising;
 uint32_t ret = sd_ble_gap_adv_stop(p_advertising->adv_handle);
 log("ble_stop_advertising done: %d\r\n", ret);
Could it happen sometimes? or Is there any solution to improve it?
Thank you.
  • eleven-x_devteam said:
    Thank you for the code.

    No problem at all, I hope you found it useful to have a look at!

    eleven-x_devteam said:
    It works but it is different from my code. 
    eleven-x_devteam said:
    Do I need to call sd_radio_session_open  only once and is it OK to leave it open like even when device reset?

    You may leave the session open, but you may only have one open session at the time.
    Please see the sd_radio_session_open API Reference for further detail.

    eleven-x_devteam said:
    I think that the issue is related to max extension time.

    The maximum extension time in the provided example is only to demonstrate how much time that is available for non-SoftDevice functionality. 

    eleven-x_devteam said:
    I think the delay can happen while extension keeps going up to 128 sec even after sd_radio_session_close was called. Does it make sense?

    I have not verified this myself, but I suppose this is what happens, yes. As per the documentation : "any current radio timeslots will be finished before the session is closed"
    So I would think that is what happens.

    If you are not using the SoftDevice for anything, then you may request as much timeslots as you would like and the SoftDevice will grant it - since it has no use for the radio itself.

    Best regards,
    Karl

Related