32Hz Wakeup From Deep Sleep

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

32Hz Wakeup From Deep Sleep

1,650 次查看
sambennett
Contributor II

Hi,

I'm would like to  use an LPC54114 to sample several serial sensors at 32Hz. For power savings, I'd like to put the LPC into deep sleep in between each sample, to get current draw down to <200uA. The LPC is in charge of the sample timing, so I cannot just wait for a data ready signal from one of the peripheral sensors. I'm using the built-in RTC with a 32.768kHz crystal. The issue I'm having is that I cannot figure out a way to generate a 32.0Hz (31.25ms) wakeup from deep sleep, as it seems there are only a limited number of peripherals that can stay on in deep sleep (see attached Table 194 from the user's guide). I guess my question is: am I missing something? It does not seem like this should be a very difficult task to accomplish but none of the options I can think of seem very straightforward.

Options I've considered but do not seem like they will work

  1. RTC -- The 1kHz wakeup could be used, but it can only generate wakeups at 1ms intervals. For legacy reasons, I would prefer to keep the sample rate at exactly 32Hz.
  2. Micro-Tick Timer -- This timer technically could do what I need, but because it can only be clocked from the Watchdog Oscillator it can drift by +/-40% which is too much, even if I synchronized it at the beginning of every RTC second.

Options that might work but I'm not sure if they are possible

  1. Leave FRO on in deep sleep -- Apparently this is possible (see attached Table 193). However I don't fully understand what the functionality of this would be. If the FRO is on (at the cost of 100uA) does that mean I could use a peripheral that is clocked by it, such as one of the CTimers, the MultiRate Timer or the SysTick timer? My understanding was that in deep sleep all these were forced off.
  2. CLKOUT Pin wired to a pin interrupt -- I have not tested this, but it seems possible (see attached Fig 8 -- clock distribution diagram from the user's guide) that I could configure the CLKOUT source to be the RTC clock, select a divider of 256 (for output freq of 128.0 Hz) and output this signal onto P0.21. I could attach this to another pin configured as a pin interrupt and then sample every fourth time it fires. 
  3. Achieve <200uA current draw without deep sleep -- By reducing the clock rate could I achieve the power level I want while using sleep mode? The issue then seems to be that if I were to switch the MAIN_CLK to, say, the 32K_CLK I would not have a consistent clock source to time the sample intervals with.

pastedImage_2.png

pastedImage_4.png

pastedImage_5.png

标签 (2)
0 项奖励
回复
5 回复数

1,389 次查看
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Sam,

I think the best option you have is to use the High-resolution/wake up timer. The High-Resolution/Wake-up timer is a 16-bit down counter which is clocked at a 1kHz rate when it's enabled.  I recommend you checking chapter 18 of the user manual. 

pastedImage_1.png

pastedImage_2.png

Regarding your options that might please see my comments below.

1.- Leave FRO on in deep sleep. You are correct, all the timers that you mentioned are forced off when you enter into deep-sleep mode.

2.- CLKOUT Pin wired to a pin interrupt. The problem with this option is that the MCU will wake up each time it detects the pin interrupt, you cannot configure the MCU to wake up until the fourth time that the pin interrupts occur.

3.- Achieve <200uA current draw without deep sleep. First I would recommend you to try the option I mentioned before. Waking up the MCU with the High-Resolution/wake-up timer.

Hope it helps!

Victor.

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

1,389 次查看
sambennett
Contributor II

Hi Victor, 

Thanks for the input. I've been using the 1kHz RTC timer to wake up the processor from deep sleep, and then using one of the Ctimers to generate the sub-millisecond portion of the sample interval (31.25ms sample interval).  This works ok if I re-sync with the 1Hz RTC timer at the start of each second (to avoid errors in the sample interval from stacking), but I was really hoping there was a solution where I could use a free running timer, one that does not have to be restarted after each sample interval.

Thanks for the suggestions,

Sam

0 项奖励
回复

1,389 次查看
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Sam,

I'm not sure that I got your idea correctly. You are using the 1KHz RTC timer to wake up the processor, this part it's clear. About the Ctimer, you are using it to determinate when to sample the sensors? What about the 1Hz RTC timer, for what are you using it? 

Regards,

Victor.

0 项奖励
回复

1,389 次查看
sambennett
Contributor II

Hi Victor,

I'll try to describe my current setup:

0) t = 0ms: 1Hz RTC interrupt fires. Start 1kHz RTC countdown timer for 31ms. Read a sample from external ICs. Go to sleep

1) t = 31ms: 1kHz RTC interrupt fires. Wait for 250us Ctimer delay to expire. Start 1kHz RTC countdown timer for 31ms. Read a sample from external ICs. Go to sleep

2) t = 62.25ms: same as step 1

3) repeat step 2 29 times

4) 1Hz RTC interrupt fires and the whole cycle restarts

Since the 1kHz RTC interrupt has to be restarted each time it is used, I am using the 1Hz RTC timer to keep the sampling synced to the start of each RTC second. I was worried that the time it takes to service the 1kHz RTC interrupt and restart it for the next sample would eventually stack up so a sample would not occur at the start of each second.

I hope this helps,

Sam

0 项奖励
回复

1,389 次查看
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Sam,

Sorry for the late reply. Since your application has very strict time windows, to avoid that the sample does not occur at the start of each second, the best option is to measure the time that it takes to service the 1kHz RTC interrupt and restart it for the next sample.  Once you have this time you can subtract it to the CTimer interrupt.

Also, I don't know if you have considered the wake-up time of the MCU depending on the low power mode that you are using, this will also affect your time window. I recommend you checking the application note AN11799, here you will find the wake-up times for all the power modes and also the explanation of how can you measure your wake-up time in your application.

Link to the application note.

Hope it helps!

Regards,

Victor.

0 项奖励
回复