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