Stopping system clocks in debug mode with Code Warrior

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Stopping system clocks in debug mode with Code Warrior

Jump to solution
1,971 Views
Eqqman
Contributor I

Hello-

 

I've been trying to debug some code on the MCF52233 that makes use of an interrupt for PIT0.  With other architectures I've used the internal clocks are usually strictly controlled so that timer counters only increment as you advance opcode by opcode through your code.

 

With CW though we're finding that the clocks never stop running even though you would expect the device to be 'paused' when program execution halts due to a breakpoint or using the 'break' feature.  This is making it very difficult to debug code because we keep branching back to the ISR even before we've left the ISR to begin with.  To try and prevent this we push clearing the interrupt flag right down to before the RTE statement, but if 'too much' time has been spent looking at the code, we'll branch back to the start of the ISR before we can even execute the RTE.  Is there a way to get the PIT timers to only update their counters when instructions are actually being executed? 

Labels (1)
0 Kudos
Reply
1 Solution
1,126 Views
mjbcswitzerland
Specialist V

Hi

 

Set the DBG bit (bit 5) in the PIT Control and Status register to cause it to stop when in debug mode.

 

Regards

 

Mark

 

www.uTasker.com

- OS, TCP/IP stack, USB, device drivers and simulator for M521X, M521XX, M5221X, M5222X, M5223X, M5225X. One package does them all - "Embedding it better..."

View solution in original post

0 Kudos
Reply
2 Replies
1,126 Views
Eqqman
Contributor I

Works like a charm, thanks!

 

I'm not used to having devices support that feature in hardware and I'd overlooked that bit.

0 Kudos
Reply
1,127 Views
mjbcswitzerland
Specialist V

Hi

 

Set the DBG bit (bit 5) in the PIT Control and Status register to cause it to stop when in debug mode.

 

Regards

 

Mark

 

www.uTasker.com

- OS, TCP/IP stack, USB, device drivers and simulator for M521X, M521XX, M5221X, M5222X, M5223X, M5225X. One package does them all - "Embedding it better..."

0 Kudos
Reply