Hello,
It's my first project with STM32 and ST firmware library. I have a problem with my timer configuration. I want a cyclic timer 2 interrupt all 100 us (10 kHz). So I configured the timer:
TIM_TimeBaseStructInit( &TIM_TimeBaseStructure ); TIM_TimeBaseStructure.TIM_Period = 100; TIM_TimeBaseStructure.TIM_Prescaler = 35; TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1; TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseInit( TIM2, &TIM_TimeBaseStructure ); TIM_ITConfig( TIM2, TIM_IT_Update, ENABLE ); TIM_Cmd( TIM2, ENABLE );
Notes: TIM2CLK is 36 MHz. Prescaler = 35 ==> TIM2 counter clock = 1 MHz - because TIM2 counter clock = TIM2CLK / (Prescaler +1) Auto reload preload value: 1 MHz / 10 kHz = 100
So I expected an timer 2 interrupt all 100 ms. But when my program runs at my ST STM3210B evaluation board or in the simulator, the interrupt comes all 50 us (20 kHz).
What is wrong? - Any idea?
Thanks in advance, Norbert