STM32F411 - Timer interrupt not firing

I setup TIM3 on my STM32F411 using the following code:

void Enable_Timer_3()
{
__TIM3_CLK_ENABLE();
TIM3->PSC = 8399;               // Prescaler value, 8400 - 1, 84 MhZ / 8400 = 10000 Hz
TIM3->EGR = TIM_EGR_UG;         // Update prescaler
TIM3->ARR = 9999;               // Period, 10000-1, 1 second period
TIM3->DIER = TIM_DIER_UIE;      // Enable interrupts for this timer
TIM3->CR1 = TIM_CR1_CEN;        // Enable this timer
}


The timer counts just fine - inspecting the TIM3->CNT register shows it correctly counting from 0 to 9999 in the span of a second. But my interrupt handler is not called.

My handler:

void TIM3_IRQHandler(void)
{
TIM3->SR = 0;
HAL_GPIO_TogglePin(LD2_GPIO_Port, LD2_Pin);
}


It is set as the TIM3 interrupt in the interrupt vector:

  .word     TIM3_IRQHandler  /* TIM3 */


Did I do something wrong?

• I do not know much about coding.. but I cannot see the place where you are enabling the interrupts – User323693 Jan 29 at 4:04
• @User323693 thank you, that was it. I forgot to enable the TIM3-Interrupt. If you want, you can post your comment as an answer and I'll accept it. – Katharina Jan 29 at 4:09

The interrupt for timer TIM3 can be enabled by adding the following line to the timer setup function:
NVIC_EnableIRQ(TIM3_IRQn);