BLE receive application buffer overflow

Hello,

I am using the Soft Device S140 7.3.0 with nRF5 SDK 17.1.0 and the nRF52820 as a peripheral in an NUS application. Initially, the transfer was slow but worked perfectly without data loss. After some optimizations, I was able to achieve higher speeds, enough for my goal. However, now the reception buffer overflows because the Central sends more data than the system can handle.

Since I don't have access to the Central, it is not possible to create a custom method to indicate to the Central to pause data transmission and then resume it.

Is there a way to pause BLE reception (by signaling to the Central, freezing the ACK, or some other method) until the buffer level returns to normal?

  • Try to improve the bottleneck of lower bandwidth from the peripheral side by increasing some buffers. These configs are widely discussed in this forum and some of them can be as below in your sdk_config.h file

    // need to calibrate by trial and error or using some other tools like system viewer
    #define NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE    2048 
    #define NRF_SDH_BLE_GAP_DATA_LENGTH        251
    #define NRF_SDH_BLE_GATTS_MAX_MTU_SIZE     247

    Adjust connection event length (increase) so that more data can be transffered in one connection interval.

    You can also handle flow control by handling the SD_BLE_GATTS_HVN_TX_COMPLETE event in the ble event handler. This topic is also widely discussed in this forum and you can search for this  using this keywords "SD_BLE_GATTS_HVN_TX_COMPLETE flow control"

    There is no direct mechanism to signal pause or freeze to the peer, but the softdevice will start to NACK the packets automatically once its buffers are full. Trying to implement the above suggestions might reduce the buffer full instances. In any case, there will be no data loss, I guess you are just trying to avoid having this error but avoid might not be possible if central is sending as fast as it could and the peripheral per packet processing latencies are more than the central.

Related