<?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: KL25Z entry into VLPS mode from VLPR in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL25Z-entry-into-VLPS-mode-from-VLPR/m-p/611540#M36191</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;A couple of things:&lt;/P&gt;&lt;P&gt;1. The _wfi() sets the VLPS mode and it doesn't continue until a wakeup (interrupt) occurs. If the processor continues from this point it means that it has been woken and will be in VLPR again. You can only measure the VLPS current when the processor hasn't already been woken again.&lt;BR /&gt;2. If the VLPS current is higher than expected check whether there are clocks that are configured to continue running in the VLPS mode and ensure that non-needed ones do get stopped. Also verify that there are no floating inputs since these cause higher than expected current consumption: when you are sure the VLPS mode is active touch all pins on the processor and see whether the current changes when certain ones are touched - if so, ensure that their state is defined so that it doesn't happen (eg. set as outputs or enable pull-up or down on GPIO inputs or peripheral inputs).&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;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 16 Apr 2017 19:58:50 GMT</pubDate>
    <dc:creator>mjbcswitzerland</dc:creator>
    <dc:date>2017-04-16T19:58:50Z</dc:date>
    <item>
      <title>KL25Z entry into VLPS mode from VLPR</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL25Z-entry-into-VLPS-mode-from-VLPR/m-p/611537#M36188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I m working on a project with KL25Z and I need as low power consumption as possible.&lt;SPAN&gt; For my app, I basically would need the MCU to quickly do all the instructions in VLPR and then sleep (VLPS), until I wake him up&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;with an interrupt.&lt;/SPAN&gt; I am using Kinetis design studio 3 for compiling and Ozone 2.22 for debugging. I am also using kinetis SDK 2.1.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With my code, I am able to enter VLPR mode, with a current consumption of 770 uA measured on J4 jumper. For VLPR mode, I set the SMC and then MCG mode from FEI to BLPI, all according to reference manual, core clock 1 MHz, bus clock 500 KHz.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But then, I have problems with entering inthe VLPS (very low power stop) mode.&amp;nbsp;The consumption is nowhere near 5 uA as it should be. It actually doesn't sleep at all, according to SMC_PMSTAT register, it goes to normal run mode .Attached please find my code. I am trying to enter the VLPS in a loop, during which it should sleep and wake up on an interrupt from LPTMR.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone please help me correct my code? Or maybe propose an alternative to my code, to make it sleep in VLPS?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for answers&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337571"&gt;code.txt.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Apr 2017 16:58:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL25Z-entry-into-VLPS-mode-from-VLPR/m-p/611537#M36188</guid>
      <dc:creator>vaclavbajgar</dc:creator>
      <dc:date>2017-04-14T16:58:20Z</dc:date>
    </item>
    <item>
      <title>Re: KL25Z entry into VLPS mode from VLPR</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL25Z-entry-into-VLPS-mode-from-VLPR/m-p/611538#M36189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For complete low power solution see:&lt;BR /&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.utasker.com%2Fkinetis%2FFRDM-KL25Z.html" rel="nofollow" target="_blank"&gt;http://www.utasker.com/kinetis/FRDM-KL25Z.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some low power videos:&lt;BR /&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DkWNlsAoMly4%26list%3DPLWKlVb_MqDQFZAulrUywU30v869JBYi9Q" rel="nofollow" target="_blank"&gt;https://www.youtube.com/watch?v=kWNlsAoMly4&amp;amp;list=PLWKlVb_MqDQFZAulrUywU30v869JBYi9Q&lt;/A&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dv4UnfcDiaE4%26index%3D7%26list%3DPLWKlVb_MqDQFZAulrUywU30v869JBYi9Q" rel="nofollow" target="_blank"&gt;https://www.youtube.com/watch?v=v4UnfcDiaE4&amp;amp;index=7&amp;amp;list=PLWKlVb_MqDQFZAulrUywU30v869JBYi9Q&lt;/A&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DiZEMRiDmHzw%26list%3DPLWKlVb_MqDQFZAulrUywU30v869JBYi9Q%26index%3D5" rel="nofollow" target="_blank"&gt;https://www.youtube.com/watch?v=iZEMRiDmHzw&amp;amp;list=PLWKlVb_MqDQFZAulrUywU30v869JBYi9Q&amp;amp;index=5&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is available as open source&lt;BR /&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.utasker.com%2Fforum%2Findex.php%3Ftopic%3D1721.msg7086%23msg7086" rel="nofollow" target="_blank"&gt;http://www.utasker.com/forum/index.php?topic=1721.msg7086#msg7086&lt;/A&gt;&lt;BR /&gt;or supported professional.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;To be able to see what the problem is with your code I think that you need to show also SMC_PreEnterStopModes() etc.&lt;BR /&gt;Make sure that you are not missing executing the _wfi() instruction in the VLPS case, or setting the SLEEPDEEP flag beforehand.&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;Professional support for Kinetis: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.utasker.com%2Findex.html" rel="nofollow" target="_blank"&gt;http://www.utasker.com/index.html&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;Remote desktop one-on-one coaching: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.utasker.com%2Fservices.html" rel="nofollow" target="_blank"&gt;http://www.utasker.com/services.html&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;Getting started to expert videos: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=https%3A%2F%2Fwww.youtube.com%2Fresults%3Fsearch_query%3Dutasker%2Bshorts" rel="nofollow" target="_blank"&gt;https://www.youtube.com/results?search_query=utasker+shorts&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Apr 2017 15:39:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL25Z-entry-into-VLPS-mode-from-VLPR/m-p/611538#M36189</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2017-04-15T15:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: KL25Z entry into VLPS mode from VLPR</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL25Z-entry-into-VLPS-mode-from-VLPR/m-p/611539#M36190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, thanks for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will try the utasker you propose.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the functions : SMC_PreEnterStopModes(), SMC_SetPowerModeVlps(SMC) and SMC_PostExitStopModes(); are these instructions:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;void SMC_PreEnterStopModes(void)&lt;/STRONG&gt;&lt;BR /&gt;{&lt;BR /&gt; flash_prefetch_speculation_status_t speculationStatus =&lt;BR /&gt; {&lt;BR /&gt; kFLASH_prefetchSpeculationOptionDisable, /* Disable instruction speculation.*/&lt;BR /&gt; kFLASH_prefetchSpeculationOptionDisable, /* Disable data speculation.*/&lt;BR /&gt; };&lt;/P&gt;&lt;P&gt;__disable_irq();&lt;BR /&gt; __ISB();&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt; * Before enter stop modes, the flash cache prefetch should be disabled.&lt;BR /&gt; * Otherwise the prefetch might be interrupted by stop, then the data and&lt;BR /&gt; * and instruction from flash are wrong.&lt;BR /&gt; */&lt;BR /&gt; FLASH_PflashSetPrefetchSpeculation(&amp;amp;speculationStatus);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;---------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;status_t SMC_SetPowerModeVlps(SMC_Type *base)&lt;/STRONG&gt;&lt;BR /&gt;{&lt;BR /&gt; uint8_t reg;&lt;/P&gt;&lt;P&gt;/* configure VLPS mode */&lt;BR /&gt; reg = base-&amp;gt;PMCTRL;&lt;BR /&gt; reg &amp;amp;= ~SMC_PMCTRL_STOPM_MASK;&lt;BR /&gt; reg |= (kSMC_StopVlps &amp;lt;&amp;lt; SMC_PMCTRL_STOPM_SHIFT);&lt;BR /&gt; base-&amp;gt;PMCTRL = reg;&lt;/P&gt;&lt;P&gt;/* Set the SLEEPDEEP bit to enable deep sleep mode */&lt;BR /&gt; SCB-&amp;gt;SCR |= SCB_SCR_SLEEPDEEP_Msk;&lt;/P&gt;&lt;P&gt;/* read back to make sure the configuration valid before enter stop mode */&lt;BR /&gt; (void)base-&amp;gt;PMCTRL;&lt;BR /&gt; __DSB();&lt;BR /&gt; __WFI();&lt;BR /&gt; __ISB();&lt;/P&gt;&lt;P&gt;/* check whether the power mode enter VLPS mode succeed */&lt;BR /&gt; if (base-&amp;gt;PMCTRL &amp;amp; SMC_PMCTRL_STOPA_MASK)&lt;BR /&gt; {&lt;BR /&gt; return kStatus_SMC_StopAbort;&lt;BR /&gt; }&lt;BR /&gt; else&lt;BR /&gt; {&lt;BR /&gt; return kStatus_Success;&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;void SMC_PostExitStopModes(void)&lt;/STRONG&gt;&lt;BR /&gt;{&lt;BR /&gt; flash_prefetch_speculation_status_t speculationStatus =&lt;BR /&gt; {&lt;BR /&gt; kFLASH_prefetchSpeculationOptionEnable, /* Enable instruction speculation.*/&lt;BR /&gt; kFLASH_prefetchSpeculationOptionEnable, /* Enable data speculation.*/&lt;BR /&gt; };&lt;/P&gt;&lt;P&gt;FLASH_PflashSetPrefetchSpeculation(&amp;amp;speculationStatus);&lt;/P&gt;&lt;P&gt;__enable_irq();&lt;BR /&gt; __ISB();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The __wfi() instruction and sleepdeep bit is set, I still dont really understand why there is such a high current consumption.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Apr 2017 12:13:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL25Z-entry-into-VLPS-mode-from-VLPR/m-p/611539#M36190</guid>
      <dc:creator>vaclavbajgar</dc:creator>
      <dc:date>2017-04-16T12:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: KL25Z entry into VLPS mode from VLPR</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL25Z-entry-into-VLPS-mode-from-VLPR/m-p/611540#M36191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;A couple of things:&lt;/P&gt;&lt;P&gt;1. The _wfi() sets the VLPS mode and it doesn't continue until a wakeup (interrupt) occurs. If the processor continues from this point it means that it has been woken and will be in VLPR again. You can only measure the VLPS current when the processor hasn't already been woken again.&lt;BR /&gt;2. If the VLPS current is higher than expected check whether there are clocks that are configured to continue running in the VLPS mode and ensure that non-needed ones do get stopped. Also verify that there are no floating inputs since these cause higher than expected current consumption: when you are sure the VLPS mode is active touch all pins on the processor and see whether the current changes when certain ones are touched - if so, ensure that their state is defined so that it doesn't happen (eg. set as outputs or enable pull-up or down on GPIO inputs or peripheral inputs).&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Apr 2017 19:58:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL25Z-entry-into-VLPS-mode-from-VLPR/m-p/611540#M36191</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2017-04-16T19:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: KL25Z entry into VLPS mode from VLPR</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL25Z-entry-into-VLPS-mode-from-VLPR/m-p/611541#M36192</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;Thank you very much! Thanks to your first advice I went step by step through my code and tried to figure out what would cause the interrupt to wake my processor up.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For anyone who would have the same problem:&lt;/P&gt;&lt;P&gt;I kinda changed the transition into BLPI clock MCG mode, where I now dont go via FBE mode anymore. So going from FEI to BLPI directly through FBI made the difference and I was able to make it sleep.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also this line of code increased the consumption by 600 uA, so maybe I didnt rly &amp;nbsp;understand the reference manual, therefore I deleted this line in my code...&lt;/P&gt;&lt;P&gt;//Switch off the clock into SCGC6 register - FTF Flash memory, which prevents entry into low power mode&lt;BR /&gt; SIM-&amp;gt;SCGC6 &amp;amp;=~ (1 &amp;lt;&amp;lt;0);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then the LPTMR was badly set as well, I changed the clock source for LMPTR module to LPO 1KHz and then updated the LMPTR prescaler and compare value accordingly. Now I am able to make it sleep and wake up in a while cycle...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Apr 2017 11:32:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL25Z-entry-into-VLPS-mode-from-VLPR/m-p/611541#M36192</guid>
      <dc:creator>vaclavbajgar</dc:creator>
      <dc:date>2017-04-18T11:32:36Z</dc:date>
    </item>
  </channel>
</rss>

