Hi all,
I want to use the watchdog to periodic wake up from standby, check the adc and then go back to sleep.
The watchdog is set to WAKEINT and works when system is not in standby.
I can wake from standby by pressing a button attached to GPIO14.
I have tried executing the code with and without the debugger attached and there is no difference.
What am i missing?
My standby procedure looks like this:
void LPM_gotoSleep(void)
{
// The wakeup signal should be (2+QUALSTDBY) OSCCLKs wide.
SysCtrlRegs.LPMCR0.bit.QUALSTDBY = 0;
// enable watchdog in standby
SysCtrlRegs.LPMCR0.bit.WDINTE = 1;
EALLOW;
GpioIntRegs.GPIOLPMSEL.all = 0;
// Wake up on control panel press
GpioIntRegs.GPIOLPMSEL.bit.GPIO14 = 1;
if (SysCtrlRegs.PLLSTS.bit.MCLKSTS != 1) // Only enter Standby mode when PLL is not in limp mode.
{
// Write the LPM code value
SysCtrlRegs.LPMCR0.bit.LPM = 0x0001; // LPM mode = Standby
}
EDIS;
// use watchdog to periodic wake from sleep
SysCtrlRegs.WDCR = 0x002F;
WDT_reset();
EALLOW;
SysCtrlRegs.CLKCTL.bit.WDCLKSRCSEL = 1; // Switch Watchdog Clk Src to external
EINT; // Global Enable all Interrupts
// Force device into STANDBY
asm(" IDLE");
}