Question
Why do not I have an overrun error? (UART + DMA)
Posted on July 06, 2017 at 11:08
The problem is simple ...
I am using the UART with DMA to copy 10 bytes to a memory location.
Sometimes (due to some error) 11-byte packets are sent to the MCU. What happens is that the DMA will transfer the 10 bytes and stops, but one byte remains in the UART buffer.When I send more bytes to the MCU (already after restarting the DMA) the DMA is never called by the UART.I've easily seen that it was an overrun error, but when using the HAL_DMA_GetError() or HAL_UART_GetError() functions, no error is registered.I started doing the following, to have this work (because theUART_FLAG_ORE changes in fact
) ...if (__HAL_UART_GET_FLAG(&huart2, UART_FLAG_ORE))
{ __HAL_UART_CLEAR_OREFLAG(&huart2); }The problem is solved ... but I find no explanation for any of the functions of get error do not work.
Can you explain?
MCU: STM32F302R8T
Thank you
#overrun #uart-dma #dma #uart #stm32f302