Skip to main content
ArsRoberto
Associate
March 16, 2020
Question

STM32F3 UART Interrupt Bug

  • March 16, 2020
  • 1 reply
  • 588 views

Hi, if I call: HAL_UART_Receive_IT, and I disable all the error IRQ (I don't want to be waken if I sleep) with the following instruction: __HAL_UART_DISABLE_IT(&huartx,UART_IT_ERR) ;

The uC stops to run because the HAL doesn't manage the IRQ error if they are disabled even if there are some pending interrupt so, inside the user code of the USARTx_IRQHandler() I have to put this code:

if((__HAL_UART_GET_IT(&huart1, UART_IT_FE) != RESET))
{ 
	__HAL_UART_CLEAR_IT(&huart1, UART_CLEAR_FEF);
	return;
}

Is there a better solution?

This topic has been closed for replies.

1 reply

berendi
Principal
March 16, 2020

So you have changed a bit in a hardware register, and HAL got confused. It is certainly a bug, but not necessarily in HAL.

> Is there a better solution?

Yes. Replacing HAL functions with your own, implementing exactly the functionality you need, as documented in the reference manual.