how to config S12G128 enter stop mode and wake up by CAN message?

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

how to config S12G128 enter stop mode and wake up by CAN message?

Jump to solution
1,634 Views
920065012
Contributor II

      I config  S12G128 with PLL and MSCAN.when I dubug by P&E_Multlilink_USB ,s12g128 enter stop mode and bring about "ILLEGAL_BP" like this:

WeChat Screenshot_20190108201126.jpg

      Does it reset?It is normal or what's wrong with it? It is on going run ,but Idonot know where it run?

      I config PLL with frequence PLL = 32MHz , BUS = 16MHz,VCO = 32Mhz.

      enter full stop mode code:

void Go_Full_StopMode(void)
{
DDRT_DDRT6 = 1;
delay_Mms(20);
CANCTL0_SLPRQ = 1; //sleep mode request ,Wait MSCAN sleep
asm(nop);
while(CANCTL1_SLPAK == 0);

delay_Mms(1);
CPMUCLKS_PSTP = 0; // Oscillator is disabled in Stop Mode (Full Stop Mode)
asm ANDCC #0x7F;
asm(nop);
EnableInterrupts;
asm STOP;
}

#pragma CODE_SEG __NEAR_SEG NON_BANKED

void interrupt 36 CAN_WakeUp(void)
{
// delay_can_Mms(5);
INIT_WAKE_CAN();
CANRFLG_WUPIF = 1;
}
#pragma CODE_SEG DEFAULT

Is there something wrong? I need your advice.

 

Thank you.

1 Solution
1,303 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello,

The debugger is disconnected when the MCU enters the stop mode.

To verify that the MCU is in the stop mode and wakes up, please use ECLK.

ECLKCTL_NECLK = 0; // Bus clock on PS7.

Bus clock is gated off in the stop mode.

Regards,

Daniel

View solution in original post

0 Kudos
Reply
3 Replies
1,304 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello,

The debugger is disconnected when the MCU enters the stop mode.

To verify that the MCU is in the stop mode and wakes up, please use ECLK.

ECLKCTL_NECLK = 0; // Bus clock on PS7.

Bus clock is gated off in the stop mode.

Regards,

Daniel

0 Kudos
Reply
1,303 Views
920065012
Contributor II

Hi,thank you for your help.I still have two questions.

1.   MCU enters the stop mode successful. And the power consumption (strom ) reduce reduce from 23.45mA to 6.91mA, it still cannot meet request for  a few milliamps. I have close the power of external device,what can I do to reduce MCU's  power consumption? adjust  PLL or others?

2.   I add watchdog function.before MCU enter stop mode ,it work well. But,when MCU wake up from sleep by CAN, it run away,I don't know what happened to it?

Regards,

Shanwen

0 Kudos
Reply
1,303 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

Is the COP working in the stop mode? PLL is OFF, but GPIOs maintain their states in the stop mode.

Are you sure you are not driving anything?

pastedImage_1.png

You can use an interrupt catcher (attached) to see which interrupt is actually called.

Regards,

Daniel