Interrupt flag is set, but interrupt is not entered
Dear community,
once again I am asking for your kind help. I want to implement a simple timer interrupt as a time basis on my STM32F407. I configured Timer11 and it seems to count as I expected (as far as my debugger can tell me). When the counter hits the first overflow, the "update interrupt flag" UIF from the TIM11_SR register is set, but the ISR is not executed. I already searched for a global interrupt flag that I might need to set, but as far as my research told me there is no global interrupt enable, but maybe I am wrong on that.
My initialization code and the ISR are mentioned below.
static unsigned int counter = 0;
void timerInit(void)
{
RCC->CFGR |= (0b1111 << RCC_CFGR_HPRE_Pos); // only for debugging
RCC->CFGR &= ~(0b11 << RCC_CFGR_SW_Pos);
RCC->CFGR |= (0b01 << RCC_CFGR_SW_Pos); // choose external crystal osc as system clock
RCC->APB2ENR |= (1 << RCC_APB2ENR_TIM11EN_Pos); // Enable Timer 9 clock source
TIM11->DIER |= (1 << TIM_DIER_UIE_Pos); // Enable Interrupt
TIM11->PSC |= 1; // prescaler: Counter clock: f_ck_psc/(PSC + 1) = 4 MHz @ 8 MHz System clock, no prescalers
TIM11->ARR |= 40000; // 4 MHz / 40000 = 100 Hz => overflow every 10 ms
TIM11->CR1 |= (1 << TIM_CR1_URS_Pos) // interrupt only on counter overflow
| (1 << TIM_CR1_CEN_Pos); // Enable Timer
}
void TIM11_DAC_IRQHandler(void)
{
if (counter <= 100)
counter++;
else
{
toggle_LED(LED_D3);
counter = 0;
}
}Thank you in advance for any help!
