2014-08-06 10:13 PM
Hi all,
I had an overrun error issue between successive calls to 'HAL_UART_Receive_IT()'.I know what causes the overrun, but shouldn't the following lines be added to HAL_UART_Receive_IT() to clear any pending error bits before re-enabling the ISR? tmp = huart->Instance->SR; tmp = huart->Instance->DR;Jason2014-09-10 02:47 AM
Hi Jason,
The clear for the pending interrupts is not part for the UART receive process and it depends on the user application. In oreder to clear the pending interrupts we provide a specific macros in stm32f4xx_hal_uart.h file that can be used directly by the application (when needed). Please refer to the Exported macro section in stm32f4xx_hal_uart.h file.The specific macro to clear the overrun pending interrupt is__HAL_UART_CLEAR_OREFLAG()
Thus you can perform this to avoid overrun issue:
__HAL_UART_CLEAR_OREFLAG(…)
HAL_UART_Receive_IT(…)
PS: Only the macro start by the prefix “__HAL_�? can be exported.
Regards.2014-09-23 12:53 AM
Perfect! Didn't know these macros existed....
I really hate the idea of modifying HAL drivers...2014-09-23 01:51 AM
Great ! Do, click ''Mark as helpful post '', if any of my replies helps solve your problem.
Regards,Heisenberg.