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 Reply Children
  • The app timer callbacks are invoked in the RTC IRQ context (unless the module is configured to use the app scheduler). However, if you are always receiving the same fixed number of bytes (66), it may be easiest to use the nrfx_uarte driver directly. This reduces complexity in buffer handling (no byte counting is needed, and you will not receive an RX interrupt until the buffer is filled).

    https://docs.nordicsemi.com/bundle/sdk_nrf5_v17.1.0/page/hardware_driver_uart.html 

  • Each response has a fixed number of bytes, which is known ahead of time when I make the request. Interesting suggestion tho.

    I got libuarte kind of working. I was getting intermittent responses depending on the timeout counter. Is that a receiver to idle timeout? I couldn't find many details. 


    I tried both processing the data with the queue in app scheduler, or skipping the queue and adding bytes to my ring buffer from the interrupt. both yielded the same results. Then when I connected a logic analyzer to the hardware, it sparked and now I'm waiting for a new shipment of hardware. 

  • ms360 said:
    Each response has a fixed number of bytes, which is known ahead of time when I make the request.

    As long as you know the number of bytes ahead of time it should be easy to use the UART driver directly. This require fewer resources and has lower complexity compared to the UARTE driver.

    ms360 said:
    I got libuarte kind of working. I was getting intermittent responses depending on the timeout counter. Is that a receiver to idle timeout? I couldn't find many details. 

    Yes, the timeout is to detect when the receiver has stopped receiving new data, but I'm not sure how this could lead to intermittent responses.

Related