7 years, 7 months ago.

LPC408x Wake up from Deep Sleep

Hi, I'm playing with the deep sleep modes for the Cortex M4 and can get the processor to wake up from 'Sleep' using and external pin. When I try to wake up from 'Deep Sleep' the processor starts running about 1/6 of its normal speed (the LED I have flashing flashes very slowly). Reading through the user manual for the M4 it says you need to re-enter values for the clock dividers and PLLs so the processor will run normally again. Has anyone got any code to do this? All I have at the minute is:

static void powerDown() {   
    
   SCB->SCR |= 0x00000004;                  // Deep Sleep Mode - bit 2 high
   //SCB->SCR &= 0xFFFFFFFB;                  // Sleep Mode

   LPC_SC->PCON = 0x00;     // Sleep/Deep Sleep mode (defined by SLEEPDEEP bit in M4 System Control Reg)
   //LPC_SC->PCON = 0x01;     // Power-down mode if SLEEPDEEP bit in the M4 System Control Reg = 1
   //LPC_SC->PCON = 0x11;     // Deep Power-down mode if SLEEPDEEP bit in the M4 System Control Reg = 1

   // wait for interrupt
   __WFI();
 
}

Thanks

* SOLVED * I needed to re-enable PLL0 and set up the clock divider again...

#define PLL0CFG_Val           0x00000009

    // Turn on PLL0
    LPC_SC->PLL0CFG   = PLL0CFG_Val;
    LPC_SC->PLL0CON   = 0x01;             /* PLL0 Enable                        */
    LPC_SC->PLL0FEED  = 0xAA;
    LPC_SC->PLL0FEED  = 0x55;
    while (!(LPC_SC->PLL0STAT & (1<<10)));/* Wait for PLOCK0                    */

    LPC_SC->CCLKSEL   = CCLKSEL_Val;      /* Setup Clock Divider                */
posted by Martin Smith 05 Sep 2016
Be the first to answer this question.