cancel
Showing results for 
Search instead for 
Did you mean: 

Intentional receive complete UART DMA interrupt after specified timeout

Abhishek Kumar
Associate III

I have configured a UART to receive in DMA mode where the size of the buffer is around 64 bytes. So, basically the HAL_UART_RxCpltCallback() DMA receive complete interrupt will only fire when 64 chars are received.

Is there a way in STM32 through which I can configure a timeout for DMA Rx where when the buffer is only partially filled (i.e. less than 64 chars are received) and we don't receive anymore chars for a specified timeout, the DMA will then raise the same HAL_UART_RxCpltCallback() based interrupt to let the consumer consume whatever partial data is currently received on the UART?

1 REPLY 1

The HAL doesn't facilitate such a method directly, @Tilen MAJERLE​ had a thread once upon a time.

Personally, I have the USART DMA into a 16-bit wide circular FIFO, and mark the words so I can periodically harvest the data in a worker task

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