<?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 Problem using the LLWU to recover from LLS mode in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Problem-using-the-LLWU-to-recover-from-LLS-mode/m-p/197932#M2747</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to use the LLWU module a Kinetis K40 to wakeup from LLS stop mode, but can't get it to work.&amp;nbsp; I can put my device into LLS mode, but can't seem to fully recover when using a LLWU wakeup GPIO.&amp;nbsp; My device is using ~25 mA in run mode.&amp;nbsp; I push a button to put it into LLS mode, where the current drops to ~100 uA.&amp;nbsp; I press the same button (which is setup as a LLWU wakeup source) and the current jumps up to ~19 mA, but the device doesn't do anything.&amp;nbsp; So obviously the device is getting into LLS mode when the button is pressed and is leaving LLS mode when the button is pressed again - but it's not going into my LLWU ISR.&amp;nbsp; Asserting the reset pin on the MCU will restart the MCU from this unknown state.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've enabled the LLWU interrupt, but again, the ISR never gets called.&amp;nbsp; I thought maybe the program was getting stuck in another ISR besides my LLWU ISR when waking up from LLS, but I've checked all the ISRs from the vector table and none of them are causing the freeze up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've based my code on Freescale's Power Management Controller (PMC) example code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the code I use to put the MCU into LLS mode:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SIM_SCGC4 |= SIM_SCGC4_LLWU_MASK;&amp;nbsp;&amp;nbsp; &amp;nbsp;// enable LLWU clock gating&lt;BR /&gt;MC_PMPROT = 0 | MC_PMPROT_ALLS_MASK;&amp;nbsp;&amp;nbsp; &amp;nbsp;// allow LLS stop mode&lt;BR /&gt;MC_PMCTRL = 0 | MC_PMCTRL_LPLLSM(3); &amp;nbsp;&amp;nbsp; &amp;nbsp;// enable LLS mode&lt;BR /&gt;SCB_SCR |= SCB_SCR_SLEEPDEEP_MASK;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// set SLEEPDEEP bit to enable sleep modes&lt;BR /&gt;LLWU_PE3 |= LLWU_PE3_WUPE10(2);&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// set Power button as wakeup source&lt;/P&gt;&lt;P&gt;asm("wfi");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my ISR:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void llwu_isr(void)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; initInterrupts();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SIM_SCGC4 |= SIM_SCGC4_LLWU_MASK;&amp;nbsp;&amp;nbsp; &amp;nbsp;// enable LLWU clock gating&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SIM_SCGC5 = SIM_SCGC5_PORTA_MASK | SIM_SCGC5_PORTB_MASK | SIM_SCGC5_PORTC_MASK |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SIM_SCGC5_PORTD_MASK | SIM_SCGC5_PORTE_MASK;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;initGPIO();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LLWU_CS |= LLWU_CS_ACKISO_MASK;&amp;nbsp;&amp;nbsp; &amp;nbsp;// clear LLWU acknowledge flag&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LLWU_F1 = 0xFF;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// clear wakeup flags&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LLWU_F2 = 0xFF;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// clear wakeup flags&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LLWU_F3 = 0xFF;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// clear wakeup flags&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Anyone have any ideas why I can't completely get out of LLS mode?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Apr 2011 07:18:50 GMT</pubDate>
    <dc:creator>RonBurgundy</dc:creator>
    <dc:date>2011-04-13T07:18:50Z</dc:date>
    <item>
      <title>Problem using the LLWU to recover from LLS mode</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Problem-using-the-LLWU-to-recover-from-LLS-mode/m-p/197932#M2747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to use the LLWU module a Kinetis K40 to wakeup from LLS stop mode, but can't get it to work.&amp;nbsp; I can put my device into LLS mode, but can't seem to fully recover when using a LLWU wakeup GPIO.&amp;nbsp; My device is using ~25 mA in run mode.&amp;nbsp; I push a button to put it into LLS mode, where the current drops to ~100 uA.&amp;nbsp; I press the same button (which is setup as a LLWU wakeup source) and the current jumps up to ~19 mA, but the device doesn't do anything.&amp;nbsp; So obviously the device is getting into LLS mode when the button is pressed and is leaving LLS mode when the button is pressed again - but it's not going into my LLWU ISR.&amp;nbsp; Asserting the reset pin on the MCU will restart the MCU from this unknown state.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've enabled the LLWU interrupt, but again, the ISR never gets called.&amp;nbsp; I thought maybe the program was getting stuck in another ISR besides my LLWU ISR when waking up from LLS, but I've checked all the ISRs from the vector table and none of them are causing the freeze up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've based my code on Freescale's Power Management Controller (PMC) example code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the code I use to put the MCU into LLS mode:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SIM_SCGC4 |= SIM_SCGC4_LLWU_MASK;&amp;nbsp;&amp;nbsp; &amp;nbsp;// enable LLWU clock gating&lt;BR /&gt;MC_PMPROT = 0 | MC_PMPROT_ALLS_MASK;&amp;nbsp;&amp;nbsp; &amp;nbsp;// allow LLS stop mode&lt;BR /&gt;MC_PMCTRL = 0 | MC_PMCTRL_LPLLSM(3); &amp;nbsp;&amp;nbsp; &amp;nbsp;// enable LLS mode&lt;BR /&gt;SCB_SCR |= SCB_SCR_SLEEPDEEP_MASK;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// set SLEEPDEEP bit to enable sleep modes&lt;BR /&gt;LLWU_PE3 |= LLWU_PE3_WUPE10(2);&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// set Power button as wakeup source&lt;/P&gt;&lt;P&gt;asm("wfi");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my ISR:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void llwu_isr(void)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; initInterrupts();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SIM_SCGC4 |= SIM_SCGC4_LLWU_MASK;&amp;nbsp;&amp;nbsp; &amp;nbsp;// enable LLWU clock gating&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SIM_SCGC5 = SIM_SCGC5_PORTA_MASK | SIM_SCGC5_PORTB_MASK | SIM_SCGC5_PORTC_MASK |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SIM_SCGC5_PORTD_MASK | SIM_SCGC5_PORTE_MASK;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;initGPIO();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LLWU_CS |= LLWU_CS_ACKISO_MASK;&amp;nbsp;&amp;nbsp; &amp;nbsp;// clear LLWU acknowledge flag&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LLWU_F1 = 0xFF;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// clear wakeup flags&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LLWU_F2 = 0xFF;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// clear wakeup flags&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LLWU_F3 = 0xFF;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// clear wakeup flags&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Anyone have any ideas why I can't completely get out of LLS mode?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Apr 2011 07:18:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Problem-using-the-LLWU-to-recover-from-LLS-mode/m-p/197932#M2747</guid>
      <dc:creator>RonBurgundy</dc:creator>
      <dc:date>2011-04-13T07:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using the LLWU to recover from LLS mode</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Problem-using-the-LLWU-to-recover-from-LLS-mode/m-p/197933#M2748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I figured out my problem with the LLWU.&amp;nbsp; After pressing the button to wakeup from LLS mode (which is on PORTC), control goes from the LLWU ISR to the PORTC ISR.&amp;nbsp; This wasn't obvious as my code was fairly complex.&amp;nbsp; I had to end up creating a simple project with minimal setup, which made it a lot easier to see where the MCU was getting stuck.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps anyone else who gets stuck on this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Apr 2011 05:45:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Problem-using-the-LLWU-to-recover-from-LLS-mode/m-p/197933#M2748</guid>
      <dc:creator>RonBurgundy</dc:creator>
      <dc:date>2011-04-15T05:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using the LLWU to recover from LLS mode</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Problem-using-the-LLWU-to-recover-from-LLS-mode/m-p/197934#M2749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have a problem to wake up K40 from LLS with LLWU. I try to wake up it with pin interrupt (PTE1) but when i sending the stimulus from this pin the K40 goes in a &lt;SPAN&gt;&lt;SPAN&gt;unpredictable&lt;/SPAN&gt;&lt;/SPAN&gt; power status.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;I put&lt;/SPAN&gt; &lt;SPAN&gt;the following code&lt;/SPAN&gt; &lt;SPAN&gt;in&lt;/SPAN&gt; &lt;SPAN&gt;the&lt;/SPAN&gt;&lt;/SPAN&gt; PORT E interrupt:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PE_ISR(isrINT_PORTE){  /* Write your interrupt code here ... */ PORTE_PCR1 |= 0x01000000; SIM_SCGC4 |= SIM_SCGC4_LLWU_MASK;    // enable LLWU clock gating SIM_SCGC5 = SIM_SCGC5_PORTA_MASK | SIM_SCGC5_PORTB_MASK | SIM_SCGC5_PORTC_MASK | SIM_SCGC5_PORTD_MASK | SIM_SCGC5_PORTE_MASK;    LLWU_CS |= LLWU_CS_ACKISO_MASK;    // clear LLWU acknowledge flag    LLWU_F1 = 0xFF;            // clear wakeup flags    LLWU_F2 = 0xFF;            // clear wakeup flags    LLWU_F3 = 0xFF;            // clear wakeup flags}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;SPAN&gt;&lt;SPAN&gt;The only difference&lt;/SPAN&gt; &lt;SPAN&gt;in comparison to&lt;/SPAN&gt; &lt;SPAN&gt;the&lt;/SPAN&gt; &lt;SPAN&gt;previous post&lt;/SPAN&gt; &lt;SPAN&gt;is the absence&lt;/SPAN&gt; &lt;SPAN&gt;of&lt;/SPAN&gt; &lt;SPAN&gt;initinterrupts&lt;/SPAN&gt; &lt;SPAN&gt;functions&lt;/SPAN&gt; &lt;SPAN&gt;() and&lt;/SPAN&gt; &lt;SPAN&gt;initgpio&lt;/SPAN&gt; &lt;SPAN&gt;().&lt;/SPAN&gt; What c&lt;SPAN&gt;ode&lt;/SPAN&gt; &lt;SPAN&gt;that&lt;/SPAN&gt; &lt;SPAN&gt;must&lt;/SPAN&gt; &lt;SPAN&gt;contain&amp;nbsp;&lt;/SPAN&gt;these &lt;SPAN&gt;functions&lt;/SPAN&gt;&lt;SPAN&gt;?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks to all.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Aug 2011 14:41:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Problem-using-the-LLWU-to-recover-from-LLS-mode/m-p/197934#M2749</guid>
      <dc:creator>Mirko</dc:creator>
      <dc:date>2011-08-19T14:41:44Z</dc:date>
    </item>
  </channel>
</rss>

