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
  • Well as you see in the code snippet from NUS in SDK ble_nus_send_string calls in the end sd_ble_gatts_hvx and you just get the status code as return value from ble_nus_send_string. So you should examine this code and once it's NRF_ERROR_RESOURCES you should store the state variables where in your global transfer you are (before this last ble_nus_send_string call!) and restart sending process (state machine) once you get any BLE_GATTS_EVT_HVN_TX_COMPLETE event. And repeat until all data are sent out, simple as that.

Reply
  • Well as you see in the code snippet from NUS in SDK ble_nus_send_string calls in the end sd_ble_gatts_hvx and you just get the status code as return value from ble_nus_send_string. So you should examine this code and once it's NRF_ERROR_RESOURCES you should store the state variables where in your global transfer you are (before this last ble_nus_send_string call!) and restart sending process (state machine) once you get any BLE_GATTS_EVT_HVN_TX_COMPLETE event. And repeat until all data are sent out, simple as that.

Children
No Data
Related