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

Radio InActive Notification

Hi,

I want to advertise in variable intervals and mostly only one advertisement at a time. I planned to do it like this:

1- start advertising with any interval (e.g., 100msec) in non-connectable mode

2- in the radio INACTIVE notification handler use sd_ble_gap_adv_stop()

3- start again whenever needed, and repeat the steps

The problem that I noticed is that the program will enter radio_notification_evt_handler only after the 2nd advertisement (e.g., t=0 1st adv and t=100msec 2nd adv).

However, if I stop adv after 50msec for example and then again start adv, the handler will be called after the 1st adv too.

Any idea why this happens?

Also, how long after the transmit is completed, the handler will be called? My understanding was that it should be exactly after the packet is sent, but I'm seeing delays up to 15msec between NRF_SUCCESS return from start_advertising and entering the radio_notification_evt_handler. Does adv taked 15msec to complete? I think it should be around 4-5msec.

I'm using nRF51 SDK 9.

  • I tested this with S110 v8 and S130 v1 and SDK 9.

    I'm not able to reproduce your first problem. Here is my project, see if you experience the same with it.

    The interrupt is set immidiately after TX/RX. The actual radio transmission of the advertisment (3 packets on 3 channels) only takes around 2.5 ms, but there is a random delay between 0 and 10 ms, and with some preprocessing 5-15 ms between sd_ble_gap_adv_start() and the end of the first advertising is expected.

  • Thanks Petter! With your code in my project the results were the same. However, as a stand alone code it was working fine. So, I decided to re-build my program around the working notification and see which block make it go wrong (and that's why it took so long!) Finally, here is what I think is happening: Before starting the advertisement and notification, I'm running scanning in timeslot. When I close it, it will generate an inactive notification and in the handler I'm turning off advertisement (as it's needed in the program). I can see a delay of 20msec or 120msec between disabling timeslot scanning and its inactive notification (depending on where initializing notification). During this time it seems the radio can not advertise and waits for timeslot to be closed, and as I stop advertisement in the handler, the first adv never happens, and this is fine for me.

  • About the 0-10msec random delay, I knew that, but I was thinking it only happens between advertisements and the first one always happen immediately. As you said my tests show that the delay is there even for the very first packet. Is there any way to disable that at least for the first one?

  • Unfortunately, there is no way to disable the delay for the first one.

Related