Hi,
I've had a problem with wakeup device from standby mode. In my application I use watchdog reset when the device is in normal mode. Before set standby mode I switch the watchdog to interrupt mode for wake up device from standby. After wake up. in watchdog interrupt routine I again switch it to reset mode.
Thw watchdog is used for automatic wake up. Sometimes device hangs up after 10 wakeup, sometime after 100 wakeup. The device goes into low power mode and the watchdog doesn't wake up it. It stays in this mode.
Below is my code (both function are called from RAM):
void LPM_SetMode(void)
{
EALLOW;
SysCtrlRegs.WDKEY = 0x0055;
SysCtrlRegs.WDKEY = 0x00AA; // reset WD counter
SysCtrlRegs.SCSR = 0x0002; //enable IT, disable reset
SysCtrlRegs.WDCR = 0x002F;
SysCtrlRegs.LPMCR0.bit.WDINTE = 1;
SysCtrlRegs.LPMCR0.bit.QUALSTDBY = 0;
FlashRegs.FPWR.bit.PWR = FLASH_SLEEP;
EDIS;
if (SysCtrlRegs.PLLSTS.bit.MCLKSTS != 1) // Only enter Standby mode when PLL is not in limp mode.
{
EALLOW;
SysCtrlRegs.LPMCR0.bit.LPM = 0x0001; // LPM mode = Standby
EDIS;
__asm(" IDLE");
}
}
interrupt void wakeint_isr(void)
{
Uint16 timeout;
for(timeout=0;timeout<WAKE_UP_TIMEOUT;timeout++)
{
__asm(" NOP");
if(SysCtrlRegs.SCSR & 0x0004)
{
break;
}
}
EALLOW;
SysCtrlRegs.SCSR = 0x0000;
SysCtrlRegs.WDCR = 0x002F; // set WD reset
EDIS;
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
}