Skip to main content
JHorv
Visitor II
Jan 26, 2019 11:28 AM UTC
Question

STM32CubeMX HAL drivers: UART - DMA and Receive Timeout Interrupt for variable buffer sizes

Regarding to the question posted here:

https://community.st.com/s/question/0D50X00009XkaG2SAJ/using-stm32fcubemx-hal-drivers-for-uart-rx-with-unknown-size-data

I have the exact same problem using a STM32-L432KC. Is there any sample code showing how to implement a Receive Timeout Interrupt handler using HAL?

Thanks in advance

This topic has been closed for replies.

3 replies

S.Ma
Principal
Jan 26, 2019 2:35 PM UTC

Dma needs depend on the baudrate. 115200bps makes 1 byte per 100usec. If the core runs at 48Mhz, thats 4800 cycles: byte by byte interrupt might be an intermediate step?

waclawek.jan
Super User
Jan 26, 2019 7:51 PM UTC
Associate II
Jan 27, 2019 12:37 PM UTC

If you want to check for every single received byte, I'd rather suggest using LL drivers, enable RXNE interrupt and process it within the ISR.

​

If you want to use DMA, i always suggest the creation of a protocol stack with chunked transfers. This approach solves the fixed-length buffer required by DMA.