cancel
Showing results for 
Search instead for 
Did you mean: 

USART blocked by Overrun error on my STM32L051

diego ambroggi
Associate III

Hi everyone,

I have a broblem regarding USART in overrun occurrence.

In effect the "HAL_UART_IRQHandler" routine is called every incoming char, but this never calls callback routine (SYS_UART_RxCpltCallback).

In debug mode I can see there is an USART_ISR_ORE, in this case this not set        huart->RxISR(huart); anymore.

I tried also to disable overrun option, but it doesn't change.

Also I tried to create an error routine to re-initialize UART, see below:

 void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart)

{

   if (huart->Instance == SYS_UART){

    HAL_UART_Init(&huart2);

    HAL_UART_Receive_IT (&huart2, &SysUartFifoRx.data[SysUartFifoRx.head], 1);

   }

}

Can you help me, please? I'm losing hope 😉

Best regards

2 REPLIES 2

I don't use Cube so don't know how to solve this "properly" within Cube/HAL, but can't you simply ignore whatever Cube dors, and test for overrun in the ISR and clear the ORE bit (and subsequently raise any internal flag you need in your software) if set?

If you set USART_CR3.OVRDIS, you will never see the overrun flag to be set, thus the interrupt won't be called for this reason.

JW

diego ambroggi
Associate III

OK thanks, I try to do it. best regards