WAI Intruction and Debug

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

WAI Intruction and Debug

跳至解决方案
1,152 次查看
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

标签 (1)
0 项奖励
回复
1 解答
641 次查看
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 项奖励
回复
2 回复数
641 次查看
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 项奖励
回复
642 次查看
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 项奖励
回复