MPC5606 enter standby mode and wakeup problem

cancel
Showing results for 
Search instead for 
Did you mean: 

MPC5606 enter standby mode and wakeup problem

99 Views
yaodaqing
Contributor I

I have configured the MPC5606B to enter from DRUN0 into STANDBY. I also have my wakeup sources configured for trig pins. 

Normlly,It's ok wakes up from Standby. It's hung randomly, must discontent power and on for reset.We have 10,000 products running for a year, and 10 cases of hangs.

code

int main(void) {

ME.MER.R = 0x0000241D; /* Enable standby STOP RUN0,DRUN SAFE, RESET modes */
ME.DRUN.R = 0x001F0010; /* DRUN cfg: 16MHIRCON=1, syclk=16 MHz FIRC */
ME.RUN[0].R = 0x001F0074; /* RUN0 cfg: 16MHzIRCON,OSC0ON,PLL0ON,syclk=PLL0 */
ME.STANDBY0.R = 0x0085000F; /* 56xxB STANDBY cfg: FIRCON = 0 */
ME.STOP0.R = 0x0085000F; /* 56xxB STOP cfg: FIRCON = 0 */
ME.RUNPC[1].R = 0x00000018; /* Peri. Cfg. 1 settings: only run in RUN0 DRUN mode */

CGM.FMPLL_CR.R = 0x02400100; /* 8 MHz xtal: Set PLL0 to 64 MHz, Need to be determined */
ME.PCTL[32].R = 0x01; // MPC56xxB/P/S ADC 0: select ME.RUNPC[1]
ME.PCTL[33].R = 0x01; // MPC56xxB/P/S ADC 1: select ME.RUNPC[1]

ME.PCTL[68].R = 0x01; // MPC56xxB/S SIU: select ME.RUNPC[1]
ME.PCTL[69].R = 0x01; /*WKUP Select ME.RUNPC[1]*/

ME.PCTL[4].R = 0x01; // MPC56xxB/P/S DSPI0: select ME.RUNPC[1]
ME.PCTL[5].R = 0x01; // MPC56xxB/P/S DSPI1: select ME.RUNPC[1]
ME.PCTL[6].R = 0x01; // MPC56xxB/P/S DSPI2: select ME.RUNPC[1]
ME.PCTL[8].R = 0x01; // MPC56xxB/P/S DSPI4: select ME.RUNPC[1]

ME.PCTL[92].R = 0x01; /*PIT*/

ME.PCTL[72].R = 0x01; // MPC56xxB/S EMIOS 0: select ME.RUNPC[0]
ME.PCTL[73].R = 0x01; // MPC56xxB/S EMIOS_1: select ME.RUNPC[0]

ME.PCTL[16].R = 0x01; // FlexCAN0: select ME.RUNPC[1]
ME.PCTL[17].R = 0x01; // FlexCAN1: select ME.RUNPC[1]
ME.PCTL[18].R = 0x01; // FlexCAN2: select ME.RUNPC[1]
//ME.PCTL[19].R = 0x01; // FlexCAN3: select ME.RUNPC[1]
ME.PCTL[21].R = 0x01; // FlexCAN5: select ME.RUNPC[1]

ME.PCTL[44].R = 0x01; /*I2C Select ME.RUNPC[1]*/


while (ME.GS.B.S_MTRANS) {} /* Ensure any STANDBY to DRUN mode transition completed */
/*Mode Transition to enter RUN0 mode: */
ME.MCTL.R = 0x40005AF0; // Enter RUN0 Mode & Key
ME.MCTL.R = 0x4000A50F; // Enter RUN0 Mode & Inverted Key
while (ME.GS.B.S_MTRANS) {} // Wait for mode transition to complete
// Note: could wait here using timer and/or I_TC IRQ
while(ME.GS.B.S_CURRENTMODE != 4) {} // Verify RUN0 is the current mode

/*
wkup8 PB10 kl15
wkup9 PA4 DC kl15
wkup11 PB3 cp
wkup15 PF11 sc kl15
wkup18 PG5 RTC wkup
wkup19 PA0 CAN wkup
*/
WKUP.WIREER.R = 0x00008B00; /* MPC56xxB: Enable rising edge events 8,9,11,15*/
//WKUP.WIREER.R = 0x0018B00; /* MPC56xxB: Enable rising edge events 8,9,11,15,18 */
//WKUP.WIREER.R = 0x000C8B00; /* MPC56xxB: Enable rising edge events 8,9,11,15,18,19 */
//WKUP.WIFER.R = 0x00018900; /* MPC56xxB: Enable analog filters - 8,11,15,16 */
WKUP.WRER.R = 0x00008B00; /* MPC56xxB: Enable wakeup events for 8,9,11,15*/
//WKUP.WRER.R = 0x00018B00; /* MPC56xxB: Enable wakeup events for 8,9,11,15,18,19*/
//WKUP.WRER.R = 0x000C8B00; /* MPC56xxB: Enable wakeup events for 8,9,11,15,18,19*/
//WKUP.WIPUER.R = 0x000FFFFF; /* MPC56xxB: Enable WKUP pins pullups to stop leakage*/

WKUP.WISR.R = 0x000FFFFF; /* MPC56xxB: Clear all wake up flags */
RGM.DES.R = 0xFFFF; /* Clear destructive reset flags */
RGM.FES.R = 0xFFFF; /* & clear functional reset flags */

CGM.SC_DC[1].R = 0x80;
CGM.SC_DC[2].R = 0x80; /* MPC56xxB/S: Enable peri set 3 sysclk divided by 1 */

dio_init();

enable_sw_watchdog(SW_WATCHDOG_TIMEOUT_MS);

for (;;)
{

if( did_flg_scChargerActive || did_flg_qcChargerActive )
{
}
else
{
DISABLE_INTERRUPT();

WKUP.WISR.R = 0x000FFFFF; /* MPC56xxB: Clear all wake up flags */
RGM.DES.R = 0xFFFF; /* Clear destructive reset flags */
RGM.FES.R = 0xFFFF; /* & clear functional reset flags */
ME.MCTL.R = 0xD0005AF0; // Enter standby Mode & Key
ME.MCTL.R = 0xD000A50F; // Enter standby Mode & Inverted Key
while(ME.GS.B.S_CURRENTMODE != 13)
{
timeout++;
if(timeout > 10000) {sw_watchdog_reset();timeout = 0;}
}
}

}

}

I tried to change the code to make the mcu enter the safe mode. The other codes remain unchanged, and the mcu periodically restarts, MCU will be a hang . When the MCU hangs, the power must be cut off, and on,It‘s recoverey.

ME.MCTL.R = 0xD0005AF0; // Enter standby Mode & Key
ME.MCTL.R = 0xD000A50F; // Enter standby Mode & Inverted Key

Can anyone help me?

0 Kudos
0 Replies