lpcware

LPC1225 Deep Seelp mode and RTC

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by Redbull68 on Mon Apr 07 13:37:54 MST 2014
Hi,

I will try to use RTC to wake up lpc 1225 from deep sleep mode and i have a problem, the microncontroler don't wake up ( it's a really problem).
I try like it is say in the user manual and after some bad test, I read the errata sheet and it say that to wake up from deep sleep mode via RTC, the system must be clocked by the WDTosc while in deep sleep mode.

If you you see i error in my code...


__irq void INT_RtcHandler (void)
{
    RTCICR_bit.RTCICR = 1; // Clear IT flag
}



RTCMR = RTCDR + 5; // Update RTC value to wake up from Deep Sleep mode (5sec just to try)
RTCIMSC = 1; // Enable RTC IT

PCON_bit.DPDEN = 0;
// BOD and WDT configuration in Deep Sleep mode
PDSLEEPCFG_bit.BOD_PD = 0; // BOD circuit powered
PDSLEEPCFG_bit.WDTOSC_PD = 0; // WDT oscillator powered

PDAWAKECFG = PDRUNCFG; // Save Power configuration

PDRUNCFG_bit.WDTOSC_PD = 0; // WDT oscillator powered

MAINCLKSEL_bit.SEL = 2; // WDT oscillator clock source
WDTOSCCTRL_bit.FREQSEL = 1; // FREQSEL : 0,5MHz (errata sheet)
WDTOSCCTRL_bit.DIVSEL = 31; //DIVSEL : 64 (errata sheet)

// Then reset and set UEN for changes to take effect
MAINCLKUEN = 0;
MAINCLKUEN = 1;
while ((MAINCLKUEN & 1) == 0); // Wait changes to be done

// Configure RTC to wake up
STARTAPRP1_bit.ARPINT30 = 1; // Rising edge
STARTERP1_bit.ERINT30 = 1; // Enable start signal
STARTRSRP1CLR_bit.RSRINT30 = 1; // Reset start signal
HalIrqInstall(RTC_IRQ, 3); // Enable RTC interrupt (priority 3)

SYSAHBCLKCTRL_bit.WDT = 1; // Enable clock for WDT

SCR_bit.SLEEPDEEP = 1;
__WFI();

Outcomes