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?
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 -
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.
I assume 1 pps is external, GPS, so use a pin for wakeup via the PICU, discussed
Note there is a sleep timer project you can look at. Open Creator, "File", "Example Project",
pick keyword sleep.
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.
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
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