can not wakeup from stop

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

can not wakeup from stop

1,147 Views
xiaohui200808
Contributor III

Hello

     Iam using S12ZVC64,  I use PORTL(HVI) as a signal to control MCU enter/wakeup from stop model. when the Port L1 is high MCU wakeup from stop .when Port L1 is low MCU enter stop .    my problem is I can enter stop model easily.But sometimes I couldnot wakeup from stop model when PORTLfrom LOW to HIGH.

Could you help me.

Original Attachment has been moved to: not-wakeup.rar

Labels (1)
3 Replies

587 Views
RadekS
NXP Employee
NXP Employee

Hi xiaohui,

Could you please specify how you test whether MCU wake-up or not?

I shortly look at your code and I cannot see any wake-up signal (like GPIO pin toggling) in your main loop - all unconditioned commands do not contain and any commands for outside visible signal.

Maybe I just miss something.

 

The typical way how we detect stop/run mode is power consumption measurement, but the run mode may be sometimes missed when wake-up execution time is enough short.

The next and more reliable way of stop/run mode detection is watching ECLK signal by an oscilloscope. In that case, we have to enable ECLK signal in normal mode by ECLKCTL_NECLK=0; command.

 

Note: You use full stop mode and the first command after wake-up may be CAN_send() function. You don’t wait for the start of crystal/oscillator oscillation. So, there may be also a potential issue with CAN clock specification. I would like to recommend wait for UPOSC flag (until oscillator clock will be validated) first.

I hope it helps you.

Have a great day,
Radek

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

587 Views
xiaohui200808
Contributor III

Hello

    My program is a bit messy。The process like this:

void wakeupinit(void)
{ DIENL_DIENL1=1; 
PIFL_PIFL1=1;//clear
PTPSL_PTPSL1=1; //
PTAENL_PTAENL1=0;
PIEL_PIEL1 =1;//enable
}

void main(void)

{  PLL_init(); //32MHz
CAN_init();
DIENL_DIENL1=1;        // Enter stop  signal   detect
CPMUCLKS_PSTP=0;
asm ANDCC #0x7F; //stop
EnableInterrupts;
while(1)
{    sencandata();
if(PTIL_PTIL1==0){ wakeupinit( );  asm STOP;   }

if(PON>0) dealONON();
__RESET_WATCHDOG();    //watchdog

}

void dealONON(void)
{ PON=0;     PIFL_PIFL1=1;//clear 
DIENL_DIENL1=1; //
PTAENL_PTAENL1=0;
PIEL_PIEL1 =0;//disable
}

interrupt   79    void portl(void)  //wake up interrupt 
{  PON=1;       PIFL_PIFL1=1;  //clear
}

When in run model ,it can send CAN data.Sometimes it could not wakeup from stop model .could you help me watch  is there any problems in my process. 

0 Kudos

587 Views
RadekS
NXP Employee
NXP Employee

Hi xiaohui,

So, if I understood correctly, you detect wake-up event by watching CAN communication. Correct?

How you watch this communication? By oscilloscope or by CAN analyzer?

 

The sencandata() function (I guess that it is the same what send_chelun_data() function in your code) just fill CAN TX buffer.

So, it is possible that asm STOP instruction is executed prior or during sending CAN message.

 

Please implement code for switch CAN module into sleep mode prior you start execute asm STOP instruction.

See my comment here: https://community.nxp.com/thread/439160

This should manage that CAN module will finish all TX messages prior entering into stop mode.

I hope it helps you.

Have a great day,
Radek

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------