Counting pulse width during sleep

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
KrDe_284951
Level 4
Level 4
10 replies posted 10 questions asked 5 replies posted

 Hi,

   

 

   

In an power sensitive application, I would like to count the pulsewidth of a signal on a GPIO Pin while the PSoC3 is in sleep. The resolution doesn't need to be very high so the ILO clock @ 1kHz is more than sufficient.

   

I have the system working without the sleep enabled, using either the component COUNTER and TIMER. But  when entering sleep mode, using CyPMSleep(...), the counting process stops .

   

 

   

Note: with the first pin of the AND gate tied to "1" it doesn't work either.

   

Any suggestions how I can fix this?

0 Likes
7 Replies
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Some questions -

   

 

   

1) What is range of PW you are trying to measure ?

   

2) What is resolution you want in measurement ?

   

3) Accuracy of the PW measurement you are trying to make ?

   

 

   

Sleep shuts off most pof the chip, thats why counter halted.

   

 

   

Look at the following for help -

   

 

   

    

   

          

   

http://www.mymcu.ru/content/articles/Cypress/AN66083.pdf

    http://www.cypress.com/?docID=44199     AN77900   

 

   

 

   

Regards, Dana.

0 Likes
KrDe_284951
Level 4
Level 4
10 replies posted 10 questions asked 5 replies posted

 Hi Dana,

   

 

   

The range of de PW is not definable and can ranging from 100 ms to several minutes (or even hours). I use 1 PPS wakeup strategy where I can  cover for the longer PW's, so this is OK.  Most important is that I can keep the processor in a sleep state for 95% of the time  or more when counting PW's.

   

 

   

Regards,

   

Kris

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I assume 1 pps is external, GPS, so use a pin for wakeup via the PICU, discussed

   

in apnotes.

   

 

   

Note there is a sleep timer project you can look at. Open Creator, "File", "Example Project",

   

pick keyword sleep.

   

 

   

Regards, Dana.

0 Likes
KrDe_284951
Level 4
Level 4
10 replies posted 10 questions asked 5 replies posted

 Hi Dana,

   

 

   

The assumption is wrong. I'm familiar with waking my system using PICU / CWT / .... The 1PPS is the CyPmSleep(PM_SLEEP_TIME_NONE, PM_SLEEP_SRC_ONE_PPS );. which is used for management functions (e.g. managing potential overflows in the counter during very long pulses)

   

My PW measurement should preferably NOT wakeup the system or at least keep counting while the PSoC3 is in sleep mode for the duration of the pulse.Remeber that the PW can be very long.

   

When entering sleep, the COUNTER component apparantly has been put to sleep as well and I don't know how to keep this component awake while the rest has been put to sleep. From earlier power measurements, the alternative wake state is not quite an option.

   

 

   

Regards

   

Kris

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

AfaIk the digital blocks (except ff I2C) are switched off during sleep, so there is nothing alife that is able to count. A resolution of 100ms can only be managed by waking up with 10 Hz. Wakeup time is 15µs for a PSoC3, you just need to increment a memory location depending on the level of an input pin and go to sleep again. The 10Hz signal must be externally generated since the PSoC doesn't run

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Look at section 16.6 of CTW for sleep timer which operates in sleep mode,

   

as you can see from the sleep project referenced earlier. You could use this,

   

setting its rate that would control resolution of PW measurement, albeit poor

   

accuracy.

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Section 16.6 of TRM.

0 Likes