UART APP_UART_COMMUNICATION_ERROR

Dear Sirs!

I used SDK 12.2. Product was developed some years ago and now I am working for upgrade. One of new features is UART. I faced very strange problem.

I send 14 bytes from PC via FTDI UART 3.3V cable to Nordic and Nordic send back different 14 bytes to PC.

This process repeats each 200 ms

Baud rate 115200 no flow control, no parity

#define UART_RX_PIN_NUMBER 3 //UART Rx
#define UART_TX_PIN_NUMBER 2 //UART Tx
#define UART_CTS_PIN_NUMBER 0xFFFFFFFF //Not connected
#define UART_RTS_PIN_NUMBER 0xFFFFFFFF //Not connected
#define UART_HWFC false


static app_uart_comm_params_t comm_params =
{
UART_RX_PIN_NUMBER,
UART_TX_PIN_NUMBER,
UART_RTS_PIN_NUMBER,
UART_CTS_PIN_NUMBER,
APP_UART_FLOW_CONTROL_DISABLED, //Flow control disabled
false, //No parity
UART_BAUDRATE_BAUDRATE_Baud115200
};

buffers.rx_buf = rx_buf;
buffers.rx_buf_size = 64;
buffers.tx_buf = tx_buf;
buffers.tx_buf_size = 64;

err_code = app_uart_init(&comm_params, &buffers, uart_event_handle, APP_IRQ_PRIORITY_HIGHEST);

despite I use EASY_DMA

#ifndef UART_EASY_DMA_SUPPORT
#define UART_EASY_DMA_SUPPORT 1
#endif

// <q> UART_LEGACY_SUPPORT - Driver supporting Legacy mode

#ifndef UART_LEGACY_SUPPORT
#define UART_LEGACY_SUPPORT 0
#endif

I get sometimes event APP_UART_COMMUNICATION_ERROR error_communication  = 1

It happens randomly. May happen.  immediately or after 2 bytes received or after 6 bytes received

As I understood this value is the same as in register ERRORSRC. Is it correct?

How can I prevent this situation? I put interrupt to highest priority, use easy dma and fifo and despite all this it happens.

What''s wrong? Please help

Best regards

Michael

Parents
  • In the other thread you asked, 

    Is it really Overrun error
    A start bit is received while the previous data still lies in RXD?

    Does it mean that EASY DMA does not work, and interrupt is too slow to read data to FIFO?

    The EasyDMA does work correctly and has nothing to do with this error. The overrun error is caused because the peer is transmitting data even after the RXD buffer is full in your nRF device and since you have disabled flowcontrol, there is no way to communicate this with the peer.

    This issue is happening because you have disabled flow control and using high baudrate. Do not focus your energy assuming that this is a hardware issue. Just reconfigure your firmware to enable flow control and/or reduce the baudrate and you will not see this error. The overrun error is working proper and this is how the UART works.

  • Please answer my question. I have FIFO 64 bytes. When byte arrive to RX register, is it correct, that DMA copy it to FIFO buffer immediately without processor? Or despite of easy DMA processor shall call interrupt routine?

  • The firmware FIFO you have is different than the hardware FIFO you have inside the UART

    PMichael said:
    is it correct, that DMA copy it to FIFO buffer immediately without processor?

    Yes, EasyDMA will copy from the internal buffer to the RAM buffer of given size for one transaction. After this one transaction the CPU gets an interrupt and need to process the received bytes in RAM that the easydma already transferred. Reconfigure the easydma RXD.PTR register and get ready for more data to be received. But if the interrupt handler or the callback inside the application that the interrupt service routine calls take too long time, then there is a risk of buffer overflow. That is the exact reason why you have flow control. 

    Do you understand the implications of what happens if you disable flow control on UART? 

Reply
  • The firmware FIFO you have is different than the hardware FIFO you have inside the UART

    PMichael said:
    is it correct, that DMA copy it to FIFO buffer immediately without processor?

    Yes, EasyDMA will copy from the internal buffer to the RAM buffer of given size for one transaction. After this one transaction the CPU gets an interrupt and need to process the received bytes in RAM that the easydma already transferred. Reconfigure the easydma RXD.PTR register and get ready for more data to be received. But if the interrupt handler or the callback inside the application that the interrupt service routine calls take too long time, then there is a risk of buffer overflow. That is the exact reason why you have flow control. 

    Do you understand the implications of what happens if you disable flow control on UART? 

Children
Related