AnsweredAssumed Answered

Why do not I have an overrun error? (UART + DMA)

Question asked by David Martins on Jul 6, 2017
Latest reply on Jul 7, 2017 by waclawek.jan

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 the UART_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

Outcomes