UM10914 waking up DEEP_SLEEP

cancel
Showing results for 
Search instead for 
Did you mean: 

UM10914 waking up DEEP_SLEEP

61 Views
DYD35
Contributor I

Hi, 

I am trying to put the UM10914 into DEEP_SLEEP and wake it up again (code is below, note that it works on FREERTOS, but I do a "vTaskSuspendAll(); " before starting the DEEP_SLEEP instructions, which should stop all tasks).

Putting it in DEEP_SLEEP is no problem, but I cannot seem to wake it up again. I use the example of PMU, but even this does not seem to work. I want to wake it up on the push of a button connected to port 0 pin 22. 

When I put it on the scope, I see that the CPU goes to DEEP_SLEEP (goes from 30 mA to 6 mA (about)) and it "wakes up" in the sense that it draws 14 mA current again. But it does not go any "further" as in it does not do the next instructions. 

CODE: 

/*

* Try from here new code to get into sleep

*/




// will suspend tasks, and let code run linearly. Use this to push the chip into sleep mode

vTaskSuspendAll();



// make clock 12MHz

CHIP_SYSCON_MAINCLKSRC_T saved_clksrc;

uint32_t saved_clkRate = 0;

saved_clksrc=Chip_Clock_GetMainClockSource();

Chip_Clock_SetMainClockSource(SYSCON_MAINCLKSRC_FRO12MHZ);


/* Disable PLL, if previously enabled, prior to sleep */

if (saved_clksrc== SYSCON_MAINCLKSRC_PLLOUT) {

Chip_Clock_SetMainClockSource(SYSCON_MAINCLKSRC_FRO12MHZ);

Chip_SYSCON_PowerDown(SYSCON_PDRUNCFG_PD_SYS_PLL);

}

else if (saved_clksrc== SYSCON_MAINCLKSRC_FROHF) {

saved_clkRate = Chip_Clock_GetFROHFRate();

Chip_Clock_SetMainClockSource(SYSCON_MAINCLKSRC_FRO12MHZ);

LPC_SYSCON->FROCTRL &= ~(SYSCON_FROCTRL_MASK | SYSCON_FROCTRL_HSPDCLK);

Chip_SYSCON_SetFLASHAccess(SYSCON_FLASH_1CYCLE);

}

/* Lower system voltages to current lock (likely IRC) */

Chip_POWER_SetVoltage(Chip_Clock_GetMainClockRate());


// make pushbutton interrupt zero

Chip_GPIO_SetPinDIRInput(LPC_GPIO, 0, 22);

Chip_PININT_Init(LPC_PININT);

Chip_INMUX_PinIntSel(0, 0, 22);

Chip_PININT_ClearIntStatus(LPC_PININT, PININTCH(PININTSELECT0));

Chip_PININT_SetPinModeEdge(LPC_PININT, PININTCH(PININTSELECT0));

Chip_PININT_EnableIntLow(LPC_PININT, PININTCH(PININTSELECT0));

// start interrupt zero

/* Enable PININT interrupts */

NVIC_EnableIRQ(PIN_INT0_IRQn);

/* Enable wakeup for PININT0 */

Chip_SYSCON_EnableWakeup(SYSCON_STARTER_PINT0);

// debugging

/* WDT_OSC and BOD are turned on */

Board_LED_Set(LED_RED_B, LED_OFF);


Chip_POWER_EnterPowerMode (POWER_DEEP_SLEEP, SYSCON_PDRUNCFG_PD_WDT_OSC |

SYSCON_PDRUNCFG_PD_SRAM0 | SYSCON_PDRUNCFG_PD_SRAM1 | SYSCON_PDRUNCFG_PD_SRAM2 | SYSCON_PDRUNCFG_PD_SRAMX | // SRAM settings

SYSCON_PDRUNCFG_LP_VDDFLASH | SYSCON_PDRUNCFG_PD_VDDHV_ENA | SYSCON_PDRUNCFG_PD_FLASH_BG | SYSCON_PDRUNCFG_ALT_FLASH_IBG | SYSCON_PDRUNCFG_SEL_ALT_FLASH_IBG); // FLASH settings

/* going to deep-sleep mode. */

// Reset the board entirely after wake up


/* On wakeup, restore PLL power if needed */

if (saved_clksrc== SYSCON_MAINCLKSRC_PLLOUT) {

Chip_SYSCON_PowerUp(SYSCON_PDRUNCFG_PD_SYS_PLL);


/* Wait for PLL lock */

while (!Chip_Clock_IsSystemPLLLocked()) {}

Chip_POWER_SetVoltage(Chip_Clock_GetSystemPLLOutClockRate(false));

/* Use PLL for system clock */

Chip_Clock_SetMainClockSource(SYSCON_MAINCLKSRC_PLLOUT);

}

else if (saved_clksrc== SYSCON_MAINCLKSRC_FROHF) {

Chip_POWER_SetVoltage(saved_clkRate);

Chip_SetupFROClocking(saved_clkRate);

}

Board_LED_Set(LED_RED_B, LED_ON);

// start tasks back up again

xTaskResumeAll();

 

0 Kudos
2 Replies

41 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Yannick,

Firstly, as you know that the wake-up event triggers interrupt firstly, pls check if the button ISR is executed after you press button. 

If the button ISR has been executed, it means that the task switch has issue, then try to replace the xTaskResumeAll () with:

 

if( !xTaskResumeAll () )
{
taskYIELD ();
}

If you still has issue, try to enter sleep mode instead of deep-sleep mode, then wake-up without changing the clock frequency...

Hope it can help you

BR

XiangJun Rong

0 Kudos

19 Views
DYD35
Contributor I

Hi, 

I tried this, it still does not seem to be able to get back into just running the tasks. 

As an in-between solution now I just reset the board when it comes out of sleep, but I would prefer not to do this though. 

0 Kudos