uart communication error when the data is sent

It is supposed to communicate with stm32 and uart.
When data comes into rx (to ble), app_uart_get is used, but an error occurs once when data is transmitted in it, so the data does not come in properly.

1. stm32 uart setting

=> flow control disabled, 1 stop bit, none parity bit

2. ble uart setting

 => rx: 2, tx:28 (nrf52833)

3. When stm32 sends data to uart, data loaded in tx buffer

4. Data received by ble through uart rx

5. data loss and uart comm error

  ->   -> 

In the middle stage, it seems that there is no problem with the uart itself, seeing that 0xfa comes after 0xfe, but when it is put into another buffer again, a communication error occurs and data loss occurs.

When 0xfe is entered in rx_buffer for the first time, the p_buf value of m_rx_fifo is also updated to 0xfe.
When the next value, 0xfa, was entered, the value of m_rx_fifo was not updated, and a uart comm error occurred. When the next value, 0x40, was entered, the p_buf value was updated again.
I'm not sure why this is.

uart_event_handler

  • Hi,

    Is it so that the driver on the nRF side reports an error? If so, you should get the value of the ERRORSRC and can compare that with the register description to know more about what happened.

    Before knowing that, I have some questions:

    • Does this always happen in the same way?
    • Can you say more about your configuration (Like the values of the defines you pass to APP_UART_FIFO_INIT)?
    • Did you start the HFXO before doing UART? (That is not always needed and may not be needed here, though with higher baud rates and longer transactions it becomes more and more important).
    • Do you use the UARTE (with DMA) or UART peripheral?
    • Is it possible on your HW to use flow control? If the applciation's on both sides are not always ready to receive data over UART, that will make the communication much more robust.
Related