BLE data loss with nus

Hi,

(nrf52840, custom device, nRF5_SDK_15.3.0_59ac345)

I am working on a BLE project involving one central device and two peripheral devices using BLE NUS. The peripheral devices send data with a maximum size of 230 bytes each time a sensor interrupt occurs, which sometimes results in them sending data simultaneously.

I've observed occasional data loss at the central device, even though the peripherals seem to send data without errors.

For debugging, I'm using a UART driver for logging and not using any UART-related code from NUS. Data loss seems to occur when I enable sensor raw data logging within a loop of the data size. Initially, I thought the logs might just be too extensive for one event and therefore not appearing. However, a review of the data count indicated that the BLE RX handler wasn't receiving any data.

Interestingly, when I disabled the raw data logs, the data loss didn't occur. I attempted to address the issue by increasing the UART RX buffer, FIFO size, and baud rate, but the data loss persisted.

My guess is that the data loss may not be caused by the UART itself, but by the processing time required for the UART operations. I also experimented with various connection intervals, which sometimes improved but also worsened the issue, though data loss still occurred.

Is it possible for data loss to happen when two data packets arrive simultaneously at the central device? Do you have any suggestions on how to resolve this issue?

Thank you in advance

Related