2023-03-15 02:47 PM
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.
2023-03-15 03:02 PM
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.
2023-03-15 10:52 PM
Yes UART_CR1 has the IDLEIE bit you can set to enable
and the USART_SR register has the IDLE status bit you can check
If you use the HAL drivers you can use HAL_UARTEx_ReceiveToIdle_DMA and HAL_UARTEx_RxEventCallback
2023-03-16 03:14 AM
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!
2023-03-16 03:15 AM
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...