2025-09-30 7:21 PM
Hi All,
Hoping someone can clarify my confusion on the clock input for the TIM1 counter...
background:
I am testing Tim1 output compare by toggling PA8 on the micro... - the timer settings are
period = 1600, no clock divisor or prescaler and my clock config is below
On the scope I see PA8 toggling with a period of 25us which seems kind a strange...
So even if I assume a counter clock of 150Mhz (APB1, APB2 peripheral clocks) and the formula of clock/2*(period+1) as the frequency I should see it toggle at 21.34 us?
Why this discrepancy??
Thanks!
Solved! Go to Solution.
2025-11-04 12:18 AM
At this point it appears that your clocks are not set up as you expect.
What's your primary clock source? Have you checked it e.g. by outputting it to a MCO pin?
JW
2025-11-04 5:36 PM
Yes! That was it...
I have a 16MHZ xtal as the clock input, addly enough the MCO pin was showing the correct clock, however the PWR->CFG2 even though it has LDEN set to 1 was not working until you set it again prior to setting the VOS for high speed...
I found a similar issue reported by another user - https://community.st.com/t5/stm32cubemx-mcus/stm32h747-freezes-waiting-for-vosrdy/td-p/304569/page/2
Nevertheless - setting LDEN again prior to the VOS took care of the issue and the timer output is now correct.
Thanks for all your suggestions/help - As usual occams razor always works wonders :)