Hi,
I have been trying to get the device I am currently working with into Full Stop Mode, however a few moments after it executes the instruction to go into Stop Mode, the MCU resets. AN2461 doesn't quite give an example of how to do this or the steps to follow. For example do I need to disable the watchdog, then Clear the S bit and finally execute the Stop command?
Currently my initialisation code for the RTI (use this in my application) and COP are:
CPMURTI = 0b11111111; //Divide clock bt 3.2x10^6
CPMUPROT = 0x26; //Disable write protection to CPMUCLKS register
CPMUCLKS |= 0b10000011; //PLL Clk source, Disable Osc in stop mode, COP clk source is OSCCLK
CPMUPROT = 1;
CPMUINT_RTIE = 1; //Real Time Int Enable
_ENABLE_COP(5);
CPMUCOP_RSBCK = 1; //Don't reset while debugging
Below is the instructions I execute when I stop
_asm nop
_asm nop
_asm nop
_asm ANDCC #$7F;
_asm nop
_asm nop
_asm STOP
What am I missing, don't understand why I get reset after the Stop is executed?
MCU used, MC9S12G96, Codewarrior IDE, Code is running without debugger connected