This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf_serial_rx_drain not clearing overrun error (?)

Hi,

I'm using nrf_serial to configure and then read data from a GPS engine, but I am getting unrecoverable OVERRUN errors on start-up if the GPS device is sending data when I try to configure the serial port. I was hoping that I could just call the nrf_serial_rx_drain(xxx) function in my serial_event_handler to reset the buffer read and write pointers, but this has no effect, and the OVERRUN error appears on every subsequent character. Th only way I can get round it is by staging the initalisation as follows:

1. Initialise the serial port for TX only by setting the RX pin to NRF_UART_PSEL_DISCONNECTED.

2. Send a command to the GPS to switch off all messages.

3. Re-initialise the serial port to enable RX

4. Send a command to the GPS to enable the required messages.

but this is clunky and I still have to insert a short delay between each step to prevent the overruns.

Am I using nrf_serial_rx_drain(xxx) incorrectly, or misunderstood its function ?

Thanks

Parents
  • Hi,

    couple of questions. Are you using UART or UARTE underneath? What device are you using and which SDK? Are you using flow control?

    If you are not using flow control (and don't plan to use it) I would recommend to check nrf_libuarte_async library for UARTE. It is capable of reliably receiving data of any length. nrf_serial stops and starts reception between every byte so it is possible to hit framing error if interrupt is not handled on time.

Reply
  • Hi,

    couple of questions. Are you using UART or UARTE underneath? What device are you using and which SDK? Are you using flow control?

    If you are not using flow control (and don't plan to use it) I would recommend to check nrf_libuarte_async library for UARTE. It is capable of reliably receiving data of any length. nrf_serial stops and starts reception between every byte so it is possible to hit framing error if interrupt is not handled on time.

Children
Related