Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf_serial_read() stops receiving data after some time.

Hi,

I am using nrf52840 dk. Also, I am using nrf_serial library with DMA mode for uart communication. I have a continuous loop running in main and there i read data using nrf_serial_read() with timeout set to 0. I have to read continuous polling message and then response. For sometime the data is received perfectly but then it suddenly stops to receive data giving read count passed to nrf_serial_read() zero. Moreover, after I stop receiving data I checked if event is generated at uart_event_handler() in nrf_serial.c, but no rx_done event is encountered in uart_event_handler().

Parents
  • Hi

    I'm glad to hear you got it working! Framing errors usually occur when:

    • Baud rates are mismatched
    • A serial line is very long
    • When there is a lot of electrical noise on the serial cable

    They can also occur if there is no serial ground connection between the two connected serial devices, or if the connection is intermittent/has a high impedance because of poorly connected ends. You can try to use a sniffer to watch your data during transmission.

    Best regards,

    Simon

  • Hi,

    The framing error is encountered only when I read uart data continuously in main loop. In another sample code created using serial example, reading uart data in event handler, this error is not encountered for same rx data.  All other things are same. In serial example, I have just removed the while loop and read data in event handler. Moreover due to framing error, on nrf_serial_drv_err event i need to re initialize serial ( uart) and the error is quite frequent so it causes a high percentage of packet loss. All other configurations are same, also the setup is same. What could be the possible reason for this? Also, is there an alternative to handle this error?

    Thanks and Regards,

    Prerit Choksi

Reply
  • Hi,

    The framing error is encountered only when I read uart data continuously in main loop. In another sample code created using serial example, reading uart data in event handler, this error is not encountered for same rx data.  All other things are same. In serial example, I have just removed the while loop and read data in event handler. Moreover due to framing error, on nrf_serial_drv_err event i need to re initialize serial ( uart) and the error is quite frequent so it causes a high percentage of packet loss. All other configurations are same, also the setup is same. What could be the possible reason for this? Also, is there an alternative to handle this error?

    Thanks and Regards,

    Prerit Choksi

Children
No Data
Related