STM32F4 UART DMA RX – Handling variable length packets reliably?
I’m currently working with an STM32F4 series MCU and using UART with DMA for receiving data from an external module.
The incoming data packets are variable length and don’t always end with a fixed delimiter. Right now I’m using:
HAL_UART_Receive_DMA()
Circular DMA mode
IDLE line interrupt to detect end of frame
However, I’m noticing occasional frame misalignment when packets arrive back-to-back with minimal delay.
A few questions:
Is using the UART IDLE interrupt still considered the most reliable method for variable-length packet detection?
Would switching to LL drivers improve timing control significantly in high-throughput scenarios?
Are there recommended buffering strategies to avoid data corruption when processing data inside the IRQ context?
System details:
MCU: STM32F4
Baud rate: 115200
No RTOS currently
Processing happens in main loop
Any advice or production-proven approaches would be appreciated.
Thanks!
