cancel
Showing results for 
Search instead for 
Did you mean: 

Breakpoint causes bad counter read

paulrbryson
Associate III

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.

0693W000006GNAjQAO.jpg

1 REPLY 1
TDK
Guru

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;

If you feel a post has answered your question, please click "Accept as Solution".