AnsweredAssumed Answered

Timer (TIM2) goes twice as fast as expected

Question asked by norair.jp on Feb 3, 2012
Latest reply on Feb 3, 2012 by Clive One
I can't tell if this is a "feature" or some strange incongruence.  I am using an STM32F103ZG (on STM3210E-EVAL board).  
- The clock is set to 48 MHz, as USB is being used.  
- The APB1 bus is set to 12 MHz (divided by 4).
- The TIM2 rate should be 1024 Hz

Therefore, one would expect the TIM2 prescaler to be: 12 000 000 / 1024 = 11718.75 (11719).  However, when using this prescaler value, the TIM2 rate is indeed 2048 Hz.  So I need to use 23437 as the prescaler value to achieve 1024 Hz.  I can confirm that the RCC is configured correctly and matches the values expected by the reference manual.

Is this a "feature"of the timer?  I want the code to be portable to other STM32's, so I hope it is normal behavior.

Outcomes