2026-04-16 11:58 PM - last edited on 2026-04-17 12:40 AM by Imen.D
I am currently working on an STM32-based project using UART for continuous data transmission between the microcontroller and a PC application.
The system works fine initially, but I am facing intermittent data loss and incomplete packets during long-running communication. The issue becomes more noticeable when the baud rate is increased or when multiple interrupts are active in the system.
What I have already tried:
Despite this, the problem still occurs randomly after some time of operation.
I would like to ask the community:
Any guidance or real-world experience would be greatly appreciated.
2026-04-17 6:10 AM
Use HAL_UARTEx_ReceiveToIdle_DMA with a circular buffer. You will get no data loss, provided you handle the data in a reasonable time frame.
2026-04-17 6:24 AM
Hello,
What STM32 part number are you using?
2026-04-17 6:34 AM
How do you detect the loss?
What testing have you done to find where the data is being lost:
Does the loss correlate with anything else happening in the system?
Are UART errors occurring (framing, overrun, etc) ?
Is your interrupt handling tight and efficient?
Are your interrupt priorities well thought out?