cancel
Showing results for 
Search instead for 
Did you mean: 

On the 32F407 is it possible to have DMA USART2 receive terminate on an idle line or say 20mS timeout?

Robmar
Senior III

I´ve read some MCUs support idle line events, but looking through the datasheet can´t see how to implement this.

I could DMA 3 bytes at a time, but best would be to have DMA completion triggered after idle or timeout.

4 REPLIES 4

Not sure the F4 facilitates that at the U(S)ART level.

You could make a circular DMA RX FIFO, and service that on the 1 KHz / 1 ms tick, and dispatch a call-back, or whatever, via an inactivity counter.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Karl Yamashita
Lead III

Yes UART_CR1 has the IDLEIE bit you can set to enable

0693W00000aJ57iQAC.png 

and the USART_SR register has the IDLE status bit you can check

0693W00000aJ582QAC.png 

If you use the HAL drivers you can use HAL_UARTEx_ReceiveToIdle_DMA and HAL_UARTEx_RxEventCallback

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.

I've inherited a 2016 project with HAL, the DMA idle functions are in the newer HAL for F407, but if I just drop in the updated HAL driver I get lots of errors.

Same with the CMSIS from 2016, which has moved to the thirdparty folder.

There doesn't seem to be much guidance on upgrading HAL to the newer version, and I don't have time to start a major revision of the code. A pain!

Thank you Kark, unfortunately this project's 2016 HAL lacks those functions, and ungrading HAL doesn't see a simple process. I tried by swapping in the newer HAL folders, but got 64 errors! Newer HAL doesn't seem to support legacy or I got something mixed up...