2014-09-22 05:06 PM
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 #stm32 #stm32-timer-inerrupt #discovery2014-09-22 05:18 PM
So wouldn't that suggest to you that it's running at 8 MHz? Does the HSE start? Does the PLL lock? Look at the internal clock signals as exported via the MCO pin (PA8). Look at the status bits in the RCC register. Look at the code in SystemInit() system_stm32f0x.c
Compare the register settings between your two reference designs. Decode the RCC registers. Once you've figure out WHAT is not working, then you can get your scope out and figure out WHY it's not working.