AnsweredAssumed Answered

STM32cube's HAL_UART_Receive_DMA() not enabling IRQ to detect overrun or other UART errors, bug?

Question asked by lanterne.barnabe on Dec 18, 2014
Latest reply on Mar 2, 2015 by pinkman
When debugging some code that uses DMA to receive data from an uart i noticed that if for some reason an overrun error happen, it's not taken into account, and that prevents the DMA transfer complete interrupt to ever occur.

The problem shows up if i hit a breakpoint in my program after a DMA receive has been issued. When execution is frozen *if data are sent by the remote side* an overrun error is signaled in the UART register. I figure that is to be expected, but when looking at HAL_UART_Receive_DMA() (in stm32F4xx_hal_uart.c) it turns out the UART error interrupt is never enabled, so there's no code to clear the error flag and call the XferErrorCallback...

Basically, during DMA transfer with HAL_UART_Receive_DMA(), if something goes wrong on the UART that's unrelated to DMA (noise / framing error / overrun), there's no way to know... and all communication stops working.

This looks like a bug to me (or well, something that's been overlooked), but maybe i'm missing something?

Outcomes