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?
TIM3
-Interrupt. If you want, you can post your comment as an answer and I'll accept it. \$\endgroup\$