Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 3 > Irregular sleep time

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



Irregular sleep time
Moderator:
RKRM

Post Reply
Follow this topic



Irregular sleep time

vac at work posted on 16 Nov 2011 4:38 PM PST
Senior Member
11 Forum Posts

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!




Re: Irregular sleep time

U2 posted on 21 Nov 2011 04:13 AM PST
Cypress Employee
589 Forum Posts

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. 



Re: Irregular sleep time

Bob Marlowe posted on 21 Nov 2011 09:34 AM PST
Top Contributor
1768 Forum Posts

Hi,

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

Bob



Re: Irregular sleep time

vac at work posted on 22 Nov 2011 01:50 AM PST
Senior Member
11 Forum Posts

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



Re: Irregular sleep time

U2 posted on 22 Nov 2011 07:51 AM PST
Cypress Employee
589 Forum Posts

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. 

 



Re: Irregular sleep time

U2 posted on 22 Nov 2011 07:56 AM PST
Cypress Employee
589 Forum Posts

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.






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: KXP; Secondary Owner: VWA; Sunset Date: 01/01/20