WAI Intruction and Debug

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

WAI Intruction and Debug

Jump to solution
963 Views
RubenCG
Contributor III

Hi All

 

I have several problems during the debugging process in my mc9sxdp512 with indart hcs12 (using CW 5.9 ). I can set breakpoint, watchpoint, or triggers but the program doesn't stop, so I can't debug correctly. Moreover, I can't halt the MCU normally.

 

Reading in several forums and technical supports I found the reason! Yes, I found it! The reason is wai instruction in my main procedure. So, if I want to debug properly my software I have to do it commenting this line ( _asm("wai") )... In most cases it isn't a problem, but why have to debug my software in other circumstances than real ones?

Ok! We have focused the problem, is there any possibility to resolve this "problem"?

 

Thanks in advance for your help,

Ruben

Labels (1)
0 Kudos
1 Solution
452 Views
RubenCG
Contributor III

Thanks Kef for your answer! I had read this paragraph in my MCU manual but I was looking for a trick (or something magical ... :smileywink: ) to avoid it.

 

The macro is a good idea. I hope some day I`ll be able to help you.

 

Best Regards

Ruben

 

 

View solution in original post

0 Kudos
2 Replies
452 Views
kef
Specialist I

Breakpoints, watchpoints and triggers should be working. Breakpoints can be hit only when MCU isn't sleeping and when it hits your breakpoint. I think either your MCU is still sleeping or maybe COP or other reset happens while MCU is in WAIT mode. Reset resets all breakpoints registers and debugger has to reinitialize them.

 

Regarding halting MCU while in wait mode. I also can't do that and am compiling with some DEBUG macro defined, which suppresses my WAI code. To remind me code is compiled with DEBUG is enabled, I have something like this in my code

-----------

#ifdef DEBUG

 #warning DEBUG blablabla

#endif

-------------

 

Regarding WAIT mode and BDM we have this in S12XD datasheet:

 

 

 

15.1.2.3 Low-Power Modes

 

 .. When CPU is in a low power mode (wait or stop mode) all BDM firmware commands as well as the hardware BACKGROUND command can not be used respectively are ignored. In this case the CPU can not enter BDM active mode, and only hardware read and write commands are available...

 

 

  

BACKGROUND command is what is used to halt MCU.

 

0 Kudos
453 Views
RubenCG
Contributor III

Thanks Kef for your answer! I had read this paragraph in my MCU manual but I was looking for a trick (or something magical ... :smileywink: ) to avoid it.

 

The macro is a good idea. I hope some day I`ll be able to help you.

 

Best Regards

Ruben

 

 

0 Kudos