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

Can not get high enough throughput using BLE NUS

I am in the process of trying to send live data from a nrf52 board over bluetooth to another nrf52 board using the example projects ble_app_uart_c and ble_app_uart. We are using SDK 14.2 with the S132 softdevice on windows 10.


16 bytes of data are generated at 200hz. At first I have tried sending this data every 5 ms, I couldn't get this to work.
Now I am buffering the data and sending 160 bytes every 50 ms. I can send 3 times, but then I get a NRF_ERROR_RESOURCES message and can send 3 times again. I have tried experimenting with different values for connection length and connection interval , but I can not get a high enough throuhgput.

I have the idea that I am overlooking something. Has anyone managed to implement a similar scenario?

Parents
  • Hi Gert

    Getting the NRF_ERROR_RESOURCES error is normal when you try to maximize throughput, and the way to handle it is basically to upload packets until the error occurs (or you run out of packets), and then wait for the BLE_GATTS_EVT_HVN_TX_COMPLETE event to occur before you try to upload any more packets. Then you just repeat the procedure.

    In order to maximize the throughput it's also a good idea to buffer multiple samples into fewer, large packets rather than sending 16 bytes at a time. 

    Finally, what is your NRF_SDH_BLE_GAP_EVENT_LENGTH set to in sdk_config.h ?
    This parameter will decide how many packets can be sent on each connection event, and if you increase it you should see a higher throughput in general. 

    Best regards
    Torbjørn

  • I was buffering the data already, I sent 160 bytes every 50 ms. My expectation was that 50 ms should be enough to send the 160 bytes. If I would wait for the NRF_ERROR_RESOURCES my buffer wil grow and I can not send data for an hour long or more. I need a live data stream.

    I experimented with NRF_SDH_BLE_GAP_EVENT_LENGTH  but I have not found a value that gives a higher throughput, with large values I get more errors. What are values  that you would suggest?

    is 160 bytes per 50ms too much? should I send less bytes with a shorter interval?

  • I tried witha a small interval and I managed to get it working to send 20 bytes each 5 ms.

    With a connection interval of 10 a gap event length of 5 and mtu of 29

Reply Children
No Data
Related