<?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: AN11069: Why reboot after leaving DEEP SLEEP? in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/AN11069-Why-reboot-after-leaving-DEEP-SLEEP/m-p/526024#M8657</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by OldManVimes on Sun Aug 16 15:35:25 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Simon,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the reply, but I probably was not clear enough. I do not get an unexpected reboot while in DEEP SLEEP. My question is about the application note that contains the following code for DEEP SLEEP:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;__WFI();
NVIC_SystemReset();
// NOT REACHED&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So I want to know whether there is a documented approach to NOT reset the CPU, but to re-instate all clocks and peripherals.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have code that does exactly that and it works.... most of the time. However, when the amount of DEEP SLEEP time is very low (say well below 1 second) it appears that I cannot change the system clock back to the IRC and/or PLL_out clock without creating a hangup while waiting for the correct status of bit 0 of MAINCLKUEN. If real, this timing aspect is undocumented (or at least I have not been able to find it).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The question to the LPC1227 gurus is whether there is a relationship between the amount of time the CPU spends in DEEP SLEEP and the inability to re-instate clocks afterwards. My issue is not a pure programming error because most of the time it works fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Vimes&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 17:02:41 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T17:02:41Z</dc:date>
    <item>
      <title>AN11069: Why reboot after leaving DEEP SLEEP?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/AN11069-Why-reboot-after-leaving-DEEP-SLEEP/m-p/526022#M8655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by OldManVimes on Mon Aug 10 20:43:18 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi support,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Question. AN11069 provides sample code for dealing with DEEP SLEEP (and other low power modes). The DEEP SLEEP implementation (with RTC based wakeup) simply reboots after waking up. I am using this feature, but cannot reboot after waking up (I would loose state information). However I find that waking up is not very robust. I get frequent hangups (but not always). Can the system wakeup reliably?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Detailed questions:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- Why does the application note do this? Is it simply an oversight or is there a problem with the re-initializing of clocks?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- Is there a code example that provides an insight into how to setup the clocks (with implicit timing information) after waking up when going to DEEP SLEEP with a timed RTC wakeup + GPIO wakeup based on the WDT clock (as detailed in the errata sheet)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My application:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- Runs on the IRC + PLL to get to 24 MHz CPU clock&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- Switches to the IRC input, followed by the lowest possible WDT clock for DEEP SLEEP&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- Always wakes up nicely from DEEP SLEEP (so the WDT clock is running after waking up)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- Switches on a GPIO LED&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- Hangs in the re-initialization of clocks (sync on locking the PLL + switching to the PLL clock source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Vimes&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:02:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/AN11069-Why-reboot-after-leaving-DEEP-SLEEP/m-p/526022#M8655</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: AN11069: Why reboot after leaving DEEP SLEEP?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/AN11069-Why-reboot-after-leaving-DEEP-SLEEP/m-p/526023#M8656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by SimonWakley on Tue Aug 11 10:46:05 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was getting a reboot on RTC powered wake up (And Watchdog) , and I put some code in the start and realized the BOD was resetting the chip.&amp;nbsp; If you disable the BOD reset, then it might not.&amp;nbsp; I am going to investigate the PSU to see if the Wake Up surge was upsetting it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also it is a good idea to put a 5 second delay in the start up&amp;nbsp; before you set the sleep mode so that if you brick it, you can reset and then re-flash :-)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;unsigned int nWhy = LPC_SYSCON-&amp;gt;SYSRSTSTAT;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if ((nWhy &amp;amp; POR_RESET) == POR_RESET)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;printf("\nRESTARTED POR!!!"); &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else if ((nWhy &amp;amp; EXT_RESET) == EXT_RESET)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;puts("\nRESTARTED EXT!!!");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else if ((nWhy &amp;amp; WDT_RESET) == WDT_RESET)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;puts("\nRESTARTED WDT!!!");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else if ((nWhy &amp;amp; BOD_RESET) == BOD_RESET)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;puts("\nRESTARTED BOD!!!");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else if ((nWhy &amp;amp; SYS_RESET) == SYS_RESET)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;puts("\nRESTARTED SYS!!!");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;printf("\nRESTARTED - 0x%04x\n", nWhy); &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SYSCON-&amp;gt;SYSRSTSTAT = 0x1F;// Clear them all&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:02:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/AN11069-Why-reboot-after-leaving-DEEP-SLEEP/m-p/526023#M8656</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: AN11069: Why reboot after leaving DEEP SLEEP?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/AN11069-Why-reboot-after-leaving-DEEP-SLEEP/m-p/526024#M8657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by OldManVimes on Sun Aug 16 15:35:25 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Simon,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the reply, but I probably was not clear enough. I do not get an unexpected reboot while in DEEP SLEEP. My question is about the application note that contains the following code for DEEP SLEEP:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;__WFI();
NVIC_SystemReset();
// NOT REACHED&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So I want to know whether there is a documented approach to NOT reset the CPU, but to re-instate all clocks and peripherals.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have code that does exactly that and it works.... most of the time. However, when the amount of DEEP SLEEP time is very low (say well below 1 second) it appears that I cannot change the system clock back to the IRC and/or PLL_out clock without creating a hangup while waiting for the correct status of bit 0 of MAINCLKUEN. If real, this timing aspect is undocumented (or at least I have not been able to find it).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The question to the LPC1227 gurus is whether there is a relationship between the amount of time the CPU spends in DEEP SLEEP and the inability to re-instate clocks afterwards. My issue is not a pure programming error because most of the time it works fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Vimes&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:02:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/AN11069-Why-reboot-after-leaving-DEEP-SLEEP/m-p/526024#M8657</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: AN11069: Why reboot after leaving DEEP SLEEP?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/AN11069-Why-reboot-after-leaving-DEEP-SLEEP/m-p/526025#M8658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by SimonWakley on Tue Aug 18 05:36:02 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;OK,&amp;nbsp; I am Deep Sleeping at 100 Hz with no issues, but I don't directly change the clocks, just run the watchdog clock when asleep to wake me up, and use the PDAWAKECFG to configure what turns on.&amp;nbsp; I disabled the BOD and now when I wake up everything works fine. I timed the wake up and it was longer than expected but seems to be OK however it never hangs. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Did you have to disable the BOD?.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am actually using the third sleep level which is "POWER DOWN" - "DEEP SLEEP" works too, just I get better power saving by going more asleep.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good Luck,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Simon&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:02:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/AN11069-Why-reboot-after-leaving-DEEP-SLEEP/m-p/526025#M8658</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:02:42Z</dc:date>
    </item>
  </channel>
</rss>

