<?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>Kinetis Microcontrollers中的主题 Re: LLWU + PORT interrupt</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266530#M8686</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am having troubles with GPIO interrupts when I wake up from LLS mode and have questions very similar to Martin's questions. I am using the MK20DX128VLH5 processor but I assume that it operates similar to the &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;MK20DN512VLL10&lt;/SPAN&gt; Martin asked about with respect to these issues. Here's the thing. A person named Paul supplied an answer to Martin's question. But the answer really isn't quite right. As in my case, Martin asked about exiting LLS mode based on a GPIO change. Paul's answer talks about going through a reset process. This may be true for exit from VLLSx modes but not LLS. For LLS, when the processor receives the wakeup signal the LLWU executes the LLWU wakeup ISR and then returns to the code following the WFI instruction that put the processor to sleep.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where I get (very) confused is that Freescale provides a "Kinetis Quick Reference User Guide, Rev. 2, 08/2012" document that states in section&lt;/P&gt;&lt;P&gt;5.3.2.4:&lt;/P&gt;&lt;P&gt;"&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;The wakeup sequence is not obvious for some of the modes. For most of the wait and &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;stop modes code execution follows a predictable flow. For LLS mode which requires the &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;LLWU, the LLWU vector is fetched and taken right after the wakeup event. If the &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;wakeup source’s interrupt flag is not cleared by the LLWU interrupt handler, then the &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;next interrupt vector for the wakeup source is taken and the flag in the port or module can &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;be cleared. Code execution then continues with the instruction following the WFI &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;instruction that sent the MCU into the low power mode."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This does happen for module wakeups; both the LLWU and module interrupt handlers run. But I can't get it to happen for GPIO pin wakeups where only the LLWU handler runs. That is contrary to the User guide.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Freescale also provides App Note 4503 on low power operation. Section 9.1 of that document is on exiting low power modes and states:&lt;/P&gt;&lt;P&gt;"&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;The enabled GPIO pins can also function as a pin interrupt to wake the MCU. If the pin is configured as both a pin interrupt &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;and an LLWU wake-up pin, the operation of clearing the LLWU pin flag in the LLWU register clears the corresponding ISF &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;flag bit in the port register. If the wake-up is from LLS mode, clearing the associated LLWU flag will then create an interrupt &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;flag in the Port Control Register."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;That's what I would like to happen but it doesn't. So I'm trying to figure out a clean SW design for having an LLS wakeup invoke the interrupt handling code for a GPIO pin transition that caused the wakeup. I can use the NVIC "pending interrupt" registers to set a pending interrupt for the GPIO port that contains the pin that caused the wakeup but I can't find any way to trigger an interrupt that my code can detect for the specific pin that caused the wakeup. And I really want to be able to have a generic LLWU wakeup interrupt handler that doesn't have to replicate all the code that is in my GPIO interrupt handler. And I want the GPIO code to run at the priority set for it and not the priority set for the LLWU interrupt.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Because I have often been tasked with writing/fixing the BSPs for operating systems supporting "safety critical" applications running on many different flavors of Freescale processors I know that "the devil is in the details" and getting things right can be very tricky at times.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I'm really hoping someone can suggest a workable method for handling GPIO pin wakeup events from LLS processor mode. And I would like to know what pieces of the supplied Freescale documentation on this subject is most correct or whether there truly is no way to have a GPIO interrupt handler run for the pin that caused an LLS wakeup.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Thanks in advance for the type of helpful answer I have most always been able to get from the great Freescale team.&amp;nbsp;&amp;nbsp; Fred&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Sep 2013 19:54:07 GMT</pubDate>
    <dc:creator>fredroeber</dc:creator>
    <dc:date>2013-09-02T19:54:07Z</dc:date>
    <item>
      <title>LLWU + PORT interrupt</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266526#M8682</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 have configured single pin both to generate interrupt (in PORTx_PCRn register) and to wake MCU (MK20DN512VLL10) from LLS (LLWU_PEn register).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have enabled both interrupts in NVIC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When MCU wakes up, will both interrupt handlers (LLW_IRQHandler and PORTx_IRQHandler) be invoked? Or only&amp;nbsp; LLW_IRQHandler?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When MCU wakes up, are PORTx_IRQHandler and LLW_IRQHandler invoked according to their interrupt priority (higher priority first)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does clearing of ISF bit in PORTx_PCRn also clear corresponding bit in LLWU_Fx?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does clearing bit in LLWU_Fx also clear corresponding ISF bit in PORTx_PCRn?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Best regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Martin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 May 2013 08:14:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266526#M8682</guid>
      <dc:creator>martindusek</dc:creator>
      <dc:date>2013-05-31T08:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: LLWU + PORT interrupt</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266527#M8683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Martin&lt;/P&gt;&lt;P&gt;Let me explain the process of wakeup from LLSx mode. When MCU is waken up from LLSx mode, it will run reset process directly without run into LLWU ISR. After reset, MCU will run into LLWU ISR to clear LLUW interrupt flag. If at this time, GPIO interrupt generation condition is still matched, GPIO interrupt flag will be set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Q1: When MCU wakes up, will both interrupt handlers (LLW_IRQHandler and PORTx_IRQHandler) be invoked? Or only&amp;nbsp; LLW_IRQHandler?&lt;/P&gt;&lt;P&gt;A1: Only LLW_IRQ Handler.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Q2: When MCU wakes up, are PORTx_IRQHandler and LLW_IRQHandler invoked according to their interrupt priority (higher priority first)?&lt;/P&gt;&lt;P&gt;A2: No. LLWU_IRQ is first.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Q3:Does clearing of ISF bit in PORTx_PCRn also clear corresponding bit in LLWU_Fx?&lt;/P&gt;&lt;P&gt;A3: Please reference the process I mentioned. This condition will not happened.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Q4: Does clearing bit in LLWU_Fx also clear corresponding ISF bit in PORTx_PCRn?&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;A4: Please reference the process I mentioned. This condition will not happened. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;Hope my reply can help you.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;Paul&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jun 2013 03:17:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266527#M8683</guid>
      <dc:creator>Paul_Tian</dc:creator>
      <dc:date>2013-06-19T03:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: LLWU + PORT interrupt</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266528#M8684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Martin,&lt;/P&gt;&lt;P&gt;just checking up on this, was the information provided by Paul useful?&lt;/P&gt;&lt;P&gt;Please let us know :smileyhappy:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Monica.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Jun 2013 23:53:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266528#M8684</guid>
      <dc:creator>Monica</dc:creator>
      <dc:date>2013-06-26T23:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: LLWU + PORT interrupt</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266529#M8685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, it was useful :smileyhappy: Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Jun 2013 09:18:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266529#M8685</guid>
      <dc:creator>martindusek</dc:creator>
      <dc:date>2013-06-27T09:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: LLWU + PORT interrupt</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266530#M8686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am having troubles with GPIO interrupts when I wake up from LLS mode and have questions very similar to Martin's questions. I am using the MK20DX128VLH5 processor but I assume that it operates similar to the &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;MK20DN512VLL10&lt;/SPAN&gt; Martin asked about with respect to these issues. Here's the thing. A person named Paul supplied an answer to Martin's question. But the answer really isn't quite right. As in my case, Martin asked about exiting LLS mode based on a GPIO change. Paul's answer talks about going through a reset process. This may be true for exit from VLLSx modes but not LLS. For LLS, when the processor receives the wakeup signal the LLWU executes the LLWU wakeup ISR and then returns to the code following the WFI instruction that put the processor to sleep.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where I get (very) confused is that Freescale provides a "Kinetis Quick Reference User Guide, Rev. 2, 08/2012" document that states in section&lt;/P&gt;&lt;P&gt;5.3.2.4:&lt;/P&gt;&lt;P&gt;"&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;The wakeup sequence is not obvious for some of the modes. For most of the wait and &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;stop modes code execution follows a predictable flow. For LLS mode which requires the &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;LLWU, the LLWU vector is fetched and taken right after the wakeup event. If the &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;wakeup source’s interrupt flag is not cleared by the LLWU interrupt handler, then the &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;next interrupt vector for the wakeup source is taken and the flag in the port or module can &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;be cleared. Code execution then continues with the instruction following the WFI &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;instruction that sent the MCU into the low power mode."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This does happen for module wakeups; both the LLWU and module interrupt handlers run. But I can't get it to happen for GPIO pin wakeups where only the LLWU handler runs. That is contrary to the User guide.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Freescale also provides App Note 4503 on low power operation. Section 9.1 of that document is on exiting low power modes and states:&lt;/P&gt;&lt;P&gt;"&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;The enabled GPIO pins can also function as a pin interrupt to wake the MCU. If the pin is configured as both a pin interrupt &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;and an LLWU wake-up pin, the operation of clearing the LLWU pin flag in the LLWU register clears the corresponding ISF &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;flag bit in the port register. If the wake-up is from LLS mode, clearing the associated LLWU flag will then create an interrupt &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;flag in the Port Control Register."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;That's what I would like to happen but it doesn't. So I'm trying to figure out a clean SW design for having an LLS wakeup invoke the interrupt handling code for a GPIO pin transition that caused the wakeup. I can use the NVIC "pending interrupt" registers to set a pending interrupt for the GPIO port that contains the pin that caused the wakeup but I can't find any way to trigger an interrupt that my code can detect for the specific pin that caused the wakeup. And I really want to be able to have a generic LLWU wakeup interrupt handler that doesn't have to replicate all the code that is in my GPIO interrupt handler. And I want the GPIO code to run at the priority set for it and not the priority set for the LLWU interrupt.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Because I have often been tasked with writing/fixing the BSPs for operating systems supporting "safety critical" applications running on many different flavors of Freescale processors I know that "the devil is in the details" and getting things right can be very tricky at times.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I'm really hoping someone can suggest a workable method for handling GPIO pin wakeup events from LLS processor mode. And I would like to know what pieces of the supplied Freescale documentation on this subject is most correct or whether there truly is no way to have a GPIO interrupt handler run for the pin that caused an LLS wakeup.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Thanks in advance for the type of helpful answer I have most always been able to get from the great Freescale team.&amp;nbsp;&amp;nbsp; Fred&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Sep 2013 19:54:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266530#M8686</guid>
      <dc:creator>fredroeber</dc:creator>
      <dc:date>2013-09-02T19:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: LLWU + PORT interrupt</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266531#M8687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;| Q1: When MCU wakes up, will both interrupt handlers (LLW_IRQHandler and PORTx_IRQHandler) be invoked? Or only&amp;nbsp; LLW_IRQHandler?&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;| A1: Only LLW_IRQ Handler.&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Note that some of the Freescale application notes say that BOTH ISRs will be executed.&amp;nbsp; However, I cannot confirm or refute this at present.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Feb 2015 05:20:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266531#M8687</guid>
      <dc:creator>jvasil</dc:creator>
      <dc:date>2015-02-19T05:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: LLWU + PORT interrupt</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266532#M8688</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;James&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the processor is set to a low leakage power mode the LLWU is attached (it is isolated in the processor's RUN mode).&lt;/P&gt;&lt;P&gt;This means that if LLWU and GPIO interrupts are enabled on a pin the GPIO interrupt occurs when in RUN mode. Once in low leakage power mode only a LLWU interrupt will occur.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kinetis: &lt;A href="http://www.utasker.com/kinetis.html" title="http://www.utasker.com/kinetis.html"&gt;µTasker Kinetis support&lt;/A&gt;&lt;/P&gt;&lt;P&gt;LLWU: &lt;A href="http://www.utasker.com/kinetis/LLWU.html" title="http://www.utasker.com/kinetis/LLWU.html"&gt;µTasker LLWU Support&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;For the complete "out-of-the-box" Kinetis experience and faster time to market&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Feb 2015 14:52:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266532#M8688</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2015-02-19T14:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: LLWU + PORT interrupt</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266533#M8689</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mark,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is what AN4503 says:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;9.1 Exiting low-power modes&lt;/SPAN&gt;&lt;BR /&gt;&lt;EM&gt;The enabled GPIO pins can also function as a pin interrupt to wake the MCU. If the pin is configured as both a pin interrupt and an LLWU wake-up pin, the operation of clearing the LLWU pin flag in the LLWU register clears the corresponding ISF flag bit in the port register. If the wake-up is from LLS mode, clearing the associated LLWU flag will then create an interrupt flag in the Port Control Register.&lt;/EM&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Source: "Power Management for Kinetis and ColdFire+ MCUs". Page 30. Freescale. AN 4503. Rev. 1, 11/2012.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Freescale has also given us a copy of a draft version of a revised/updated AN.&amp;nbsp; It rewords this section and seems to emphasize that that both ISRs can run:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;10.1.1 Pin Interrupt and LLWU Wake-up functionality integration&lt;/SPAN&gt;&lt;BR /&gt;&lt;EM&gt;If the pin is configured as both a pin interrupt and an LLWU wake-up pin, the corresponding ISF flag bit in the port control register may be set and can be cleared in the LLWU. If the ISF flag is set and is not cleared in the LLWU ISR then the port ISR will be taken after the LLWU isr completes.&lt;/EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Source: "Power Management for Kinetis MCUs". Page 47. Freescale. AN 4503. DRAFT. Rev. 2, 02/2015.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This AN &lt;STRONG style="text-decoration: underline;"&gt;seems&lt;/STRONG&gt; to be saying that if you configure the part just right, then both ISRs will run.&amp;nbsp; This is NOT quite the same as saying that the port ISR causes an interrupt while the processor is in a low-leakage mode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please note that I do not yet have an opinion about what the part actually does--I am only discussing what is said in this application note and app notes--like every other piece of documentation--have been known to have errors in the past!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;James&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Comments? &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/DavidS"&gt;DavidS&lt;/A&gt; or &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/josem.reyes.chaidez"&gt;josem.reyes.chaidez&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Feb 2015 15:55:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266533#M8689</guid>
      <dc:creator>jvasil</dc:creator>
      <dc:date>2015-02-19T15:55:38Z</dc:date>
    </item>
    <item>
      <title>Re: LLWU + PORT interrupt</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266534#M8690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi James&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The GPIO interrupt can't wake from LLWU but it is connected to the same pin and so its interrupt may be pending after wakeup due to the LLWU pin (also depends on its configuartion because a LLWU could be on a falling edge but the GPIO interrupt on a rising edge etc.). Whether it is then handled depends on what the LLWU interrupt handler does so you can control it as you wish - you can directly handle pending GPIO interrupts or simply based on the present GPIO state if you like or leave it to be handled by the GPIO handler, or clear it...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The situaltion after a VLLS mode (always exited via RESET) is different because some LLWU modules remain in the isolated mode and have to be first cleared before the non-isolated functions can operate again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In any case you need to experiment with the processor in question because there are some differences and also you need to check the errata sheet because some LLWU behavior can be unexpected (eg. the ordering of pending interrupts being take is not always as expected).&lt;/P&gt;&lt;P&gt;A general application note is OK as introduction but you need to concentrate on the particular part and your own particular configuration - half an hour with the device is worth more than a week studying an application note, although the basic knowledge from the appliation note will of course help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;For example - I have worked with various devices waking for LLS via the RTC. Some wake with the RTC event flag set and some without the event flag set so detailed handling may need to be adapted accordingly.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kinetis: &lt;A class="jive-link-external-small" data-content-finding="Community" href="http://www.utasker.com/kinetis.html" target="_blank"&gt;µTasker Kinetis support&lt;/A&gt;&lt;/P&gt;&lt;P&gt;LLWU: &lt;A class="jive-link-external-small" data-content-finding="Community" href="http://www.utasker.com/kinetis/LLWU.html" target="_blank"&gt;µTasker LLWU Support&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;For the complete "out-of-the-box" Kinetis experience and faster time to market&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Feb 2015 16:21:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266534#M8690</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2015-02-19T16:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: LLWU + PORT interrupt</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266535#M8691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin, Fred and any others contributing here.&lt;/P&gt;&lt;P&gt;I'm the guy who wrote the app note AN4503 on low power. Fred, I'm not sure why the KQRUG says the wakeup sequence is not obvious.&amp;nbsp; It is know and predictable once you work through the details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Let me say first that I'm updating the app note with some more accurate notes about the use of the interrupt and the LLWU wakeup.&lt;/EM&gt; It will be out soon, I'm told that this means March 2015.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note, that although the MCU versions may be different, all of the mode entry and exit sequences have stayed pretty much the same.&amp;nbsp; Some devices, like some of the KL series parts do not have a pin interrupt for each of the LLWU wakeup pins, so this discussion about using port pin interrupts with LLWU pins does not apply to all LLWU wakeup sources.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems this thread has some good questions about this low power exit, so I will let you know what I have experienced and what I have learned, speaking with the MCU low power designers and other apps engineers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When waking from LLS from a LLWU enabled pin, only the LLWU interrupt is taken. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While in LLS mode, the port interrupt logic is not even powered up. So, when the edge that wakes the MCU from LLS occurs the only logic that sees the edge is in the LLWU module.The port interrupt flag is not set and therefore the port interrupt function will not be called.&amp;nbsp; I hope that clears up some confusion that I might have caused. My statement in Rev. 1, 11/2012 of AN4503, that said that the ISF of the port pin is cleared with the clearing of the LLWU pin flag is incorrect. Sorry.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If there is a critical edge that you must catch, you need to use a pin that had both functions pin interrupt and LLWU wakeup.&amp;nbsp; Enable the edge interrupt logic with the PORTx_PCRxx register and the LLWU edge detect logic in the LLEU_PEx registers. Then you will not ever miss an edge. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In RUN, VLPR, WAIT, VLPW, VLPS, or STOP the interrupt for the port pin will be taken. While the MCU is transitioning into LLS and even VLLSx modes, the edge input will cause an interrupt and abort the mode transition.&amp;nbsp; The Stop Abort Flag will be set in this case will be cleared upon the next low power mode entry if no other interrupt occurs during mode entry. While in LLS the edge will wake the MCU and take the LLWU interrupt vector.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is no reason that the port interrupt function and the LLWU interrupt function need to be two different functions. One function can handle the edge exception handling.&amp;nbsp; If the LLWU flag is set clear it, if the PORTx_PCR_ISF flag is set, clear it, do your work and then exit the isr function. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now things are just a little different when it is a module waking the MCU from LLS.&amp;nbsp; If using the LPTMR to wake from LLS the LLWU interrupt is taken first.&amp;nbsp; Clearing the LLWU module flag has no effect and is not needed.&amp;nbsp; If you do nothing with the LPTMR in the LLWU interrupt function then when exiting the LLWU interrupt the LPTMR interrupt will be taken.&amp;nbsp; (Exiting one interrupt and entering another is call Tail Chaining and takes fewer cycles that a full exit and entry into the service routine.)&amp;nbsp; However if you clear the LPTMR flag, read the LPTRM flag back then clear the NVIC_CPIF bit in the NVIC, then the source of the interrupt is cleared and the LPTMR interrupt service routine is not called.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a subtle serialization that is mentioned in the sequence above. Please note that it can take nearly 12 cycles for a write to clear the LPTMR flag to complete. There are a few gaskets that the write passes through on its way to the peripheral.&amp;nbsp;&amp;nbsp; If you write to the flag and then immediately try to exit the interrupt, the flag write will not have had time to complete.&amp;nbsp; The result will be that the interrupt handler the MCU just left, is re-entered since the flag causing the interrupt is not cleared yet. However, if you write the flag, then read it back, the core will stall the code execution to wait for the write to complete before it issues the read.&amp;nbsp; This ordered process serializes the sequence of real-time events.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another little tidbit of information it took some experimentation to figure out, is that when waking the MCU from VLLSx modes with the RTC_SECONDS interrupt, you need to enable the clock gate to the RTC before the the NVIC clear pending interrupt flag will be cleared.&amp;nbsp; The reason for this is that the RTC has a handshake that is occuring with the NVIC and trying the clear the NVIC clear pending interrupt flag from the LLWU interrupt function of the RTC_SECONDS interrupt function will not complete if the RTC clock gate is not written. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll keep monitoring this thread to see if any of you have any further questions about various mode entry and exits.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Philip Drake&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Feb 2015 21:52:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266535#M8691</guid>
      <dc:creator>philip_drake</dc:creator>
      <dc:date>2015-02-19T21:52:34Z</dc:date>
    </item>
    <item>
      <title>Re: LLWU + PORT interrupt</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266536#M8692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In summary there are different interrupt domains.&amp;nbsp; When in VLLSx mode, then only the LLWU enabled sources will generate a Reset event. If the same pins used for LLWU also has ability to generate GPIO interrupt, then if an interrupt occurs prior to executing WFI instruction, then that interrupt will get serviced.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the pin/signal you choose does support both GPIO interrupt and LLWU source,&amp;nbsp; you should be good to go for the async mode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Feb 2015 22:26:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266536#M8692</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2015-02-19T22:26:42Z</dc:date>
    </item>
    <item>
      <title>Re: LLWU + PORT interrupt</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266537#M8693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Philip&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe after these details you could just link this thread to your new version of the application note ;-)&lt;/P&gt;&lt;P&gt;It is certainly good to have authoritive feedback.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you check out the link &lt;A href="http://www.utasker.com/kinetis/LLWU.html" title="http://www.utasker.com/kinetis/LLWU.html"&gt;µTasker LLWU Support&lt;/A&gt; ? It is not aimed at giving the same information but more a practical user's interface guide so I hope that there are no major boo-boos there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have also tested various configurations in many different devices and wonder whether you exerienced that fact that waking from LLS with the RTC alarm on the KL25 (maybe others but certainly not KL03 or KL43) wakeup occurs without any flag set in LLWU_F3? It is not a big issue because the LLWU interrupt is called without any flags set anywhere so this source can be "assumed", but it is a difference that can be shown.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I have been working on recently for KL devices without external RTC clock inputs is utilising LPO for long term alarms with accuracy in and out of low leakage modes. This allows the user to set an alarm in the RTC for say 12:00 on 20th March 2015 (with the limited long term accuracy of the LPO but better than nothing). The device may be moving in and out of LLS or VLLS and waking due to LLWU pin sources etc in the meantime and may be in low leakage mode or running when the alarm finally fires. This requires compensating for lost counts during low leakage modes when the 1s interrupt can't be handled to compensate for the 1/32.768 clock rate - when entering or leaving the low leakage modes, by either wakeup to RUN or via reset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using this this compensation strategy it is possible to either alarm via interrupt at the appropriate time/date or via a wakeup out of low leakage power mode with a 'reasonable' accuracy without needing an external oscillator. The technique is overviewed at the link but I expect to be adding more details now that its solution has been (more or less) finalised. In any case, whenever the project is configured for LPO as RTC clock source (lowest power and cheapest solution) the alarm compensation is performed automatically so that it seems that it has a real RTC with 32.768kHz source.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kinetis: &lt;A class="jive-link-external-small" data-content-finding="Community" href="http://www.utasker.com/kinetis.html" target="_blank"&gt;µTasker Kinetis support&lt;/A&gt;&lt;/P&gt;&lt;P&gt;LLWU: &lt;A class="jive-link-external-small" data-content-finding="Community" href="http://www.utasker.com/kinetis/LLWU.html" target="_blank"&gt;µTasker LLWU Support&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;For the complete "out-of-the-box" Kinetis experience and faster time to market&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Feb 2015 00:51:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LLWU-PORT-interrupt/m-p/266537#M8693</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2015-02-20T00:51:21Z</dc:date>
    </item>
  </channel>
</rss>

