MC9S12NE64

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MC9S12NE64

2,248件の閲覧回数
SeaBee
Contributor I
What is the secret to getting the COP (WD) to work properly?  I looked at the Processor Expert generated code and it is doing the same thing that I am.  It is clear that the WD times out when I am stepping through the code.  What am I doing wrong?
 
Code in initialization -
 
  Crg.copctl.bit.cr = 0x07; // tBus * 2^24 = 671mS timeout
  #define WDog_Clear() (Crg.armcop.byte = 85, Crg.armcop.byte = 170, 0)
 
Resets placed in body of code -
 
    WDog_Clear(); // clear wd
ラベル(1)
0 件の賞賛
返信
2 返答(返信)

1,061件の閲覧回数
DrSeuss
Contributor I
set the RSBCK bit in the COPCTL register early in your code. This will stop the COP while debugging.
0 件の賞賛
返信

1,061件の閲覧回数
alex_spotw
Contributor III
HI:

If I'm not mistaken, the COP timer is independent of the rest of the MCU clocks. Therefore, when you're stepping through you code, the COP timer is still counting. Because you are stepping, the WDog_Clear() doesn't get called, and the MCU resets due to the COP timeout.

I would suggest to disable your COP watchdog while debugging your code. Once the code is working properly, then enable the COP and test that there are not COP resets while your code runs normally (not BDM mode).

Regards,

Alex
0 件の賞賛
返信