AnsweredAssumed Answered

STM32F407, Timer6 running 2x too fast (SOLVED)

Question asked by Mike Silva on Sep 12, 2014
Latest reply on Sep 12, 2014 by Mike Silva
I'm reluctant to post this because I figure it's operator error, but I'm stuck.  I'm running an STM32F407 Discovery board using AdaCore's Ada2012 release.  Simple tasks seem to run correctly, and at the correct speed, but I'm trying to configure Timer6 to give 2.5ms interrupts, and it seems to run at double the expected speed.

I've confirmed that the runtime is setting RCC_CFGR.PPRE1 to b101 (divide by 4).  I'm setting Timer6 PSC to 42-1 and ARR to 2500-1 to give a period of 2.5ms, but when I count 400 overflows I only get 1/2 second, not 1 second as expected.  I'm just counting and resetting the SR.UIF flag at this point.  What am I missing?

EDIT: OK, I'm missing the TIMPRE bit!  Now I see where the x2 comes in.  I'll post this anyway in case it can help somebody else.