I'm trying to put the device into deep sleep, VLLS0 mode and then wake it from an LPTMR interrupt. I'm running the LPTMR off an external source via the RTC_CLK_IN pin which works fine in the LPTMR mode. I have the following settings to put the decide to sleep:
//Settings to enter VLLS0 Deep Sleep Mode
SMC_BWR_PMPROT_AVLLS(SMC, 1); // (1) Allows any VLLSx mode
SMC_BWR_PMPROT_AVLP(SMC, 1); //(1) VLPR, VLPW, and VLPS are allowed
SMC_BWR_PMCTRL_STOPM(SMC, 0b100); // controls entry into the selected stop mode (VLLSx) when Sleep-Now or Sleep-On-Exit mode is entered with SLEEPDEEP=1
SMC_BWR_STOPCTRL_VLLSM(SMC, 0b000); //controls which VLLS sub-mode to enter if STOPM=VLLSx.
//Setting for the Low Leakage Wakeup Unit
LLWU_BWR_ME_WUME0(LLWU, 1); //Enables an internal module 0 as a wakeup source input for LPTMR
// Enables LLWU interrupt
//Go Low Power
SCB->SCR &= SCB_SCR_SLEEPDEEP_Msk; // Set the SLEEPDEEP bit to disable deep sleep mode - enter wait mode//
RTC_WR_SR(RTC, 1); //Clear this register after reset
My LLWU interrupt handler is the following:
LPTMR_BWR_CSR_TCF(LPTMR0, 1); //Clear the interrupt flag
//This function clears the ACK Isolation flag. Writing one to this setting when it is set releases the I/O pads and certain peripherals to their normal run mode state.
if(PMC_BWR_REGSC_ACKISO(PMC, 1U) != 0)
SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk; // Clear the SLEEPDEEP bit to disable deep sleep mode - enter wait mode//
g_bGoToSleep = 1;
Nothing appears to happen with these settings. Do I have the settings wrong?