Low Power Mode Steps

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

Low Power Mode Steps

963件の閲覧回数
vengeful
Contributor II

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

ラベル(1)
2 返答(返信)

683件の閲覧回数
iggi
NXP Employee
NXP Employee

Hi,

just few additional information.

The code line  CPMUCLKS |= 0b10000011; is doing logic OR function.

So, if COPOSCSEL1 bit is logic 1, the instruction above will not clear the bit.

Note that this cannot be debug in Special Mode (when BDM is connected) while MCU goes into Stop mode. BDM communication will fail and it is possible that BDM interface will automatically reset MCU. Therefore, test it in Normal Mode (BDM unconnected) and for detection use the ECLK pin where bus clock signal can be routed.

Regards,

Ivan

683件の閲覧回数
iggi
NXP Employee
NXP Employee

Hello,

There is an application note with the SW package which contains the 'Low Power Modes' code example. Find it using the link below. These examples were tested on Tower boards TWR-S12G128 and TWR-S12G240. The source code can be used for other S12G derivatives too.

http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4455.pdf

http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4455SW.zip

In your case, the cause of the reset is the COP watchdog since you enabled it. There is a counter when timed-out generates a reset. Why do you need the COP enabled anyway? Leave it disabled.

Also, there is a code line to prevent watchdog from generating reset:

for (;;) { _FEED_COP(); }

Usually this goes at the end of the main code.

Moreover, you should make sure that you never leave the main. It can be done by adding above mentioned code line or for example you can put any other 'for' loop (see example codes).


Regards,

Ivan