UART RX double buffering

Hi Nordic experts,

I'm working for Particle Inc. We are using nRF52840 on our dev boards (Argon / Boron / etc.). We are experiencing a UART RX data lost issue using a single buffer for receiving. We designed our own UART driver that is independent from the nrfx driver. See the soure code for your reference: https://github.com/particle-iot/device-os/blob/develop/hal/src/nRF52840/usart_hal.cpp. Here I'd like your official suggestion about the UART RX path: whether double buffering is the best approach to avoid RX data lost. We have created a PR to refactored our driver to use double buffering for RX path: https://github.com/particle-iot/device-os/pull/2685

Any suggestion would be really appreciated.

Best regards,

Guohui

Parents
  • The data loss can happen if NRF_UARTE_SHORT_ENDRX_STARTRX is not enabled and the NRF_UARTE_EVENT_ENDRX is not handled in time, i.e. the receiver is not re-started in time while the peer device is sending data, right? Or other ISRs with higher priority may also postpone the handling of the NRF_UARTE_EVENT_ENDRX event, such as SoftDevice interrupts? In our case, the buffer doesn't overflow, but we did lost data in the middle of a transaction.

    Best regards,

    Guohui

Reply
  • The data loss can happen if NRF_UARTE_SHORT_ENDRX_STARTRX is not enabled and the NRF_UARTE_EVENT_ENDRX is not handled in time, i.e. the receiver is not re-started in time while the peer device is sending data, right? Or other ISRs with higher priority may also postpone the handling of the NRF_UARTE_EVENT_ENDRX event, such as SoftDevice interrupts? In our case, the buffer doesn't overflow, but we did lost data in the middle of a transaction.

    Best regards,

    Guohui

Children
No Data
Related