AnsweredAssumed Answered

HAL, UARTs and overrun errors

Question asked by Barta.Hank on Dec 17, 2014
Latest reply on Mar 9, 2015 by Barta.Hank
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 procedure void 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 a result the interrupt does not get cleared.

Status flags in 'huart' are HAL_UART_STATE_READY for State and for HAL_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 solve this problem (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!

Outcomes