<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic UM10914 waking up DEEP_SLEEP in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/UM10914-waking-up-DEEP-SLEEP/m-p/1232024#M43957</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;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).&lt;/P&gt;&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;CODE:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;/*&lt;BR /&gt;&lt;BR /&gt; * Try from here new code to get into sleep&lt;BR /&gt;&lt;BR /&gt; */&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;// will suspend tasks, and let code run linearly. Use this to push the chip into sleep mode&lt;BR /&gt;&lt;BR /&gt;vTaskSuspendAll();&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;// make clock 12MHz&lt;BR /&gt;&lt;BR /&gt;CHIP_SYSCON_MAINCLKSRC_T saved_clksrc;&lt;BR /&gt;&lt;BR /&gt;uint32_t saved_clkRate = 0;&lt;BR /&gt;&lt;BR /&gt;saved_clksrc=Chip_Clock_GetMainClockSource();&lt;BR /&gt;&lt;BR /&gt;Chip_Clock_SetMainClockSource(SYSCON_MAINCLKSRC_FRO12MHZ);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/* Disable PLL, if previously enabled, prior to sleep */&lt;BR /&gt;&lt;BR /&gt;if (saved_clksrc== SYSCON_MAINCLKSRC_PLLOUT) {&lt;BR /&gt;&lt;BR /&gt;Chip_Clock_SetMainClockSource(SYSCON_MAINCLKSRC_FRO12MHZ);&lt;BR /&gt;&lt;BR /&gt;Chip_SYSCON_PowerDown(SYSCON_PDRUNCFG_PD_SYS_PLL);&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;else if (saved_clksrc== SYSCON_MAINCLKSRC_FROHF) {&lt;BR /&gt;&lt;BR /&gt;saved_clkRate = Chip_Clock_GetFROHFRate();&lt;BR /&gt;&lt;BR /&gt;Chip_Clock_SetMainClockSource(SYSCON_MAINCLKSRC_FRO12MHZ);&lt;BR /&gt;&lt;BR /&gt;LPC_SYSCON-&amp;gt;FROCTRL &amp;amp;= ~(SYSCON_FROCTRL_MASK | SYSCON_FROCTRL_HSPDCLK);&lt;BR /&gt;&lt;BR /&gt;Chip_SYSCON_SetFLASHAccess(SYSCON_FLASH_1CYCLE);&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;/* Lower system voltages to current lock (likely IRC) */&lt;BR /&gt;&lt;BR /&gt;Chip_POWER_SetVoltage(Chip_Clock_GetMainClockRate());&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;// make pushbutton interrupt zero&lt;BR /&gt;&lt;BR /&gt;Chip_GPIO_SetPinDIRInput(LPC_GPIO, 0, 22);&lt;BR /&gt;&lt;BR /&gt;Chip_PININT_Init(LPC_PININT);&lt;BR /&gt;&lt;BR /&gt;Chip_INMUX_PinIntSel(0, 0, 22);&lt;BR /&gt;&lt;BR /&gt;Chip_PININT_ClearIntStatus(LPC_PININT, PININTCH(PININTSELECT0));&lt;BR /&gt;&lt;BR /&gt;Chip_PININT_SetPinModeEdge(LPC_PININT, PININTCH(PININTSELECT0));&lt;BR /&gt;&lt;BR /&gt;Chip_PININT_EnableIntLow(LPC_PININT, PININTCH(PININTSELECT0));&lt;BR /&gt;&lt;BR /&gt;// start interrupt zero&lt;BR /&gt;&lt;BR /&gt;/* Enable PININT interrupts */&lt;BR /&gt;&lt;BR /&gt;NVIC_EnableIRQ(PIN_INT0_IRQn);&lt;BR /&gt;&lt;BR /&gt;/* Enable wakeup for PININT0 */&lt;BR /&gt;&lt;BR /&gt;Chip_SYSCON_EnableWakeup(SYSCON_STARTER_PINT0);&lt;BR /&gt;&lt;BR /&gt;// debugging&lt;BR /&gt;&lt;BR /&gt;/* WDT_OSC and BOD are turned on */&lt;BR /&gt;&lt;BR /&gt;Board_LED_Set(LED_RED_B, LED_OFF);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Chip_POWER_EnterPowerMode (POWER_DEEP_SLEEP, SYSCON_PDRUNCFG_PD_WDT_OSC |&lt;BR /&gt;&lt;BR /&gt;SYSCON_PDRUNCFG_PD_SRAM0 | SYSCON_PDRUNCFG_PD_SRAM1 | SYSCON_PDRUNCFG_PD_SRAM2 | SYSCON_PDRUNCFG_PD_SRAMX | // SRAM settings&lt;BR /&gt;&lt;BR /&gt;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&lt;BR /&gt;&lt;BR /&gt;/* going to deep-sleep mode. */&lt;BR /&gt;&lt;BR /&gt;// Reset the board entirely after wake up&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/* On wakeup, restore PLL power if needed */&lt;BR /&gt;&lt;BR /&gt;if (saved_clksrc== SYSCON_MAINCLKSRC_PLLOUT) {&lt;BR /&gt;&lt;BR /&gt;Chip_SYSCON_PowerUp(SYSCON_PDRUNCFG_PD_SYS_PLL);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/* Wait for PLL lock */&lt;BR /&gt;&lt;BR /&gt;while (!Chip_Clock_IsSystemPLLLocked()) {}&lt;BR /&gt;&lt;BR /&gt;Chip_POWER_SetVoltage(Chip_Clock_GetSystemPLLOutClockRate(false));&lt;BR /&gt;&lt;BR /&gt;/* Use PLL for system clock */&lt;BR /&gt;&lt;BR /&gt;Chip_Clock_SetMainClockSource(SYSCON_MAINCLKSRC_PLLOUT);&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;else if (saved_clksrc== SYSCON_MAINCLKSRC_FROHF) {&lt;BR /&gt;&lt;BR /&gt;Chip_POWER_SetVoltage(saved_clkRate);&lt;BR /&gt;&lt;BR /&gt;Chip_SetupFROClocking(saved_clkRate);&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Board_LED_Set(LED_RED_B, LED_ON);&lt;BR /&gt;&lt;BR /&gt;// start tasks back up again&lt;BR /&gt;&lt;BR /&gt;xTaskResumeAll();&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Feb 2021 11:01:44 GMT</pubDate>
    <dc:creator>DYD35</dc:creator>
    <dc:date>2021-02-17T11:01:44Z</dc:date>
    <item>
      <title>UM10914 waking up DEEP_SLEEP</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/UM10914-waking-up-DEEP-SLEEP/m-p/1232024#M43957</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;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).&lt;/P&gt;&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;CODE:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;/*&lt;BR /&gt;&lt;BR /&gt; * Try from here new code to get into sleep&lt;BR /&gt;&lt;BR /&gt; */&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;// will suspend tasks, and let code run linearly. Use this to push the chip into sleep mode&lt;BR /&gt;&lt;BR /&gt;vTaskSuspendAll();&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;// make clock 12MHz&lt;BR /&gt;&lt;BR /&gt;CHIP_SYSCON_MAINCLKSRC_T saved_clksrc;&lt;BR /&gt;&lt;BR /&gt;uint32_t saved_clkRate = 0;&lt;BR /&gt;&lt;BR /&gt;saved_clksrc=Chip_Clock_GetMainClockSource();&lt;BR /&gt;&lt;BR /&gt;Chip_Clock_SetMainClockSource(SYSCON_MAINCLKSRC_FRO12MHZ);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/* Disable PLL, if previously enabled, prior to sleep */&lt;BR /&gt;&lt;BR /&gt;if (saved_clksrc== SYSCON_MAINCLKSRC_PLLOUT) {&lt;BR /&gt;&lt;BR /&gt;Chip_Clock_SetMainClockSource(SYSCON_MAINCLKSRC_FRO12MHZ);&lt;BR /&gt;&lt;BR /&gt;Chip_SYSCON_PowerDown(SYSCON_PDRUNCFG_PD_SYS_PLL);&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;else if (saved_clksrc== SYSCON_MAINCLKSRC_FROHF) {&lt;BR /&gt;&lt;BR /&gt;saved_clkRate = Chip_Clock_GetFROHFRate();&lt;BR /&gt;&lt;BR /&gt;Chip_Clock_SetMainClockSource(SYSCON_MAINCLKSRC_FRO12MHZ);&lt;BR /&gt;&lt;BR /&gt;LPC_SYSCON-&amp;gt;FROCTRL &amp;amp;= ~(SYSCON_FROCTRL_MASK | SYSCON_FROCTRL_HSPDCLK);&lt;BR /&gt;&lt;BR /&gt;Chip_SYSCON_SetFLASHAccess(SYSCON_FLASH_1CYCLE);&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;/* Lower system voltages to current lock (likely IRC) */&lt;BR /&gt;&lt;BR /&gt;Chip_POWER_SetVoltage(Chip_Clock_GetMainClockRate());&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;// make pushbutton interrupt zero&lt;BR /&gt;&lt;BR /&gt;Chip_GPIO_SetPinDIRInput(LPC_GPIO, 0, 22);&lt;BR /&gt;&lt;BR /&gt;Chip_PININT_Init(LPC_PININT);&lt;BR /&gt;&lt;BR /&gt;Chip_INMUX_PinIntSel(0, 0, 22);&lt;BR /&gt;&lt;BR /&gt;Chip_PININT_ClearIntStatus(LPC_PININT, PININTCH(PININTSELECT0));&lt;BR /&gt;&lt;BR /&gt;Chip_PININT_SetPinModeEdge(LPC_PININT, PININTCH(PININTSELECT0));&lt;BR /&gt;&lt;BR /&gt;Chip_PININT_EnableIntLow(LPC_PININT, PININTCH(PININTSELECT0));&lt;BR /&gt;&lt;BR /&gt;// start interrupt zero&lt;BR /&gt;&lt;BR /&gt;/* Enable PININT interrupts */&lt;BR /&gt;&lt;BR /&gt;NVIC_EnableIRQ(PIN_INT0_IRQn);&lt;BR /&gt;&lt;BR /&gt;/* Enable wakeup for PININT0 */&lt;BR /&gt;&lt;BR /&gt;Chip_SYSCON_EnableWakeup(SYSCON_STARTER_PINT0);&lt;BR /&gt;&lt;BR /&gt;// debugging&lt;BR /&gt;&lt;BR /&gt;/* WDT_OSC and BOD are turned on */&lt;BR /&gt;&lt;BR /&gt;Board_LED_Set(LED_RED_B, LED_OFF);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Chip_POWER_EnterPowerMode (POWER_DEEP_SLEEP, SYSCON_PDRUNCFG_PD_WDT_OSC |&lt;BR /&gt;&lt;BR /&gt;SYSCON_PDRUNCFG_PD_SRAM0 | SYSCON_PDRUNCFG_PD_SRAM1 | SYSCON_PDRUNCFG_PD_SRAM2 | SYSCON_PDRUNCFG_PD_SRAMX | // SRAM settings&lt;BR /&gt;&lt;BR /&gt;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&lt;BR /&gt;&lt;BR /&gt;/* going to deep-sleep mode. */&lt;BR /&gt;&lt;BR /&gt;// Reset the board entirely after wake up&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/* On wakeup, restore PLL power if needed */&lt;BR /&gt;&lt;BR /&gt;if (saved_clksrc== SYSCON_MAINCLKSRC_PLLOUT) {&lt;BR /&gt;&lt;BR /&gt;Chip_SYSCON_PowerUp(SYSCON_PDRUNCFG_PD_SYS_PLL);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/* Wait for PLL lock */&lt;BR /&gt;&lt;BR /&gt;while (!Chip_Clock_IsSystemPLLLocked()) {}&lt;BR /&gt;&lt;BR /&gt;Chip_POWER_SetVoltage(Chip_Clock_GetSystemPLLOutClockRate(false));&lt;BR /&gt;&lt;BR /&gt;/* Use PLL for system clock */&lt;BR /&gt;&lt;BR /&gt;Chip_Clock_SetMainClockSource(SYSCON_MAINCLKSRC_PLLOUT);&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;else if (saved_clksrc== SYSCON_MAINCLKSRC_FROHF) {&lt;BR /&gt;&lt;BR /&gt;Chip_POWER_SetVoltage(saved_clkRate);&lt;BR /&gt;&lt;BR /&gt;Chip_SetupFROClocking(saved_clkRate);&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Board_LED_Set(LED_RED_B, LED_ON);&lt;BR /&gt;&lt;BR /&gt;// start tasks back up again&lt;BR /&gt;&lt;BR /&gt;xTaskResumeAll();&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 11:01:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/UM10914-waking-up-DEEP-SLEEP/m-p/1232024#M43957</guid>
      <dc:creator>DYD35</dc:creator>
      <dc:date>2021-02-17T11:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: UM10914 waking up DEEP_SLEEP</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/UM10914-waking-up-DEEP-SLEEP/m-p/1232725#M43968</link>
      <description>&lt;P&gt;Hi, Yannick,&lt;/P&gt;
&lt;P&gt;Firstly, as you know that the wake-up event triggers interrupt firstly, pls check if the button ISR is executed after you press button.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the button ISR has been executed, it means that the task switch has issue, then try to replace the xTaskResumeAll () with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if( !xTaskResumeAll () )&lt;BR /&gt;{&lt;BR /&gt;taskYIELD ();&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;If you still has issue, try to enter sleep mode instead of deep-sleep mode, then wake-up without changing the clock frequency...&lt;/P&gt;
&lt;P&gt;Hope it can help you&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 09:23:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/UM10914-waking-up-DEEP-SLEEP/m-p/1232725#M43968</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2021-02-18T09:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: UM10914 waking up DEEP_SLEEP</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/UM10914-waking-up-DEEP-SLEEP/m-p/1234302#M43990</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried this, it still does not seem to be able to get back into just running the tasks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2021 10:43:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/UM10914-waking-up-DEEP-SLEEP/m-p/1234302#M43990</guid>
      <dc:creator>DYD35</dc:creator>
      <dc:date>2021-02-22T10:43:47Z</dc:date>
    </item>
  </channel>
</rss>

