Prioritizing outgoing data from BLE peripheral depending on bandwidth?

Hi,

I'm designing a BLE peripheral that sends two kinds of data to the central: time critical high priority message data and low priority streaming data. Low priority data should only be sent if there's enough bandwidth and must not be sent at the expense of high priority data. Latency/throughput should be kept as low/high as possible.

I'm using a large MTU to maximize throughput. For minimizing latency, I'm using a short connection interval combined with sending batched data on radio notifications as described in [this post](devzone.nordicsemi.com/.../optimizing-ble-midi-with-regards-to-timing-1293631358). So far, this looks like a promising approach.

It's less clear to me how to determine how much low priority data to send depending on the link quality, so as to not interfere with the delivery of high priority data. Any pointers to reading material, example code etc would be much appreciated.

Parents
  • Hello,

    Once a notification have been written to the BLE stack, it will be sent in the order they are written from the application. So the only thing you can control here is the order notifications are written from the application. That said though, I am not entirely sure how big of a problem this really is, a lot of packet can be sent, and typically the buffers are emptied between connection events (e.g. connection intervals). So the best way to ensure you can send data with short latency is to always use a short connection interval.

    I'm using a large MTU to maximize throughput.

    Make sure that you also have DLE enabled (e.g. DLE size >= ATT MTU + 3bytes), else that ATT MTU may be fragmented on-air, and you don't really get any benefit of using larger MTU.

    Kenneth

  • Hi Kenneth,

    thanks for you quick reply.

    One thing that I failed to mention is that the low priority data consists of sensor value samples. It is acceptable to discard outgoing samples when needed and only write these to the BLE stack if the bandwidth is high enough. The scenario I want to avoid is low priority sensor data clogging up the output buffers and preventing/delaying the delivery of high priority data. On the other hand, I'd like to utilize as much available bandwidth as possible.

Reply
  • Hi Kenneth,

    thanks for you quick reply.

    One thing that I failed to mention is that the low priority data consists of sensor value samples. It is acceptable to discard outgoing samples when needed and only write these to the BLE stack if the bandwidth is high enough. The scenario I want to avoid is low priority sensor data clogging up the output buffers and preventing/delaying the delivery of high priority data. On the other hand, I'd like to utilize as much available bandwidth as possible.

Children
  • I suggest to make this very simple, just have some global flag that when set stop feeding the low priority data to the BLE stack, then only when you have sent the high priority data you clear the flag to resume feeding the low priority data again. As long a you have a short connection interval then any low priority data in the BLE buffer will in any case be emptied in (worst case) few connection interval.

    Kenneth

Related