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

Fastest peripheral to central small packet transfer (nRF52)

I am trying to send small data packets of up to 9 bytes at the fastest and most consistent rate from a nRF52 peripheral to a nRF52 Central. Both use the s332 SoftDevices.

What seems to give the best results is:

  1. MIN and MAX CONN INTERVAL SET to 7.5ms in both Central and Peripheral
  2. Calling ble_nus_string_send at a 10ms rate

The above yields transmission packets sent generally less than 25ms apart but sometimes they are > 50ms apart.

I tried waiting for a BLE_EVT_TX_COMPLETE event and then immiedely calling ble_nus_tring_send again the peripheral but when I did the rate was much worse than the above.

Does anyone know the best setup to achieve the fastest and most consistent packet transfer of up to 9 bytes?

  • You won't get anything much better then Nordic throughput examples I'm afraid. If you care about "latency" then you should go for 7.5ms connection interval (as you did) and simply try to play with throughput and MTU extension parameters to fine the best experimentally. If you group data to longer streams and then cut into packets of MTU-3 size it should be close to "ideal" throughput over GATT, also calling HVX transport each time you have packet ready (whatever timing it is) and simply doing it until you get error code back and then restart the same state machine on TX_COMPLETE event works well for me, hard to say what are you doing differently without seeing the code, debug log from the BLE FW and log from BLE radio...

  • Could you be using indications? Try to use notifications instead, it should be possible to send multiple packets in each connection event also at 7.5 ms events.

  • Thank you for the answer. When you say "calling HVX transport" what function are you referring to exactly? We are currently using return "sd_ble_gatts_hvx(p_nus->conn_handle, &hvx_params);" Is there a better set of functions to use?

  • No, sd_ble_gatts_hvx is the only way how to issue GATT Notify method from GATT Server role so that is correct. Do you check return value (error code)? How do you handle when SD has no free Tx buffer left? Do you have any log from radio analyzer/sniffer to see how exactly is transfer achieved on link layer? Without that you are just guessing and dancing around the black box.

Related