Skip to main content
Visitor II
July 31, 2018
Question

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

  • July 31, 2018
  • 42 replies
  • 10574 views

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

    This topic has been closed for replies.

    42 replies

    Visitor II
    August 7, 2018

    "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.

    Technical Moderator
    December 10, 2019

    Hello,

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

    -Amel