cancel
Showing results for 
Search instead for 
Did you mean: 

Disabling IRQ causes irq routine to be called

JulienD
Senior
Posted on October 04, 2016 at 12:20

Hi,

I found something curious (for me...) while playing around usart interrupts on STM32L1

// USART1 is initialized and IRQ is enabled
// TC is 1
 // TCIE is 0 
__HAL_UART_ENABLE_IT(&huart1, UART_IT_TC); -- > none interrupt routine is called
HAL_NVIC_DisableIRQ(USART1_IRQn); ---> USART1_IRQHandler is called 

After standard initialization of usart1 with cubeMx (containing a call to

HAL_NVIC_EnableIRQ(USART1_IRQn); ). 

TC flag is 1 and TCIE flag is 0. So none interrupt is called. Now here's the point: When I call


 __HAL_UART_ENABLE_IT(&huart1, UART_IT_TC);

none interrupt routine is called while I think it should because TC is 1. Then, when I call

HAL_NVIC_DisableIRQ(USART1_IRQn); ---> USART1_IRQHandler is called 

USART1_IRQHandler is called while I think it should not. Is it a regular behaviour? If yes, is there a reason? Thanks Julien #stm32l1-interrupt-usart
1 REPLY 1
JulienD
Senior
Posted on October 05, 2016 at 00:34

Hum, forget this question for the moment.

I implemented this on an eval board and I don't reproduce...

I'll reduce the non working code and may be get back with more info.

Julien