cancel
Showing results for 
Search instead for 
Did you mean: 

Timer 2 Frequency

dhiry2k1
Associate II
Posted on April 08, 2014 at 15:48

Hello everyone, 

I am trying to Set up timer with 1ms Tick value and it does not seems to be working correctly. 

 TIM_TimeBaseStructure.TIM_Period = TIMER_MAIN_1MS_VAL; 

  TIM_TimeBaseStructure.TIM_Prescaler = 2;

  TIM_TimeBaseStructure.TIM_ClockDivision = 0;

  TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;

Where  TIMER_MAIN_1MS_VAL = A410

Clock Freq = 84Mhz. so the formula would be 

1/84000000 = 1.1904e^-8 

1.1904e^-8 *42000(A410) = .0005  prescalar is 2 so it become .001 means 1ms.

 But it doesn't seems to be working. Any help guys.. 

1/ Clock Freq 

#stm32 #stm32-timer-counter #stm32-timer
2 REPLIES 2
Posted on April 08, 2014 at 16:03

Values programmed into Prescaler and Period in the form N-1

Prescaler = 2 - 1;

Period = 42000 - 1;

(84000000 / 2) / 42000 = 1000 Hz
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
dhiry2k1
Associate II
Posted on April 08, 2014 at 18:49

Got it Clive 🙂 Thanks a Ton