2013-11-07 06:44 AM
Hello all,
Recently I came across a puzzling situation. I have a system that behaves differently depending on whether I am debugging the application or running otherwise. My environment1) STM32F103x running at 8MHz2) IAR jtrace debugger 3) IAR Compiler for ARMSome specificsI have a timer configured in up counting mode with the update and one compare interrupt enabled. I use this timer to control some LEDs in a very elaborate pattern. What I see is that the behavior of the LEDs is perfect when I operate within the debugger; what happens in normal runtime is a completely different story. The LEDs show some strange artifacts in their pattern that _should_ not be there. What I have considered:1) I can perhaps imagine the debugger introducing lags and fixing some strange race condition that there might be in normal operation.2) I have measured the system ticks every time the timer interrupt fires to see if there is a difference depending on whether the debugger is present or not, but I have not seen any there.Have any of you experienced anything like this ? Any suggestions on how to go about debugging this where I cannot trust the debugger ? Thanks,E #stm32-debugger-behavior2013-11-07 08:44 AM
Any suggestions on how to go about debugging this where I cannot trust the debugger?
Use a serial port, output telemetry, write a monitor app. Dump out the state of peripheral registers and clock settings, in working vs non-working state, compare/contrast.2013-11-07 01:02 PM
Sounds to this reporter like your debugger's connect is more correct/trustworthy than your, ''free run results.''
Beyond Clive's guidance - might your board (inadvertently) rely upon the JTAG probe for certain critical, ''pin load'' or input termination? Are all of the JTAG pins properly pulled-up, is the treatment of all Reset pins proper - even (and especially) when the JTAG probe is removed? Longer shot - might your board be, ''at the margin'' for power - and thus aided by any phantom power supplied via your debug probe? And - as always - does this condition continue across multiple boards? And across a different debugger? (wager xx USD this is board issue - not debugger...)2013-11-08 01:56 AM
One scenario where debug differs from non-debug is if the device is going into one of the low power modes where the clocks are stopped.
In non-debug, the clocks will be stopped as per the documentation. However if a debug session is active then the clocks will continue to run (as they are required to keep debug working).