Cannot get LPC800 to go into Deep Power Mode

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Cannot get LPC800 to go into Deep Power Mode

409 Views
jimc
Contributor I

Cannot get LPC800 to go into Deep Power Mode.

here is the code, right out of the user manual.

LPC_PMU->PCON = 3; // Go into deep sleep
SCB->SCR = 4; // Should go to deep sleep now
__WFI();

I am sure I am doing something stupid but I am totally stumped.

The CPU goes to sleep, but not in the deep power down mode.

P0_4 does nothing, and the reset input resets the chip.

Had it working but don't know what I changed.  

When it was working correctly, the reset button had no effect, and P0_4 did wake it up.

Labels (1)
0 Kudos
1 Reply

318 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Jim,

I suggest you download the SDK package from the link:

MCUXpresso SDK | Software Development for Kinetis, LPC, and i.MX MCUs | NXP 

On the package, there is example in the directory:

C:\DriveE\LPC_SDK_MCUExpresso\SDK_2.6.0_LPCXpresso804\boards\lpcxpresso804\demo_apps\power_mode_switch_lpc

This is part of the code

void POWER_EnterDeepSleep(uint32_t activePart)
{
    assert((SYSCON->MAINCLKSEL & SYSCON_MAINCLKSEL_SEL_MASK) == 0U);

    uint32_t pmsk;

    pmsk = __get_PRIMASK();
    __disable_irq();

    PMU->PCON = (PMU->PCON & (~PMU_PCON_PM_MASK)) | PMU_PCON_PM(kPmu_Deep_Sleep);

    /* remain active during power down mode */
    SYSCON->PDSLEEPCFG &= ~activePart;
    
    /* enable Deepsleep mode in the ARM-CORTEX M0+ SCR register */
    SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;

    /* Enter powerdown mode */
    __WFI();

    /* disable Deepsleep mode in the ARM-CORTEX M0+ SCR register */
    SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk;
    __set_PRIMASK(pmsk);   
}

If you want to wake-up from Pin intrrupt, you can refer to the code:

static void DEMO_InitWakeupPin(void)
{
    gpio_pin_config_t gpioPinConfigStruct;

    /* Set SW pin as GPIO input. */
    gpioPinConfigStruct.pinDirection = kGPIO_DigitalInput;
    GPIO_PinInit(DEMO_USER_WAKEUP_KEY_GPIO, DEMO_USER_WAKEUP_KEY_PORT, DEMO_USER_WAKEUP_KEY_PIN, &gpioPinConfigStruct);

    SYSCON_AttachSignal(SYSCON, kPINT_PinInt0, DEMO_PINT_PIN_INT0_SRC);

    /* Configure the interrupt for SW pin. */
    PINT_Init(PINT);
    PINT_PinInterruptConfig(PINT, kPINT_PinInt0, kPINT_PinIntEnableFallEdge, pint_intr_callback);
    PINT_EnableCallback(PINT); /* Enable callbacks for PINT */
}

Hope it can help you

BR

XiangJun Rong

0 Kudos