2015-09-10 06:28 AM
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,Paul2015-09-10 06:30 AM
Also, this is on the bare hardware without the HAL or standard libraries.
Thanks,
Paul
2015-09-10 09:35 AM
[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Timer%202%20on%20STM32F401C%20Discovery%20Board&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&TopicsView=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/AllItems.aspx¤tviews=3]Do we have to cross-post this to all three forums here? The pool's pretty shallow