AnsweredAssumed Answered

timer15 update interrupt

Question asked by MaRiSiPāLa on Aug 22, 2013
Latest reply on Aug 22, 2013 by MaRiSiPāLa
i'm using an f3 disco board and i want to configure its timer 15 with an update interrupt. i want it to be interrupted every one second to toggle two on-board LEDs. following is the code for timer15 and NVIC configuration.

void Init_TIM15()
    NVIC_InitTypeDef NVIC_InitStructure;
    TIM_TimeBaseInitTypeDef  TIM_TimeBaseInitStructure;
    int Prescaler_Val = (SystemCoreClock/2000)-1;
    RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM15, ENABLE);
  /* Enable the TIM15 gloabal Interrupt */
    NVIC_InitStructure.NVIC_IRQChannel = TIM1_BRK_TIM15_IRQn;
    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
    NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
    NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
    TIM_TimeBaseInitStructure.TIM_Period = 2000;
    TIM_TimeBaseInitStructure.TIM_Prescaler = 0;
    TIM_TimeBaseInitStructure.TIM_ClockDivision = TIM_CKD_DIV1;
    TIM_TimeBaseInitStructure.TIM_CounterMode = TIM_CounterMode_Up;
    TIM_TimeBaseInitStructure.TIM_RepetitionCounter = 0;
    TIM_TimeBaseInit(TIM15, &TIM_TimeBaseInitStructure);
    TIM_PrescalerConfig(TIM15, Prescaler_Val, TIM_PSCReloadMode_Immediate);
    TIM_ITConfig(TIM15, TIM_IT_Update, ENABLE);
    TIM_Cmd(TIM15, ENABLE);
int main(void)
    int count = 0;
        count = TIM_GetCounter(TIM15);

and here is the code i placed inside stm32f30x_it.c file.

void TIM1_BRK_TIM15_IRQHandler(void)
    if(TIM_GetITStatus(TIM15, TIM_IT_Update) != RESET){
        TIM_ClearITPendingBit(TIM15, TIM_IT_Update);

when i run it, the LEDs stays in initial states and never toggles. in the main function, i updated a variable (count) continuously with the timer's count value and watched it under debug mode and it says that the value of the count is not in scope.
can someone please tell me if i'm making any mistakes with above codes??
thanks in advance!