MC9S12NE64

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

MC9S12NE64

1,643 Views
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
Labels (1)
0 Kudos
2 Replies

456 Views
DrSeuss
Contributor I
set the RSBCK bit in the COPCTL register early in your code. This will stop the COP while debugging.
0 Kudos

456 Views
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 Kudos