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

Inconsistent latency with ble_app_uart sending via ble

Hi,

We are trying to optimize the speed at which we send data over BLE UART with the nrf52832. Currently, we are using the ble_nus_data_send() function in a while loop with no delay to send as fast as possible. On the nrf toolbox app and the Adafruit BLE app, however we are getting a few sets of 20 bytes with very inconsistent latency (burst sends and hangs and bursts again at random intervals). How do we have the nrf52 send our 20 byte data consistently with low latency. Here is our latency output from our testing software.

Connected to device!
data received: 20 bytes
LATENCY: 8079
data received: 20 bytes
LATENCY: 241
data received: 20 bytes
LATENCY: 658
data received: 20 bytes
LATENCY: 0
data received: 20 bytes
LATENCY: 1
data received: 20 bytes
LATENCY: 5468
data received: 20 bytes
LATENCY: 50
data received: 20 bytes
LATENCY: 481
data received: 20 bytes
LATENCY: 490
data received: 20 bytes
LATENCY: 2
data received: 20 bytes
LATENCY: 528
data received: 20 bytes
LATENCY: 480
data received: 20 bytes
LATENCY: 1
data received: 20 bytes
LATENCY: 0
data received: 20 bytes
LATENCY: 238
data received: 20 bytes
LATENCY: 0
data received: 20 bytes
LATENCY: 1
data received: 20 bytes
LATENCY: 1
data received: 20 bytes
LATENCY: 4
data received: 20 bytes
LATENCY: 475
data received: 20 bytes
LATENCY: 1
data received: 20 bytes
LATENCY: 1
data received: 20 bytes
LATENCY: 0
data received: 20 bytes
LATENCY: 238
data received: 20 bytes
LATENCY: 1
data received: 20 bytes
LATENCY: 0
data received: 20 bytes
LATENCY: 1
data received: 20 bytes
LATENCY: 0
data received: 20 bytes
LATENCY: 176
data received: 20 bytes
LATENCY: 1
data received: 20 bytes
LATENCY: 61
data received: 20 bytes
LATENCY: 241
data received: 20 bytes
LATENCY: 181
data received: 20 bytes
LATENCY: 477
data received: 20 bytes
LATENCY: 840
data received: 20 bytes
LATENCY: 0
data received: 20 bytes
LATENCY: 1
data received: 20 bytes
LATENCY: 1
data received: 20 bytes
LATENCY: 0
data received: 20 bytes
LATENCY: 1
data received: 20 bytes
LATENCY: 5936
data received: 20 bytes
LATENCY: 241
data received: 20 bytes
LATENCY: 59
data received: 20 bytes
LATENCY: 241
data received: 20 bytes
LATENCY: 0
data received: 20 bytes
LATENCY: 179
data received: 20 bytes
LATENCY: 1
data received: 20 bytes
LATENCY: 0
data received: 20 bytes
LATENCY: 1263
data received: 20 bytes
LATENCY: 1
data received: 20 bytes
LATENCY: 0
data received: 20 bytes
LATENCY: 1
data received: 20 bytes
LATENCY: 235
data received: 20 bytes
LATENCY: 1
data received: 20 bytes
LATENCY: 1
data received: 20 bytes
LATENCY: 0
data received: 20 bytes
LATENCY: 0
data received: 20 bytes
LATENCY: 238
data received: 20 bytes
LATENCY: 3
Connection status: Disconnected from device.
When we try the same setup in SDK 12, we are able to get consistent latency. Using Adafruit's bootloader and library we are getting 5 ms consistent latency on SoftDevice 0.5.0 and 60 ms consistent latency on SoftDevice 5.0. All of these involve sending a 20 byte packet over the BLE UART.
Our current setup is with SDK 15 and SoftDevice 6.0 and we would like to optimize our sending to be as fast as it was with Adafruit's library. How do we acheive this consistent low latency via BLE? I've read that data rates can be as high as 128 kBps.
Parents Reply
  • The latency is from a testing software we created that simply measures the time between two consecutive receiving packets of 20 bytes, but this latency is also the same that we've seen from the nrf toolbox app and the adafruit ble connect app. Our max connection interval is currently 30 ms and min is 20 ms, but we have changed them from 7.5 to 400 and it hasn't made any significant difference. It still continues to have irregular slow downs in latency as seen in our output above.

Children
Related