Search code examples
cstm32uart

STM32F4 rx data loss when transmitting


Application is simple. When uart receiving is completed, transmit received data. But the problem is during transmitting data, receive data is ignored like picture below. packet 1 is about 26K bytes. It takes about 237. And other packets are about 2K bytes.

Packets 2~4 are ignored: image showing packets where packets 2 ~ 4 are ignored

I tried uart dma, interrupt. but still data is ignored. Is there any other way?

MCU : STM32F413 baudrate : 921600 bps


Solution

  • Do you use any DMA or IRQ Handles?

    I would prefer to use DMA in parallel RX/TX application. It is a good approach to offload the CPU with HW tasks. The DMA is very powerful in the STM32.

    Switch to

    HAL_UART_Receive_DMA() and HAL_UART_Transmit_DMA() most of the work is there already done.