Senior
November 4, 2020
Solved
Wrong clock source on Timer!
- November 4, 2020
- 1 reply
- 1320 views
Hello,
I am trying to program my TIM2 to set an interrupt every 100ms. As seen in the pictured that is attached, its APB runs on 170MHz. Given so, I have set the prescaler to 34000 and the counter to 500.
It has been functioning correctly this whole time.
Recently, I noticed it was behaving in a quite slowly manner. Checking it carefully by toggling an LED every interrupt and measuring with the oscilloscope, I noticed the interrupt arising every 1.06s, which, for the given prescaler and counter values (that I checked and remain the same), indicates it is running on an internal clock of 16MHz. The only one available is HSI RC, which is not even selected on the clock tree.
What might be wrong? Any idea?
Thanks in advance!