Hi,
I have to write software for psoc 3 which is going to sleep (~uA consumption) for dozen of milliseconds, few times per second. Each time it has to be different value of sleep time.
I'm was surprised that i'm expecting some many problems with such case in PSoC3...
my program should looks like this(pseudo code):
while(1){
GoToSleepFor(5ms)
DoSomething()
GoToSleepFor(100ms)
DoSomething()
GoToSleepFor(1ms)
DoSomething()
GoToSleepFor(800ms)
DoSomething()
}
Problem is with CyPmSleep which:
1. It does not accept any other delay then power of 2 (2,4,8,16ms..etc)
2. When I mix different intervals i need to wait more or less one interval to be sure that next, same interval will be fine (as it's written in system documentation). Documentation is right - when i'm mixing intervals then times are way different than it is expected.
RTC can be used only for intervals >1second.
Is there no way of doing this?!
I was thinking about putting an extra timer (internal) into psoc and connect it to 32kHz clock from external oscillator but i dont know how to make it work during sleep:
1.timer would have to work when everything else is sleeping (~uA consumption)
2.somehow signal from this timer has to wakeup psoc3.
Other workaound is to always go to sleep for 2ms.Sometimes for hundreads of times - 400x when i want to sleep 900ms. But this doesnt look like proper way of doing it.
ps. using externals signals or devices to wake up is not accpetable...
ps2. its battery powered and every uA counts.
I would appreciate some advice/hint
Thank You in advance for reply!
|