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 would recommend reading your data from an event handler, as using rx_read in your main() is ineffective. Also, what is your ERRORSRC register value? I am having trouble understanding what is wrong here as well.

    Best regards,

    Simon

  • Hi,

    I have read ERRORSRC on each nrf_drv_uart_evt_error and it reads out 4 (framing error). Also, what I found is, on read event (NRF_DRV_UART_EVT_RX_DONE) the uart_event_handler in nrf_serial.c reads data and puts it in queue and then generates serial rx event (NRF_SERIAL_EVENT_RX_DATA). So this already is a kind of polling. Moreover, I am pretty sure my data is not going to overflow this queue before i read it continuously in main(). So I guess directly using nrf_serial_rx in main() will make it more efficient and decrease some complexity for me.

    Thanks and Regards,

    Prerit Choksi

Reply
  • Hi,

    I have read ERRORSRC on each nrf_drv_uart_evt_error and it reads out 4 (framing error). Also, what I found is, on read event (NRF_DRV_UART_EVT_RX_DONE) the uart_event_handler in nrf_serial.c reads data and puts it in queue and then generates serial rx event (NRF_SERIAL_EVENT_RX_DATA). So this already is a kind of polling. Moreover, I am pretty sure my data is not going to overflow this queue before i read it continuously in main(). So I guess directly using nrf_serial_rx in main() will make it more efficient and decrease some complexity for me.

    Thanks and Regards,

    Prerit Choksi

Children
No Data
Related