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, I still have very basic doubts. I have added a snippet of ble_nus code in main question. So basically you are suggesting to use sd_ble_gatts_hvx() command and pass parameters to it that are set in ble_nus_send_string(), and wait for NRF_ERROR_RESOURCES.

    Then I do ble_nus_send_string() to send data over ble link, and every time transfer is completed I get BLE_GATTS_EVT_HVN_TX_COMPLETE event in

    static void on_ble_evt(ble_evt_t * p_ble_evt)

    after which I again start queing? But if I queue using sd_ble_gatts_hvx(), and then call ble_nus_send_string, won't it again queue same data, as the above function is already being called in ble_nus_send_string?

Reply
  • Hi, I still have very basic doubts. I have added a snippet of ble_nus code in main question. So basically you are suggesting to use sd_ble_gatts_hvx() command and pass parameters to it that are set in ble_nus_send_string(), and wait for NRF_ERROR_RESOURCES.

    Then I do ble_nus_send_string() to send data over ble link, and every time transfer is completed I get BLE_GATTS_EVT_HVN_TX_COMPLETE event in

    static void on_ble_evt(ble_evt_t * p_ble_evt)

    after which I again start queing? But if I queue using sd_ble_gatts_hvx(), and then call ble_nus_send_string, won't it again queue same data, as the above function is already being called in ble_nus_send_string?

Children
No Data
Related