<?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 Re: Unable to wake K20 from LLS power mode without debugger in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Unable-to-wake-K20-from-LLS-power-mode-without-debugger/m-p/633763#M38170</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe I'm missing something but the datasheet doesn't explicitly say that you need to use the LLWU interrupt to wake the processor. When using the debugger it wakes up but without the debugger it seems you need to enable and handle the interrupt. That was all I did to get things working.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Jan 2017 15:00:10 GMT</pubDate>
    <dc:creator>ryanlush</dc:creator>
    <dc:date>2017-01-24T15:00:10Z</dc:date>
    <item>
      <title>Unable to wake K20 from LLS power mode without debugger</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Unable-to-wake-K20-from-LLS-power-mode-without-debugger/m-p/633760#M38167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am&amp;nbsp; trying to put the K20 in low-leakage stop mode and then wake it with the LLWU. This code works fine when I am using the debugger but without the debugger I get stuck somewhere between LED1_ON and LED0_ON. Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;common.h&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Include the cpu / board header file &lt;BR /&gt;#include &amp;lt;cpu/MK20D10.h&amp;gt;&lt;BR /&gt;#include &amp;lt;board/escort_zr5.h&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;string.h&amp;gt;&lt;BR /&gt;#include "i2c.h"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void enter_lls(void);&lt;BR /&gt;void deepsleep(void);&lt;BR /&gt;void sleep(void);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int main(void)&lt;BR /&gt;{&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;volatile unsigned int dummyread;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;i2c_init(0, ACCEL_SLAVE_ADDRESS, 400000);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;I2CAccelInit();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DBG_LED1_ON;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Enable PC3 as falling edge wakeup to LLWU &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LLWU_PE2 |= LLWU_PE2_WUPE7(2);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Disable the clock monitor&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;MCG_C6 &amp;amp;= ~MCG_C6_CME0_MASK;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Put the processor in low-leakage stop mode&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;enter_lls();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;//&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Waiting for a motion interrupt from the accelerometer&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;//&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DBG_LED0_ON;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Tell the world we're awake&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;while(1);&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/***************************************************************/&lt;BR /&gt;/*&lt;BR /&gt;&amp;nbsp;* Configures the ARM system control register for WAIT(sleep)mode&lt;BR /&gt;&amp;nbsp;* and then executes the WFI instruction to enter the mode.&lt;BR /&gt;&amp;nbsp;*&lt;BR /&gt;&amp;nbsp;* Parameters:&lt;BR /&gt;&amp;nbsp;* none&lt;BR /&gt;&amp;nbsp;*&lt;BR /&gt;&amp;nbsp;*/&lt;BR /&gt;void sleep (void)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;/* Clear the SLEEPDEEP bit to make sure we go into WAIT (sleep) &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; * mode instead of deep sleep.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;SCB_SCR &amp;amp;=&amp;nbsp; ~SCB_SCR_SLEEPDEEP_MASK;&lt;BR /&gt;#ifdef CMSIS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;__wfi();&lt;BR /&gt;#else&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;/* WFI instruction will start entry into WAIT mode */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;asm("WFI");&lt;BR /&gt;#endif&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/***************************************************************/&lt;BR /&gt;/*&lt;BR /&gt;&amp;nbsp;* Configures the ARM system control register for STOP &amp;nbsp;&lt;BR /&gt;&amp;nbsp;* (deepsleep) mode and then executes the WFI instruction &lt;BR /&gt;&amp;nbsp;* to enter the mode.&lt;BR /&gt;&amp;nbsp;*&lt;BR /&gt;&amp;nbsp;* Parameters:&lt;BR /&gt;&amp;nbsp;* none&lt;BR /&gt;&amp;nbsp;*&lt;BR /&gt;&amp;nbsp;*/&lt;BR /&gt;void deepsleep (void)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; /* Set the SLEEPDEEP bit to enable deep sleep mode (STOP) */&lt;BR /&gt;&amp;nbsp; SCB_SCR |= SCB_SCR_SLEEPDEEP_MASK;&lt;BR /&gt;#ifdef CMSIS&lt;BR /&gt;&amp;nbsp; __wfi();&lt;BR /&gt;#else&lt;BR /&gt;&amp;nbsp; /* WFI instruction will start entry into STOP mode */&lt;BR /&gt;&amp;nbsp; asm("WFI");&lt;BR /&gt;#endif&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/***************************************************************/&lt;BR /&gt;/* LLS mode entry routine. Puts the processor into LLS mode from&lt;BR /&gt;&amp;nbsp;* normal Run mode or VLPR. &lt;BR /&gt;&amp;nbsp;*&lt;BR /&gt;&amp;nbsp;* Mode transitions:&lt;BR /&gt;&amp;nbsp;* RUN to LLS&lt;BR /&gt;&amp;nbsp;* VLPR to LLS&lt;BR /&gt;&amp;nbsp;*&lt;BR /&gt;&amp;nbsp;* Wake-up from LLS mode is controlled by the LLWU module. Most&lt;BR /&gt;&amp;nbsp;* modules cannot issue a wake-up interrupt in LLS mode, so make&lt;BR /&gt;&amp;nbsp;* sure to set up the desired wake-up sources in the LLWU before &lt;BR /&gt;&amp;nbsp;* calling this function.&lt;BR /&gt;&amp;nbsp;*&lt;BR /&gt;&amp;nbsp;* Parameters:&lt;BR /&gt;&amp;nbsp;* none&lt;BR /&gt;&amp;nbsp;*/&lt;BR /&gt;void enter_lls(void)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; volatile unsigned int dummyread;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; /* Write to PMPROT to allow LLS power modes this write-once &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bit allows the MCU to enter the LLS low power mode*/&lt;BR /&gt;&amp;nbsp;&amp;nbsp; SMC_PMPROT = SMC_PMPROT_ALLS_MASK;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; /* Set the (for MC1) LPLLSM or &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (for MC2)STOPM field to 0b011 for LLS mode &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Retains LPWUI and RUNM values */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; SMC_PMCTRL &amp;amp;= ~SMC_PMCTRL_STOPM_MASK ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; SMC_PMCTRL |= SMC_PMCTRL_STOPM(0x3) ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; /*wait for write to complete to SMC before stopping core */ &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; dummyread = SMC_PMCTRL;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; /* Now execute the stop instruction to go into LLS */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; deepsleep();&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jan 2017 23:17:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Unable-to-wake-K20-from-LLS-power-mode-without-debugger/m-p/633760#M38167</guid>
      <dc:creator>ryanlush</dc:creator>
      <dc:date>2017-01-20T23:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to wake K20 from LLS power mode without debugger</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Unable-to-wake-K20-from-LLS-power-mode-without-debugger/m-p/633761#M38168</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ryan,&lt;/P&gt;&lt;P&gt;The PTC3/LLWU_P7 pin is default as CMP1_IN1 function.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="PTC3 LLWU_P7.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/12657i441BCB8713ABD83E/image-size/large?v=v2&amp;amp;px=999" role="button" title="PTC3 LLWU_P7.png" alt="PTC3 LLWU_P7.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you try to configure PORTx_PCRn[MUX] before using LLWU?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="PORTx_PCRn[MUX].png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/12821iD221C8F322D75535/image-size/large?v=v2&amp;amp;px=999" role="button" title="PORTx_PCRn[MUX].png" alt="PORTx_PCRn[MUX].png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Robin&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jan 2017 02:34:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Unable-to-wake-K20-from-LLS-power-mode-without-debugger/m-p/633761#M38168</guid>
      <dc:creator>Robin_Shen</dc:creator>
      <dc:date>2017-01-23T02:34:32Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to wake K20 from LLS power mode without debugger</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Unable-to-wake-K20-from-LLS-power-mode-without-debugger/m-p/633762#M38169</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes. And like I said, it wakes up with this pin when on the debugger.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jan 2017 15:10:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Unable-to-wake-K20-from-LLS-power-mode-without-debugger/m-p/633762#M38169</guid>
      <dc:creator>ryanlush</dc:creator>
      <dc:date>2017-01-23T15:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to wake K20 from LLS power mode without debugger</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Unable-to-wake-K20-from-LLS-power-mode-without-debugger/m-p/633763#M38170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe I'm missing something but the datasheet doesn't explicitly say that you need to use the LLWU interrupt to wake the processor. When using the debugger it wakes up but without the debugger it seems you need to enable and handle the interrupt. That was all I did to get things working.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jan 2017 15:00:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Unable-to-wake-K20-from-LLS-power-mode-without-debugger/m-p/633763#M38170</guid>
      <dc:creator>ryanlush</dc:creator>
      <dc:date>2017-01-24T15:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to wake K20 from LLS power mode without debugger</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Unable-to-wake-K20-from-LLS-power-mode-without-debugger/m-p/633764#M38171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/ryanlush"&gt;ryanlush&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From the reference manual: "NOTE The LLWU interrupt must not be masked by the interrupt controller to avoid a scenario where the system does not fully exit stop mode on an LLS recovery."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The LLWU ISR is required when waking from LLS or VLLSx low-power modes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We're glad to hear you have the wake-up working now. &amp;nbsp;Best regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jan 2017 15:09:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Unable-to-wake-K20-from-LLS-power-mode-without-debugger/m-p/633764#M38171</guid>
      <dc:creator>dereksnell</dc:creator>
      <dc:date>2017-01-24T15:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to wake K20 from LLS power mode without debugger</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Unable-to-wake-K20-from-LLS-power-mode-without-debugger/m-p/633765#M38172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;“The LLWU interrupt must not be masked by the interrupt controller to avoid a scenario where the system does not fully exit stop mode on an LLS recovery.”&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Interrupt vector assignments.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/12276i2BE384593287C7D7/image-size/large?v=v2&amp;amp;px=999" role="button" title="Interrupt vector assignments.png" alt="Interrupt vector assignments.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Chip power modes.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/12324i13FF22E77B74A923/image-size/large?v=v2&amp;amp;px=999" role="button" title="Chip power modes.png" alt="Chip power modes.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Low-Leakage Stop (LLS) mode.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/12343i69FD39E1BC940577/image-size/large?v=v2&amp;amp;px=999" role="button" title="Low-Leakage Stop (LLS) mode.png" alt="Low-Leakage Stop (LLS) mode.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Robin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jan 2017 03:24:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Unable-to-wake-K20-from-LLS-power-mode-without-debugger/m-p/633765#M38172</guid>
      <dc:creator>Robin_Shen</dc:creator>
      <dc:date>2017-01-25T03:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to wake K20 from LLS power mode without debugger</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Unable-to-wake-K20-from-LLS-power-mode-without-debugger/m-p/633766#M38173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I read that several times when I was trying to figure this out. As you've all so clearly pointed out, it's mentioned over and over in the datasheet. It's still about as clear as mud.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jan 2017 15:37:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Unable-to-wake-K20-from-LLS-power-mode-without-debugger/m-p/633766#M38173</guid>
      <dc:creator>ryanlush</dc:creator>
      <dc:date>2017-01-25T15:37:11Z</dc:date>
    </item>
  </channel>
</rss>

