<?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: Can't go to VLPS mode when using FreeRtos in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Can-t-go-to-VLPS-mode-when-using-FreeRtos/m-p/729097#M44573</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel, thanks for answering.&lt;/P&gt;&lt;P&gt;The function gets called always by the same task.&lt;/P&gt;&lt;P&gt;Nevertheless, I have tried using vTaskSuspendAll() before entering VLPS, but same result: the program doesn't stop (sleep), it feels like it hasn't gone to sleep.&lt;/P&gt;&lt;P&gt;The NVIC table is literally 0, all 32 possible interrupts are disabled.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I have to asume one of these are generating an interrupt? If it's so, how could I know which one is triggering?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Captura2.JPG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/47065i9ECEC749415F96D0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Captura2.JPG" alt="Captura2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit: I think I've found what was 'instantly' waking up the mcu: the debugger. I have to prove this deeply (can't test currents atm), but I'm almost 90% sure was that...&lt;/P&gt;&lt;P&gt;(I've tested it with a LED, getting it On when the mcu left VLPS and triggering the wakeup with a timer)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 23 Apr 2018 13:49:20 GMT</pubDate>
    <dc:creator>martir</dc:creator>
    <dc:date>2018-04-23T13:49:20Z</dc:date>
    <item>
      <title>Can't go to VLPS mode when using FreeRtos</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Can-t-go-to-VLPS-mode-when-using-FreeRtos/m-p/729095#M44571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I'm working with MKL82Z7 on a custom PCB. I'm using SDK_2.2_MKL82Z128xxx7&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm able to go to sleep at the beginning of the code, but unable to do it when all Tasks have been started. The sleep function it's called from a Task.&lt;/P&gt;&lt;P&gt;And the program doesn't get stuck after WFI() (line 219 of fsl.smc.c *1), so I'm guessing an interrupt is&amp;nbsp;waking up the uC just after it has gone to sleep.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;*1: if (base-&amp;gt;PMCTRL &amp;amp; SMC_PMCTRL_STOPA_MASK)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The&amp;nbsp;function that calls the sleep&amp;nbsp;is this one:&lt;/P&gt;&lt;PRE&gt;void SLEEP_EnterSleepMode(void)
{/* Disable interrupts */
 //taskENTER_CRITICAL();
 sleep_disableInterrupts();
 sleep_disableClocks();

/* Enter VLPS Mode */
 SMC_PreEnterStopModes();
 SMC_SetPowerModeVlps(SMC);
 SMC_PostExitStopModes();

/* Reenable interrupts */
 sleep_enableClocks();
 sleep_enableInterrupts();
//taskEXIT_CRITICAL();
}&lt;/PRE&gt;&lt;P&gt;In&amp;nbsp;&lt;SPAN&gt;sleep_disableInterrupts /&amp;nbsp;sleep_enableClocks, I'm disabling only the modules I've been using (USB, ADC, LPTMR, etc) and same with the interrupts with sleep_disableInterrupts (LPUART, USB, LPTMR, RTC...).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Am I missing something? Some general clock maybe? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Or how can I know which interrupt is triggering? I was thinking about FreeRtos, then&amp;nbsp;I've tried that critical section, but a HardFault occurs.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any advice will much apreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks in advance.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Martí.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2018 15:21:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Can-t-go-to-VLPS-mode-when-using-FreeRtos/m-p/729095#M44571</guid>
      <dc:creator>martir</dc:creator>
      <dc:date>2018-04-12T15:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: Can't go to VLPS mode when using FreeRtos</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Can-t-go-to-VLPS-mode-when-using-FreeRtos/m-p/729096#M44572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marti:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would suggest you narrow down this issue by disable some tasks. Each time let only one task run. Check which task results in this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please also be kindly noted that there is an errata related with VLPS for MKL82z128&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/20144i3AA157C27723F232/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Apr 2018 08:10:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Can-t-go-to-VLPS-mode-when-using-FreeRtos/m-p/729096#M44572</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2018-04-18T08:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: Can't go to VLPS mode when using FreeRtos</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Can-t-go-to-VLPS-mode-when-using-FreeRtos/m-p/729097#M44573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel, thanks for answering.&lt;/P&gt;&lt;P&gt;The function gets called always by the same task.&lt;/P&gt;&lt;P&gt;Nevertheless, I have tried using vTaskSuspendAll() before entering VLPS, but same result: the program doesn't stop (sleep), it feels like it hasn't gone to sleep.&lt;/P&gt;&lt;P&gt;The NVIC table is literally 0, all 32 possible interrupts are disabled.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I have to asume one of these are generating an interrupt? If it's so, how could I know which one is triggering?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Captura2.JPG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/47065i9ECEC749415F96D0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Captura2.JPG" alt="Captura2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit: I think I've found what was 'instantly' waking up the mcu: the debugger. I have to prove this deeply (can't test currents atm), but I'm almost 90% sure was that...&lt;/P&gt;&lt;P&gt;(I've tested it with a LED, getting it On when the mcu left VLPS and triggering the wakeup with a timer)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Apr 2018 13:49:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Can-t-go-to-VLPS-mode-when-using-FreeRtos/m-p/729097#M44573</guid>
      <dc:creator>martir</dc:creator>
      <dc:date>2018-04-23T13:49:20Z</dc:date>
    </item>
  </channel>
</rss>

