cancel
Showing results for 
Search instead for 
Did you mean: 

TIM2 clock

michaellange9
Associate II
Posted on February 05, 2009 at 11:59

TIM2 clock

3 REPLIES 3
mdeneen
Associate II
Posted on May 17, 2011 at 13:01

If the APB1 prescaler is != 1, the timer clock is multiplied by 2. Check the clock tree on page 71 of RM0008.

You should probably check what your APB1 clock speed is though. If you use the ST firmware, you can use RCC_GetClocksFreq to get this value.

Mark

michaellange9
Associate II
Posted on May 17, 2011 at 13:01

Hi all,

I have problems to calculate back from timersteps to seconds.

I'm using TIMER2. cpu clock is 72MHz so TIMER2 at APB1 should be f_APB1=36MHz.

I would calculate the time t=(TIM_PSC x TIM_CNT)/f_APB1

i.e. PSC = 200, CNT = 13000 t=0,072s

But when I measure the signal I get 0,034s. It seems that f_APB1=72MHz or somewhere else is a factor 2 ?!?

Attached are pictures of the RCC and TIM2 configuration.

Do you have any idea?

Cheers,

Michael

michaellange9
Associate II
Posted on May 17, 2011 at 13:01

Thank you Mark!

It took me 2 days more to understand it:

TIM2 can be clocked with 72MHz although APB1 = 36MHz. Because of the multiplicator when the prescaler is not 1. APB1 and its following peripheral is not affected by the multiplicator.

Michael