Skip to main content
JohnFrancis
Associate III
July 11, 2025
Solved

Using DMA with UART Idle Timeout on STM32G4

Hi Team,

I'm currently transitioning from using UART interrupt with timeout to DMA-based reception on an STM32G4 controller. I’d like to implement a similar behavior where I can detect the end of a UART message using idle line detection while receiving data via DMA.

Is there a recommended way to combine DMA reception with UART idle timeout on STM32G4? Specifically:

  • Are there any best practices or example configurations for this setup?

This topic has been closed for replies.
TDK
TDKBest answer
July 11, 2025

Use HAL_UARTEx_ReceiveToIdle_DMA to receive into a circular buffer.

Process data in the HAL_UARTEx_RxEventCallback call back on the HT, TC and IDLE flags.

 

Here is an example which does exactly this:

STM32CubeG4/Projects/NUCLEO-G431RB/Examples/UART/UART_ReceptionToIdle_CircularDMA/readme.txt at 41e5cfaf939d824c70932e69f8ad6dbc4ad3a849 · STMicroelectronics/STM32CubeG4

"If you feel a post has answered your question, please click ""Accept as Solution""."

1 reply

TDK
TDKBest answer
July 11, 2025

Use HAL_UARTEx_ReceiveToIdle_DMA to receive into a circular buffer.

Process data in the HAL_UARTEx_RxEventCallback call back on the HT, TC and IDLE flags.

 

Here is an example which does exactly this:

STM32CubeG4/Projects/NUCLEO-G431RB/Examples/UART/UART_ReceptionToIdle_CircularDMA/readme.txt at 41e5cfaf939d824c70932e69f8ad6dbc4ad3a849 · STMicroelectronics/STM32CubeG4

"If you feel a post has answered your question, please click ""Accept as Solution""."