AnsweredAssumed Answered

TIM1_UP_IRQHandler not working

Question asked by potgieter.mc on Jun 6, 2013
Latest reply on Jun 6, 2013 by Clive One
All my timer interrupts are working except for TIM1. What could be wrong.
I'm using Keil ARM with the STM32F013C8.

Here is my startup code:

EXPORT  WWDG_IRQHandler            [WEAK]
                EXPORT  PVD_IRQHandler             [WEAK]
                EXPORT  TAMPER_IRQHandler          [WEAK]
                EXPORT  RTC_IRQHandler             [WEAK]
                EXPORT  FLASH_IRQHandler           [WEAK]
                EXPORT  RCC_IRQHandler             [WEAK]
                EXPORT  EXTI0_IRQHandler           [WEAK]
                EXPORT  EXTI1_IRQHandler           [WEAK]
                EXPORT  EXTI2_IRQHandler           [WEAK]
                EXPORT  EXTI3_IRQHandler           [WEAK]
                EXPORT  EXTI4_IRQHandler           [WEAK]
                EXPORT  DMA1_Channel1_IRQHandler   [WEAK]
                EXPORT  DMA1_Channel2_IRQHandler   [WEAK]
                EXPORT  DMA1_Channel3_IRQHandler   [WEAK]
                EXPORT  DMA1_Channel4_IRQHandler   [WEAK]
                EXPORT  DMA1_Channel5_IRQHandler   [WEAK]
                EXPORT  DMA1_Channel6_IRQHandler   [WEAK]
                EXPORT  DMA1_Channel7_IRQHandler   [WEAK]
                EXPORT  ADC1_2_IRQHandler          [WEAK]
                EXPORT  USB_HP_CAN1_TX_IRQHandler  [WEAK]
                EXPORT  USB_LP_CAN1_RX0_IRQHandler [WEAK]
                EXPORT  CAN1_RX1_IRQHandler        [WEAK]
                EXPORT  CAN1_SCE_IRQHandler        [WEAK]
                EXPORT  EXTI9_5_IRQHandler         [WEAK]
                EXPORT  TIM1_BRK_IRQHandler        [WEAK]
                EXPORT  TIM1_UP_IRQHandler         [WEAK]
                EXPORT  TIM1_TRG_COM_IRQHandler    [WEAK]
                EXPORT  TIM1_CC_IRQHandler         [WEAK]

Then my timer initialization:

TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
    NVIC_InitTypeDef NVIC_InitStructure;

      // Enable the TIM gloabal Interrupt
      NVIC_InitStructure.NVIC_IRQChannel = TIM1_UP_IRQn;
      NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
      NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
      NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

      NVIC_Init(&NVIC_InitStructure);
    
    TIM_TimeBaseStructInit(&TIM_TimeBaseStructure);
 
      // Time base configuration
      TIM_TimeBaseStructure.TIM_Period = 1000 - 1;
    TIM_TimeBaseStructure.TIM_Prescaler = 72 - 1;
      TIM_TimeBaseStructure.TIM_ClockDivision = 2;
      TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;

      TIM_TimeBaseInit(TIM1, &TIM_TimeBaseStructure);

      // TIM IT enable
      TIM_ITConfig(TIM1, TIM_IT_Update, ENABLE);
    
    // TIM enable counter
      TIM_Cmd(TIM1, ENABLE);

And my interrupt handler:

void TIM1_UP_IRQHandler(void)
{
    u16 TID;
    
    if(TIM_GetITStatus(TIM1, TIM_IT_Update) == SET)
    {
        // Clear timer interrupt flag
        TIM_ClearITPendingBit(TIM1, TIM_IT_Update);
    }
}

Outcomes