2020-12-19 02:22 AM
Can someone shed light on what I am seeing?
I was trying to validate the set up of one counter using the ISR of another counter. While the program was running I placed a break point in the code to stop and read the values. The difference values read from the counter are wrong by an order of magnitude. Weirdly the difference scales with the speed of the counter. Note that the difference read in the previous pass of the ISR is correct. (The pass before the breakpoint is placed).
Edit: Perhaps the problem is placing the breakpoint while the processor is running?
Note: I measured the TIM2_ISR period with an oscilloscope on the LED GPIO PIN.
I am using STM32CubeIDE, STM32F429 processor.
2020-12-19 06:48 AM
By default, timers continue even when the cpu is halted due to a breakpoint. Probably something related to that.
You can read timer 5 a lot more cleanly with the following:
current = TIM5->CNT;