AnsweredAssumed Answered

Wake up from the STANDBY MODE in MPC5748G..??

Question asked by Akshay H V on Aug 3, 2017
Latest reply on Nov 7, 2017 by yankuang

Hello,

 

I have been trying to put the MPC5748g into standby mode and trying to wake up using my CAN rx line as a wake up event. But I am getting a reset on the wakeup event. I even do have a external SBC(watchdog on the board). But this is put into stop mode before going into standby mode. I wont see any reset when it is in STANDBY mode. But the moment it wakes up.. I can see the reset pin toogle. Below is my code for going into STANDBY mode. How to wake up without any reset and resume my code.

 

void MODE_INIT(void)
{
T_UBYTE lub_i;
/* Set ADC structure to Pointer */
volatile struct ADC_tag* lp_ADC;

/* switch off the watchdog */
EnableDisableWatchdog (FALSE);

/* Mode enable register ME_ME STANDBY0 */
MC_ME.ME.R = 0x00002000;

/* STOP0 Mode Configuration Register (ME_STOP0_MC ) *******************************************/
/* PD0 = 1 DFLASHON=01(Power_Down) CFLASHON=01(Power_Down) FMPLLON=0(off) FXOSCON=0(off) FIRCON=1(off) SYSCLK=0 */
MC_ME.STANDBY_MC.R = 0x0085000F;
/* In this case all peripherals are switched off */
for (lub_i=0;lub_i==67;lub_i++)
{
MC_ME.PCTL[lub_i].R = 0;
}
for (lub_i=70;lub_i==104;lub_i++)
{
MC_ME.PCTL[lub_i].R = 0;
}

/* Switch off adc*/
lp_ADC = &ADC_0;
lp_ADC->MCR.B.PWDN = 1 ;
lp_ADC = &ADC_1;
lp_ADC->MCR.B.PWDN = 1 ;

/* start in STANSBY0 mode µc ***************************************/
Mode_Manager(STANDBY0);
}

 

T_UBYTE Mode_Manager(T_UBYTE lub_Mode)
{
T_ULONG lul_Key1,lul_Key2,lul_timeout;
lul_timeout = TIMEOUT ;
/*Build ModeChange Keys*/
lul_Key1= ((uint32_t)lub_Mode<<28)+ ME_MCTL_KEY;
lul_Key2= ((uint32_t)lub_Mode<<28)+(~ME_MCTL_KEY&0x0000FFFF);
/*Start mode change*/
MC_ME.MCTL.R = lul_Key1; /* Mode & Key */
waitfor_low_power(200);
MC_ME.MCTL.R = lul_Key2; /* Mode & Key */
waitfor_low_power(200);

while ((MC_ME.IS.B.I_MTC != 1) && (lul_timeout) ) lul_timeout --; /* Lock code execution there till mode exit */
MC_ME.IS.B.I_MTC = 1; /* Clear bit */

/* Error timeout transmit */
if (!lul_timeout) return FALSE;
return TRUE;

}

Outcomes