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

    This issue can be caused by multiple reasons, and it is hard to tell what by this information. Your buffer might be full, which causes it to stop, or there is a timer somewhere in your application that stops the read function after a while. So I have a few questions for you, to help me narrow down the issue. What SDK are you using? Is your code one of our example projects, or based on one? How long do you receive data for? (If it is for 180 seconds, there is probably a timer somewhere going off, as most of the timers in our default code stops there.)

    Best regards,

    Simon

  • Hi,

    Thanks for the response. I am using sdk v15.2.0. Time until data is received is random (it stops within a minute). I have used serial example. Moreover, hwfc is off and I transmit data after each complete packet receive. Also, I checked the data length put into queue in uart_event_handler and data read count in nrf_serial_read and both are found to be same. I have used event handler (passed to serial config) to identify if data is transmitted completely.  I have kept fifo size pretty large( i tried with 32, 256, 5000) and buff size 1 (passed to serial config in NRF_SERIAL_CONFIG_DEF) so i guess there's no probelm of buffer getting full.

    Thanks & Regards,

    Prerit

Reply
  • Hi,

    Thanks for the response. I am using sdk v15.2.0. Time until data is received is random (it stops within a minute). I have used serial example. Moreover, hwfc is off and I transmit data after each complete packet receive. Also, I checked the data length put into queue in uart_event_handler and data read count in nrf_serial_read and both are found to be same. I have used event handler (passed to serial config) to identify if data is transmitted completely.  I have kept fifo size pretty large( i tried with 32, 256, 5000) and buff size 1 (passed to serial config in NRF_SERIAL_CONFIG_DEF) so i guess there's no probelm of buffer getting full.

    Thanks & Regards,

    Prerit

Children
No Data
Related