Question
Timer 2 on STM32F401C Discovery Board
Posted on September 10, 2015 at 13:30
Hi all,
I've just started playing with the STM32F4 on the STM32F401C Discovery board, and had some strange behaviour (slowed down time) when attempting to generate a 1ms TIM2 interrupt.From the reference manual for the microcontroller, I have enabled HSE via SW in RCC_CR to give me a (supposedly) 8Mhz reference clock (external 8Mhz crystal) to drive the AHB bus. Both AHB and APB1 prescalers are set at 0, so no clock division on the bus clocks.From this, I assume that the clock driving the prescaler for TIM2 should be 8Mhz. I have set the prescale for TIM2 at 7 (CK_CNT = CK_PSC / 8), which, presumably, should give me a 1Mhz clock driving the counter (CK_CNT = 1Mhz). I have set ARR at 999, which I assumed would supply a 1ms interrupt. This clearly isn't the case.Am I misreading the the documentation? Have I missed something?Thanks,Paul