AN11069: Why reboot after leaving DEEP SLEEP?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

AN11069: Why reboot after leaving DEEP SLEEP?

1,524件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by OldManVimes on Mon Aug 10 20:43:18 MST 2015
Hi support,

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?

Detailed questions:
- Why does the application note do this? Is it simply an oversight or is there a problem with the re-initializing of clocks?
- 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)?

My application:
- Runs on the IRC + PLL to get to 24 MHz CPU clock
- Switches to the IRC input, followed by the lowest possible WDT clock for DEEP SLEEP
- Always wakes up nicely from DEEP SLEEP (so the WDT clock is running after waking up)
- Switches on a GPIO LED
- Hangs in the re-initialization of clocks (sync on locking the PLL + switching to the PLL clock source)

Thanks,
Vimes
ラベル(1)
0 件の賞賛
返信
3 返答(返信)

1,312件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by SimonWakley on Tue Aug 18 05:36:02 MST 2015
OK,  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.  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.

Did you have to disable the BOD?. 

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.

Good Luck,

Simon
0 件の賞賛
返信

1,312件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by OldManVimes on Sun Aug 16 15:35:25 MST 2015
Hi Simon,

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:
__WFI();
NVIC_SystemReset();
// NOT REACHED


So I want to know whether there is a documented approach to NOT reset the CPU, but to re-instate all clocks and peripherals.
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).

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.

Kind regards,
Vimes
0 件の賞賛
返信

1,312件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by SimonWakley on Tue Aug 11 10:46:05 MST 2015
Hi,

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.  If you disable the BOD reset, then it might not.  I am going to investigate the PSU to see if the Wake Up surge was upsetting it.

Also it is a good idea to put a 5 second delay in the start up  before you set the sleep mode so that if you brick it, you can reset and then re-flash :-)

unsigned int nWhy = LPC_SYSCON->SYSRSTSTAT;

if ((nWhy & POR_RESET) == POR_RESET)
printf("\nRESTARTED POR!!!");
else if ((nWhy & EXT_RESET) == EXT_RESET)
puts("\nRESTARTED EXT!!!");
else if ((nWhy & WDT_RESET) == WDT_RESET)
puts("\nRESTARTED WDT!!!");
else if ((nWhy & BOD_RESET) == BOD_RESET)
puts("\nRESTARTED BOD!!!");
else if ((nWhy & SYS_RESET) == SYS_RESET)
puts("\nRESTARTED SYS!!!");
else
printf("\nRESTARTED - 0x%04x\n", nWhy);

LPC_SYSCON->SYSRSTSTAT = 0x1F;// Clear them all
0 件の賞賛
返信