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

BLE peripheral with 5 simultaneous advertising sets?

I am developing for nRF52832 chip running the latest version of SDK. I'm looking to enhance my application to support 5 simultaneous advertising sets. These are non-connectable advertisements which hopefully should simplify things a bit. Does the SDK support setting multiple advertising sets? If yes, is there an example or documentation on how to implement this?

I also need to update the contents of advertisement data on the fly. There's the `ble_advertising_advdata_update` function that I can call to update the data. When is a safe time to call this function? Should I set the advertisement duration to 1 second and update the adv data on timeout callback or is there a better way of implementing this? How do I get notified when the adv packet is sent on all 3 channels so I can update the adv data?

  • Hi Kenneth,

    Thanks for that info. I managed to get my app to send all the advertisements after experimenting with many different methods. Here's my findings:

    1. I set the advertisement interval to 100ms, and update the advertisement data every 100ms in the middle of the interval, i.e.:   Start advertisement ---> update advertisement 150ms later ---> update advertisement 100ms later ---> ...   What I observed is the first advertisement is often not sent out. Is there an event for when an advertisement is sent out?
    2. I set the advertisement interval to 100ms, and used `ble_radio_notification_init` to get the radio event. In the radio event handler, I update the advertisement data when radio state is off. This is working reliably, except when I run scanning and advertising concurrently. I can't work out whether the radio event was for scan or transmit.
    3. I set both advertisement interval and advertisement duration to 100ms. I look for `BLE_GAP_EVT_ADV_SET_TERMINATED` event to update advertisement data and start another round of 100ms advertisement. With this option, I get huge data loss, probably because the advertisements were not sent out.
    4. When I run my scanner (interval 500ms, window 490ms, duration 0) concurrently with the advertisement, I only see the very occasional advertisement get sent out. If I change both the scan interval and window to 20ms, I get more advertisement packets. How do I reliably scan and advertise 5 data sets concurrently?

    Good chance that I'm not reading the documentation correctly, but the behavior I've observed does not make sense to me.

Related