cancel
Showing results for 
Search instead for 
Did you mean: 

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

JHorv
Associate

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

3 REPLIES 3
S.Ma
Principal

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?

HABOT
Associate III

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.