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

manual advertising

Hi,

I'm using the SDK 12.2 with the sd 132 3.1.0, and actually I'm trying to send two separate advertisements wich I'm swapping every "radio notification event", but I noticed that after changing it and starting the transmission with "ble_advertising_start" the message is transmitted instantly. So I was wondering if it's possible to send the advertisement only when I want, completely manual. This way I can control the exact number of advertisements sent easily.

Thank you!

  • Hi,

    When you use radio notification events with SD S13x it gives you first interrupt after first ADV_xxx packet is sent. So you need to start counting from there. Also remember that SDK library will call your radio notification handler twice per each interval (once before and once after) - you can detect that with bool parameter of the handler - and also note that depending on adv. channel map soft device sends 1, 2 or 3 packets during every interval. Does this solves your counting? If not could you paste your code to see where is the problem?

    To your question: sure you can do advertisement "manually". Either by running custom applicative timer and using adv. start and stop or by not using Soft Device at all. Just bare in mind that a) advertisement interval should have jitter (mandated by BT SIG to prevent collisions) and b) that start/stop of advertising activity through Soft Device API isn't guaranteed to start immediately so there can be pretty random inaccuracy (on top of your timer) which can go up to +-10ms (at least this is what I've measured with S13x V2 but it might be caused by other things then Soft Device processing).

    Cheers Jan

  • Well the problem is that the radio notification handler is called exactly after calling "ble_advertising_start" so this indicates that a packet is sent just after calling it... So another one is sent when the interval time is reached.

  • Well this contradicts my experience: after calling sd_ble_gap_adv_start you get called only when radio is being deactivated (= adv. packet has been already sent) and on each next event you get called before packets are sent (boolean radio_active parameter is true) and then after it (radio_active is false). With this knowledge you can easily count everything, can't you?

  • I have configured the radio notification to be callen on active and inactive radio events. So the handler is called during and after a radio event, this way I can know when a packet is sent (In my case I'm turning on a LED during the active radio period and turning off when the radio is innactive). And what I see is that the packet is sent inmediately after the ble_X_start functions..."

  • So radio notifications work and the only problem is, that it doesn't give you interrupt before the first packet(s)? You can call it bug but I guess Nordic will call it feature (ending packets out fast looks like more important then waiting for some notification interrupt). If you really have problem with counting then simply start from 1. Am I missing something?

Related