5 Replies Latest reply on Nov 22, 2011 9:56 AM by udayanu_

    Irregular sleep time



      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):


























      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!

        • 1. Re: Irregular sleep time

          I am afraid it is not possible to do it. I will enquire more about this. Please note that other than sleep timer timer no other timer can be kept awake during sleep mode operation. 

          • 2. Re: Irregular sleep time



            but you can in fact reduce the power consumption when you shut down (see sleep-APIs) all unused components. and re-enable them when your wait-time is over. This is not comparable to the sleep mode, but reduces by some µA.


            Afaik, an interrupt from a GPIO-pin can end a sleep-mode as well.


            Hope that helps



            1 of 1 people found this helpful
            • 3. Re: Irregular sleep time

              Thank You for answering.


              After Your response i think that i have to study more about alternative active mode in which any interrupt can wake up core.


              First thing is that i cannot find any examples about using alternative active mode. Can You recommend me some materials that show how to prepare to "sleep" (in alternate active mode) core and all peripherials that i need?


              And i'm wondering is it possible to put core to sleep in alternate active mode and wake it up using intterrupt from any  peripherial (for example timer) ?

              • 4. Re: Irregular sleep time

                Yes, as suggested by Bob Marlowe , you can alternate active mode as a quick option. Alternate active mode is a standby mode wherein you can turn of many of the peripherals and the PCU itself. In your case you can keep alive just a single Timer that needs to wakeup PSoC from Alternate active and put it into active mode. You can setup the timer to generate an interrupt after the required period, this interrupt will wakeup the device and put it back to active mode. Note that the power consumtion in alternate active mode depends on peripherals that are operational during this mode. 

                1 of 1 people found this helpful
                • 5. Re: Irregular sleep time

                  You can enter alternate active mode by calling the API CyPmAltAct(uint16 wakeupTime, uint16 wakeupSource). Please refer the power management chapter in system reference guide for more information on how to use this particular API. You can access it from PSoC Creator environment as follows, Help --> Documentation --> System Reference Guide. 


                  Please refer the Low power mode chapter in PSoC3 TRM for a detailed explanation.

                  1 of 1 people found this helpful