lpcware

High power consumption in deep-sleep mode

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by cavalihno on Wed Aug 05 05:18:26 MST 2015
Hi! This is my code for LPC11C14 to entry on deppe-sleep mode. Everything is ok, uC sleep and wake up properly, but power consumption in sleep is circle about 6mA !! too much :( Any solutions ?

/* Turn off all other peripheral dividers */
LPC_SYSCON->SSP0CLKDIV = 0;
LPC_SYSCON->SSP1CLKDIV = 0;
LPC_SYSCON->WDTCLKDIV = 0;

/* SYSAHBCLKCTRL while running in FLASH */
LPC_SYSCON->SYSAHBCLKCTRL=
(1<<0) //SYS Clock
|(1<<1)//ROM
|(1<<2) //RAM
|(1<<3) //FLASHREG
|(1<<4) //FLASHARRAY
|(1<<6) //GPIO
|(1<<12)//UART
|(1<<16)//IOCON
;
/* Specify the start logic to allow the chip to be waken up */
LPC_SYSCON->STARTAPRP0 &= ~(1<<(2));// Falling edge
LPC_SYSCON->STARTRSRP0CLR|=(1<<(2));// Clear pending bit
LPC_SYSCON->STARTERP0|=(1<<(2));// Enable Start Logic

void SLEEP(void){

/* Turn on all the IRC & Flash  */
LPC_SYSCON->PDRUNCFG &= ~((1<<0) | (1<<1) | (1<<2));

/* Switch MAINCLKSEL to IRC */
LPC_SYSCON->MAINCLKSEL= 0;
LPC_SYSCON->MAINCLKUEN  = 0;
LPC_SYSCON->MAINCLKUEN  = 1;
while (!(LPC_SYSCON->MAINCLKUEN & 0x01));

/* Make sure only the IRC is running */
LPC_SYSCON->PDRUNCFG = ~((1<<0) | (1<<1) | (1<<2) | (1<<9)) ;

/* Clear the Deep Sleep Flag */
LPC_PMU->PCON |= (1<<8);

/* All OFF */
LPC_SYSCON->PDSLEEPCFG |= 0x000018FF;

/* Specify peripherals to be powered up again when returning from deep sleep mode */
LPC_SYSCON->PDAWAKECFG = LPC_SYSCON->PDRUNCFG;

/* Ensure DPDEN is disabled in the power control register */
LPC_PMU->PCON= (1<<11); //Clear DPDFLAG if it was set

/* Specify Deep Sleep mode before entering mode */
SCB->SCR|=(1<<2);//Set SLEEPDEEP bit

SYST_CSR &= ~(uint32_t)0x00000001; //Clear ENABLE to 1b - enable SYSTICK.

LPC_SYSCON->STARTRSRP0CLR |= (1<<(2));
NVIC_ClearPendingIRQ(WAKEUP2_IRQn);
NVIC_EnableIRQ(WAKEUP2_IRQn);

/* Reconfigure the IOs */
config_ios();

/* Enter Deep Sleep mode */
__WFI();
}

Outcomes