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

NRF52840 BLE transfer using NUS service

image descriptionI am writing an application for sending data received over SPI from a non-nordic chip to nrf52840 to nrf uart app using NUS service. I am using 20 bytes of a packet size the max in NUS. The SPI sampling happens at 4 MHZ. I am receiving a very low throughput of around 2.88kbps. Can anyone guide me how to change BLE setting to maximize the throughput

Parents
  • Hi Pranav,

    You need to queue as much as possible using the sd_ble_gatts_hvx() command (what inside ble_nus_string_send) until you receive NRF_ERROR_RESOURCES meaning all the buffer is queued. And then after that you wait for the BLE_GATTS_EVT_HVN_TX_COMPLETE event telling that there are some packets sent, and the buffer is free, then you can queue again using hvx command.

Reply
  • Hi Pranav,

    You need to queue as much as possible using the sd_ble_gatts_hvx() command (what inside ble_nus_string_send) until you receive NRF_ERROR_RESOURCES meaning all the buffer is queued. And then after that you wait for the BLE_GATTS_EVT_HVN_TX_COMPLETE event telling that there are some packets sent, and the buffer is free, then you can queue again using hvx command.

Children
No Data
Related