LPC11u68 - Can't Sleep after DeepSleep

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

LPC11u68 - Can't Sleep after DeepSleep

ソリューションへジャンプ
3,039件の閲覧回数
AnyTimeTraveler
Contributor II

Hi,

Normal Sleep after DeepSleep also causes the LPC11u68 to go into DeepSleep.

 

First I invoke the following to initiate DeepSleep:

SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; // Set the DeepSleep-Bit
LPC_PMU->PCON = PMU_PCON_PM_DEEPSLEEP;
__WFI();

I wake up from it with the RTC Alarm Interrupt.

Then I call the following to go into normal Sleep:

// Unset the SLEEPDEEP Bit and enable all Interrupts to cause a Wakeup
SCB
->SCR = SCB_SCR_SEVONPEND_Msk;

LPC_PMU
->PCON = PMU_PCON_PM_SLEEP | PMU_PCON_SLEEPFLAG | PMU_PCON_NODPD;
__WFI();

From that, I want to wakeup with LPC_TIMER32_0, but the Interrupt doesn't happen.

 

I have replaced the sleep with a busy-loop and the Interrupt happened.

I have also tested the normal Sleep code before a DeepSleep and everything works as expected.

(See Section 5.2.1.1 in the LPC11u68 User Manual, Page 64)

 

Thank you for taking your time to look at this

Simon

ラベル(1)
タグ(2)
0 件の賞賛
返信
1 解決策
3,006件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello,

 

Recommend confirm the demo with RTC wakeup can work well as your requirement , then change it to  TIMER32_0. 

 

 

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
3,030件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello AnyTimeTraveler,

How about first test and refer to the PMU demo under lpcopen?

 

BR

Alice

 

0 件の賞賛
返信
3,014件の閲覧回数
AnyTimeTraveler
Contributor II

I just did.

This example uses the RTC instead of TIMER32_0 to wake from the sleep states.

So I added the initialisation for the timer like this:

Chip_TIMER_Init(LPC_TIMER32_0);
uint32_t timerFreq = Chip_Clock_GetSystemClockRate();
Chip_TIMER_Reset(LPC_TIMER32_0);
Chip_TIMER_PrescaleSet(LPC_TIMER32_0, timerFreq / 10);
Chip_TIMER_SetMatch(LPC_TIMER32_0, 1, 450);
Chip_TIMER_MatchEnableInt(LPC_TIMER32_0, 1);
Chip_TIMER_Enable(LPC_TIMER32_0);
NVIC_ClearPendingIRQ(TIMER_32_0_IRQn);
NVIC_EnableIRQ(TIMER_32_0_IRQn);

And altered the code to skip the DeepPowerDown, so that the chip won't get reset.

 

When Chip_PMU_SleepState was called the second time, a match-interrupt from the timer should have woken it up.

Instead, the timer did not continue ticking during sleep (which is should have done and did during the first sleep).

I printed the timer values out before and after each sleep.

 

See this gist for the code and the log from the MCU:

https://gist.github.com/AnyTimeTraveler/b1d98047a093a75329153b23939cbfc2

0 件の賞賛
返信
3,007件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello,

 

Recommend confirm the demo with RTC wakeup can work well as your requirement , then change it to  TIMER32_0. 

 

 

0 件の賞賛
返信
2,964件の閲覧回数
AnyTimeTraveler
Contributor II

The demo works for me, even after changing it to use the timer.

I don't see a difference between my code and the demo, but there must be one.

 

Thank you for pointing me in this direction.

0 件の賞賛
返信