cancel
Showing results for 
Search instead for 
Did you mean: 

Using DMA with UART Idle Timeout on STM32G4

JohnFrancis
Associate II

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?

1 REPLY 1
TDK
Super User

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".