STM32 — UART reception via DMA without interrupts
Published on 2026-11-05 - 5 min read
DMA (Direct Memory Access) transfers data directly to a buffer without processor intervention.
Circular DMA principle
The DMA fills the buffer continuously and wraps around. We monitor CNDTR to know how many bytes were received.
HAL configuration
HAL_UART_REceive_DMA(&huart1, buffer, BUFFER_SIZE) — the DMA works in the background.
Reading data
We compare the current DMA position with the previous one (DMA ring buffer).
Advantages
Zero CPU interrupts, maximum throughput, no data loss.