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 seems strange. What exact changes have you made to the example? And can you describe how I can test this here on my end? It is usually easier to get to the bottom of this kind of issues if I am able to recreate the problem myself. 

    Best regards,
    Simon

  • Hi

    I figured out something here. On receiving NRF_SERIAL_EVENT_DRV_ERR the reception stops. I had read somewhere on devzone that on error event the rx stops so I had uninitialized and initialized serial already but uninit returns busy sometimes so the serial doesn't gets restarted and data rx stops. So, i just commented out the trylock for read and write in nrf_serial_uninit and it works fine. I just need to be sure if it's ok? After this the reception works properly, but the error event is encountered many times. On checking error mask i found it to be frame error. So, is there a way to decrease the frequency of this error? I also checked that both communicating devices have same baudrate and no parity.

    Thanks and Regards,

    Prerit Choksi

Reply
  • Hi

    I figured out something here. On receiving NRF_SERIAL_EVENT_DRV_ERR the reception stops. I had read somewhere on devzone that on error event the rx stops so I had uninitialized and initialized serial already but uninit returns busy sometimes so the serial doesn't gets restarted and data rx stops. So, i just commented out the trylock for read and write in nrf_serial_uninit and it works fine. I just need to be sure if it's ok? After this the reception works properly, but the error event is encountered many times. On checking error mask i found it to be frame error. So, is there a way to decrease the frequency of this error? I also checked that both communicating devices have same baudrate and no parity.

    Thanks and Regards,

    Prerit Choksi

Children
No Data
Related