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 Pete

    I asked one of the developers to have a look and see if the issue seems familiar. 

    In the mean time another potential workaround is to configure the UART with the RX on a different pin, one that is not used for anything else and can be pulled high by enabling the internal pullup resistor. 

    Then after the nrf_serial library is successfully configured you can change the RX pin to the correct one, either by writing to the PSEL.RXD register directly, or by adding a function to the nrf_serial library that allows you to reassign the pin without doing a full re-initialization (probably a more reliable solution). 

    Best regards
    Torbjørn

Reply
  • Hi Pete

    I asked one of the developers to have a look and see if the issue seems familiar. 

    In the mean time another potential workaround is to configure the UART with the RX on a different pin, one that is not used for anything else and can be pulled high by enabling the internal pullup resistor. 

    Then after the nrf_serial library is successfully configured you can change the RX pin to the correct one, either by writing to the PSEL.RXD register directly, or by adding a function to the nrf_serial library that allows you to reassign the pin without doing a full re-initialization (probably a more reliable solution). 

    Best regards
    Torbjørn

Children
Related