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

BLE Protocol for one peripheral connected to multiple centrals

Hi, we have a project that we're currently working on, and we're looking for some information on BLE behaviour that would be very helpful. We are currently using SDK 15.3 and softdevice s132 v6.1.1.

We are looking to implement a setup where we would have our nRF52832 in a peripheral role connected to multiple mobile devices (iOS and Android) with central roles. The main goal of the wireless communication is to have the nRF chip send one notification (containing a single 8-bit value) to each connected device once per connection interval. We would also like to be able to send as many notifies as possible to each connected device (ideally ~20/sec each), i.e. have as small a connection interval as possible. Before trying to work out the timing / BLE scheduling, there are a few questions that I'm unsure about:

  1. Since it is the peripheral doing all of the communication (via notifications), will the softdevice be able to set up the most efficient scheduling to get the notifies out as quickly as possible?
  2. With the peripheral be able to dictate the connection intervals, or will that be determined by the individual centrals?
  3. I read in the s132 documentation that a notify takes 2.5ms to transmit. Is that correct? If so, does that mean that if the connection interval is 10 ms for 4 connected devices, the peripheral would be able to send out one notify to each device?
  4. In order to minimize the connection interval (to send as many notifies as possible), is it possible to adjust the connection interval depending on many devices are connected to the peripheral (i.e. adjust the value each time a new device is connected)? Or is it better to have a set value to be able to accommodate the max number of connected devices?
  5. In a situation where there are connected devices receiving notifies from the peripheral and then a new central initiates a new connection, will the notifies stop being sent until that new connection is established?
  6. Along the same line, if we would like the centrals to be able to send messages (writes) to the peripheral, will that interfere with the notifies that the peripheral is trying to send? i.e. Will the writes collide with the notifies and take priority?

I apologize for all of the questions, but any answers to them would be much appreciated! Thanks!

  • Hi Torbjørn,

    Thanks again for your detailed reply! It is definitely helping with our understanding!

    3. Since our payload is only 1 byte of data, I guess we can assume that transmission of the notification would take somewhat less than 2.5 ms? If we say (conservatively) it takes ~350us to transmit 20 bytes of overhead + 1 byte data, plus another 80us for poll packet, plus 150us for packet to packet time, that's approximately 580us for the transmission of 1 notify. That should, in theory, give us a lot more headroom to play with to avoid packet loss / latency.

    4. Unfortunately with our setup it is not possible to switch the roles of the devices. I agree that would be ideal for scheduling (although not for our setup :P)

    5/6. So it is safe to assume that notifications will still be sent out throughout the connection establishment process, and also while other devices may be writing to the peripheral, however there may likely be some delays in them being sent. Is that fair to assume?

    So as I understand it from this discussion, I think I will take the following approach while trying to achieve our goal of each connected device receiving ~20 notifications / second:

    • Assume ~2.5ms per notify (potentially less depending on question 3)
    • Start with a max number of connected devices (ex. 4)
    • Determine ideal connection interval for max number of devices (ex. 4 * 2.5ms = 10ms)
    • Request ideal connection interval (min=max) from each connected device (connect to max number of devices)
    • Measure the number of notifies being received by each mobile device
      • If the number of notifies is too low, consider increasing the connection interval
      • If the number of notifies is high enough, great! Consider increasing the max number of connected devices.
      • Repeat step until desired number is achieved.
    • Add in writes from centrals to peripheral and repeat previous step to determine effect on notification rate.
    • Be sure to measure notification rate while new devices are establishing connections.

    Does that seem to be the best approach to take since we unfortunately don't have much control over scheduling as the peripheral?

    Thanks again for your help!

    Adam

  • Hi Adam

    3. Around 5-600us sounds realistic, yes, but I am not sure it makes a big difference when it comes to latency. The SoftDevice will still reserve the full 2.5ms for that connection, and use that as a reference when scheduling multiple links (after all the scheduler can't know the size of the TX and RX packets ahead of time). 

    5/6. If the first packet of a new connection conflicts with an existing connection then the existing connection will lose a connection event, yes, leading to a delayed notification packet. 

    If the central writes to a peripheral the only delay will be the time it takes to send the data packet relative to sending an empty packet, which should be a very small difference (8 us per additional byte). 

    I think the procedure you describe to test this out sounds reasonable. If you simply push notifications as quickly as you can from the peripheral side, and add some code on the app side to measure the number of received notifications, then you should be able to benchmark the performance for different connection intervals and under different scenarios. 

    It is worth mentioning that you might be able to send multiple notifications during a single 2.5ms connection event if you are only sending short packets. This should help you catch up whenever a connection loses a connection event because of scheduling conflicts etc. 

    Best regards
    Torbjørn

  • Hi Torbjørn,

    Makes perfect sense! Thanks again for all of your responses and information!

    Regards,

    Adam

  • Hi Adam

    I'm happy to help. The best of luck with your project Slight smile

    Best regards
    Torbjørn

Related