I have coded for Timer 4 in a STM32f407vg discovery board. But while debugging the control is not entering the ISR. Please find the code below and help:
void InitializeTimer()
{
TIM_TimeBaseInitTypeDef timerInitStructure;
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4, ENABLE);
timerInitStructure.TIM_Prescaler = 0;
timerInitStructure.TIM_CounterMode = TIM_CounterMode_Up;
timerInitStructure.TIM_Period = 255;
timerInitStructure.TIM_ClockDivision = TIM_CKD_DIV1;
timerInitStructure.TIM_RepetitionCounter = 0;
/*Initialise timer 4 */
TIM_TimeBaseInit(TIM4, &timerInitStructure);
TIM_Cmd(TIM4, ENABLE);
}
void EnableTimerInterrupt()
{
NVIC_InitTypeDef nvicStructure;
nvicStructure.NVIC_IRQChannel = TIM4_IRQn;
nvicStructure.NVIC_IRQChannelPreemptionPriority = 0;
nvicStructure.NVIC_IRQChannelSubPriority = 1;
nvicStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&nvicStructure);
}
void TIM4_IRQHandler(void)
{
if (TIM_GetITStatus(TIM4, TIM_IT_Update) != RESET)
{
TIM_ClearITPendingBit(TIM4, TIM_IT_Update);
}
}
With this configuration I am not able to enter an ISR.