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 Reply
  • I look at app_uart_init code and see only

    return nrf_drv_uart_rx(&app_uart_inst, rx_buffer,1);

    It means that RXD.MAXCNT will be 1.

    Is it correct?

    If yes, additional question:

    Assume that I use baud rate 115200 8 bit no parity (totally 10 bit). Does it mean that UART interrupt routine shall be evoked with delay less than about 85 us.

    And in case that baud rate is 57600 maximum delay shall be about 170us?

    Thank you

Children
  • PMichael said:
    It means that RXD.MAXCNT will be 1.

    Yes, you are right. It is then using only one byte transfer.

    PMichael said:

    Assume that I use baud rate 115200 8 bit no parity (totally 10 bit). Does it mean that UART interrupt routine shall be evoked with delay less than about 85 us.

    And in case that baud rate is 57600 maximum delay shall be about 170us?

    The interrupt service routine can take an addition 12 cycles of HFCLK apart from the 85us to clock out/in the data at baud 115200. Since you are using nrfx_ driver->nrf_drv->app_fifo->app_uart->your application callback handler for uart events, then the latency increases. I do not know this latency by heart but you can measure it by toggling a gpio in the first line of the ISR to the first line in your uart callback handler.

    Please ask any new questions in a new thread, this thread is starting to become a bit messy with many questions that do not match the title of the thread anymore.

Related