cancel
Showing results for 
Search instead for 
Did you mean: 

when uart over run happens by using stm32 hal lib, the system hang

roseanne qiu
Associate II

Dear Sir/Madam:

I use three uart of stm32f4 : uart1, uart2 and uart6

I have some problems . when uart1 has overrun error,

all system get stuck there. I read some websites about this.

they mention that in the hal lib, clear ORE does not work, they said, only reading uart data register , this bit will clear. I do that, still do not work:

void HAL_UART_IRQHandler(UART_HandleTypeDef *huart)

{

...

 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))

 {

#if 1// I add this , but it does not work, system still hang/stuck when ore happens,

// any clue?

  uint8_t sysRxChar; // clear the regular interrupt

  sysRxChar = (uint8_t) huart->Instance->DR;

#endif

  // if does not really clear big

  __HAL_UART_CLEAR_OREFLAG(huart);

   

  huart->ErrorCode |= HAL_UART_ERROR_ORE;

 }

...

}

reference link is:

https://github.com/particle-iot/firmware/pull/796/commits/677b4b114b9b6503dcd10ddb83d128c9a65d6640

https://github.com/particle-iot/firmware/issues/776

thanks

roseanne

42 REPLIES 42
roseanne qiu
Associate II

Dear Nickname14573:

thank for your reply.

it is hard to avoid overrun because of the hardware limitation. this is our known problem. so I have to solve this from software:

thanks

roseanne

henry.dick
Senior II

"it is hard to avoid overrun because of the hardware limitation."

you are trying to solve a symptom, assuming you have correctly diagnosed the symptom, not the root cause of that symptom.

that wouldn't get you very far.

best of luck, as you will need a lot of it.

Amel NASRI
ST Employee

Hello,

Please note that the acknowledged issue was fixed in the patch 1.24.2 of STM32CubeF4 package (already available on the web).

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.