AnsweredAssumed Answered

Timer value changes from STM32f030 DISCO to Application circuit

Question asked by munireddy.prashanth on Sep 23, 2014
Latest reply on Sep 23, 2014 by Clive One
Hello,

I am using Timer 17 to generate an interrupt every 2 second (Timer initialization below). the code works fine on the STM32F030 Discovery board, but when i use the same code in my application circuit the timer value is increased by 6 times which means an interrupt is generated every 12 second. Can anyone please help me with this problem ??

Timer initialization:
void vTimer17_init()
{
     TIM_ITConfig(TIM17, TIM_IT_Update ,DISABLE);
     NVIC_DisableIRQ(TIM17_IRQn);
     TIM_DeInit(TIM17);


     TIM_TimeBaseInitTypeDef TIM_InitStructure;
     NVIC_InitTypeDef NVIC_InitStructure;


     RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM17, ENABLE);


     TIM_TimeBaseStructInit(&TIM_InitStructure);


     TIM_InitStructure.TIM_Prescaler = 9600-1;
     TIM_InitStructure.TIM_Period = 10000;
     TIM_InitStructure.TIM_CounterMode = TIM_CounterMode_Up;
     TIM_InitStructure.TIM_ClockDivision = 0;


     TIM_TimeBaseInit(TIM17,&TIM_InitStructure );


     TIM_Cmd(TIM17, ENABLE);


     NVIC_InitStructure.NVIC_IRQChannel = TIM17_IRQn;
     NVIC_InitStructure.NVIC_IRQChannelPriority = 3;
     NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
     NVIC_Init (& NVIC_InitStructure);


     TIM_ClearITPendingBit(TIM17 ,TIM_IT_Update);
     //NVIC_EnableIRQ(TIM17_IRQn);
     TIM_ITConfig(TIM17 , TIM_IT_Update , ENABLE);


}

Thanks,
Prashanth

Outcomes