error codes for APP_UART_COMMUNICATION_ERROR

I'm seeing a few of these errors in my uart evt handler

I cannot seem to find where these are enumerated in app_uart_fifo.c or nnrf_drv_uart.h or nrfx_uarte.h.

Question 1 - Where can I find these?  

<error> app: APP_UART_COMMUNICATION_ERROR : 1 00
<error> app: APP_UART_COMMUNICATION_ERROR : 5 00
<error> app: APP_UART_COMMUNICATION_ERROR : 4 00

Here is the code generating that log - 

NRF_LOG_ERROR("APP_UART_COMMUNICATION_ERROR : %d %02x", p_event->data.error_code, NRF_UARTE0->ERRORSRC);
When this happens, I try to run
app_uart_flush();
app_uart_close();
APP_UART_FIFO_INIT();


Question 2 - Is there a better way to recover? 
Thanks!
Parents
  • Hello,

    The error message is including the value from the UART ERRORSRC register. 1 = OVERRUN, 2 = PARITY, and so on. 

    When this happens, I try to run
    app_uart_flush();
    app_uart_close();
    APP_UART_FIFO_INIT();

    What happens if you don't do this? The app uart library should "recover" (i.e. re-enable reception) by itself if you just ignore the APP_UART_COMMUNICATION_ERROR event. 

    Best regards,

    Vidar

  • Thanks Vidar. The double digit hex value is the ERRORSRC register in my log. 

    The single digit that precedes it is p_event->data.error_code, which is showing 1,4,5 in this case. 


    I am considering trying nrfx_uarte to see if this still happens 

  • The double digit hex value is the ERRORSRC register in my log. 

    Thanks for pointing that out. However, it doesn't make sense that the error is 0 as the APP_UART_COMMUNICATION_ERROR event is only triggered after a "NRF_UARTE_EVENT_ERROR" event. The nrf52840 uart has 2 uarte instances, could it be that the app uart library is using the other instance in your code?

    am considering trying nrfx_uarte to see if this still happens

    I'm afraid this won't help if there really is a communication error detected by the UART hw. app uart library is also built on top of this driver already.

Reply
  • The double digit hex value is the ERRORSRC register in my log. 

    Thanks for pointing that out. However, it doesn't make sense that the error is 0 as the APP_UART_COMMUNICATION_ERROR event is only triggered after a "NRF_UARTE_EVENT_ERROR" event. The nrf52840 uart has 2 uarte instances, could it be that the app uart library is using the other instance in your code?

    am considering trying nrfx_uarte to see if this still happens

    I'm afraid this won't help if there really is a communication error detected by the UART hw. app uart library is also built on top of this driver already.

Children
Related