jerry1111 wrote on Sunday, November 02, 2008:
Because I want to put the processor to sleep for several seconds (might be any number between 1 and 60), then I’m planning to use deep-sleep mode. In this mode all the peripherals except 32kHz clock will be powered down. The processor will not wake up by an interrupt, because with all peripherals disabled there will be no interrupts.The only working thing will be RTC, and that can wake the processor up.
Because waking up might take some time (haven’t checked yet - based on datasheet) then I don’t want to do it in idle task - it won’t be power-efficient (time to switch off everything and then switch it back on again 100x a second is probably not a good idea). However I will consider using just sleep mode (cpu off, timers working) in idle task with hope that it will help to reduce energy consumption by additional 10-20%. I can see that being useful when waiting for all peripherals to finish. But the highest priority is to put this thing to sleep for several seconds.
The idea of idle task polling a set of flags (static variables presumably) to check if every thread has finished seems like the only sensible idea (without adding semaphores).
Thanks for advice - really helpful. But please don’t look at this as a closed issue! Someone might come up with another interesting idea!
I’ll try to implement it this week - will tell how it behaves
Oh, and one more thing: the idle task is just a normal task, but it’s not allowed to use blocking OS calls? And when it’s doing something and it gets interrupted in the middle, then it will resume at the same point when everything’s finished?
Or is it behaving in a different way?