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
  • Hi

    I'm not sure I understand your first sentence, but yes, processes with higher priority can postpone UARTE peripheral handling, and the SoftDevice will always take precedence over other peripherals. If so I think you need to add a STOP event when the UARTE is interrupted for example to make sure the transmitting device stops transmitting when you're interrupted on the receiver for example.

    Best regards,

    Simon

Reply
  • Hi

    I'm not sure I understand your first sentence, but yes, processes with higher priority can postpone UARTE peripheral handling, and the SoftDevice will always take precedence over other peripherals. If so I think you need to add a STOP event when the UARTE is interrupted for example to make sure the transmitting device stops transmitting when you're interrupted on the receiver for example.

    Best regards,

    Simon

Children
  • Hi Simonr,

    What I meant is by default the NRF_UARTE_SHORT_ENDRX_STARTRX is not enabled, so the receiver is automatically stopped by hardware when the NRF_UARTE_EVENT_ENDRX is asserted, right? If so, we have to re-start the receiver manually by software when servicing the UART ISR to handle the NRF_UARTE_EVENT_ENDRX event. If the UART ISR is interrupted/suspended by whatever ISR that has higher priority, then the receiver is not enabled during this period, so that we might loss data if the peer UART device is keeping sending data.

    Best regards,

    Guohui

Related