Question
HAL, UARTs and overrun errors
Posted on December 17, 2014 at 17:42
Platform: STM32F429I-Discovery and Discovery-WiFi connected to UART1
Tools: IAR EWARM (eval until we get the license) Situation: If I pull power from the WiFi board and plug it back in,. this apparently results in an overrun in the UART. Not too surprising as the other board powers up while the STM32F429I-Discovery tries to read/write. This is configured by HAL for interrupt driven input. In the procedurevoid HAL_UART_IRQHandler(UART_HandleTypeDef *huart)
in
stm32f4xx_hal_uart.c
the following code exists to handle overrun interrupts:tmp1 = __HAL_UART_GET_FLAG(huart, UART_FLAG_ORE);
tmp2 = __HAL_UART_GET_IT_SOURCE(huart, UART_IT_ERR);
/* UART Over-Run interrupt occurred ----------------------------------------*/
if((tmp1 != RESET) && (tmp2 != RESET))
{
__HAL_UART_CLEAR_OREFLAG(huart);
huart->ErrorCode |= HAL_UART_ERROR_ORE;
}
I've stepped through the code and it steps over
__HAL_UART_CLEAR_OREFLAG(huart).
As aresultthe interrupt does not get cleared.
Status flags in 'huart' areHAL_UART_STATE_READY for State and forHAL_UART_ERROR_ORE. What's the best way to fix this? I'm, inclined to copy this ISR into a project file and tweak it as needed to solvethisproblem (doing whatever is needed to get my copy of the ISR linked to the interrupt.) But I'm open to suggestions if there is a better strategy. If we agree that this is a bug, is there an appropriate place to file a bug report? Thanks! #hal-uart-overrun