I understand the functioning of the CyPmSleep() just the other way round: It will wake you up when an LV situation occurs. Just for giving you a bit of time to do the absolute needed (STOP Motors!!! Freeze pins).
Since you cannot remove the LV situation which will still exist when woken up, you will be in need to cancel LV monitoring by software until power is restored back again.
The system reference guide in the documentation part of Creator
has a lot of notes regarding power control functions and exceptions.
Maybe take a look at that to see what your code does not reflect.
Let's go on, as I've cooked the omelet but not eaten it yet!
With a slight modification of the boards, I'm now able to put the proc in sleep and wake it up correctly (thru a pushbutton for the moment). This is great.
I'm now fighting against consumption.
The DMM is connected in series with all the Vddd/Vdda/Vddio pins. This way I'm sure to monitor the PSoC5LP current.
I've stopped all the unnecessary blocks (xxx_Stop() : USBFS, 4xUART, EEPROM), and switched all the output pins as HZ digital input to avoid any sourcing current. All the com cables have been disconnected from the board. All the leds switched off (these pins have not been switched in HZ, but left totem pole).
I've kept the RTC running + a few logical blocs that can't be stopped by software (Debouncer, Status Reg, Global Signal).
In sleep mode the PSoC is drawing 6mA. Well, for a 2032 coin cell, this is approximately 25 hours, far away from what is expected.
I've slowed down the IMO before entering sleep mode, swtiched the JTAG pins to GPIOs, and removed the Miniprog once flashed.
I'm becoming crasy because I can't find the component which is drawing this amount of current.
What other way I should explore ?
One more question: would it be better to put the output pins as HZ analog input instead of digital?
I presume you have seen this and followed all recommendations ?
http://www.cypress.com/?rID=64554 AN77900 - PSoC® 3 and PSoC 5LP Low-power Modes and Power Reduction Techniques
Also note there is a power estimator spreadsheet at bottom of the above ap notes page.
http://www.cypress.com/?rID=43337 AN61290 - PSoC® 3 and PSoC 5LP Hardware Design Considerations
I read again (and again) and switched off the outputs to HZ analog inputs as per AN61290 stating "If a GPIO, SIO, or USBIO is not used, it should be left floating and in the high impedance analog state..."
May be some few µA less, but not significant.
Then I killed the USB self-powered bloc (and commented the corresponding lines of code) => went down to 1.5mA (I guess the corresponding 2 IO automatiquely shifted in HZ at recompilation).
This is more than a 2/3 cut! A comment here : putting the USB block in Stop() mode didn't significantly lower the consumption, w/o the com cable. More than 4mA : this is far away than what the datasheet mentions : IUSB_Suspended 300µA for 5V, cable disconnected. Any comment on this?
This is becoming a soap...
I reintegrated the USB block and used the 2 API functions _Suspend() and _Resume(). I got the same consumption 1.5mA which is currently my best.
I've dug a little bit deeper tracking those precious hundreds of µAmps without success. There is still a leak somewhere but hard to find it.
I'm gonna review the component datasheets, may be using Sleep or Suspend instead of Stop would give me more luck.
See you soon.
Just a thought but create an empty project with just the sleep
command and see if the power makes sense, if not something about
HW lashup that is at issue. You would still have to observe notes
in ap note and system reference guide.
Also maye a quick check of your meter with a simple R attached to Vdd,
see if meter makes sense when measuring current.
I tried your inquiry:
// CyFlash_SetWaitCycles(3); // Reduce clock
CyPmSleep(PM_SLEEP_TIME_NONE, PM_SLEEP_SRC_NONE); // Forever
With or without reducing the clock, still 1310µA (fluctuating 3 lsb) on my other DMM (the 1st one says 1.43mA).
All pins in Analog HZ, no components, no PLL, no USB, ILO set to 1kHz, no XTAL 32kHz.
Will check another board.
Michel, can you please post that project to have a look at?
Dana & Bob,
Thx for the help. No DVK used, it's a proto board.
May send you the project & schematics but I'm under a NDA with my customer.
Can only send by private mail which means I need your respective addresses.
You may join me at email@example.com
I was not thinking of your companie's project, but as far as I understood you, you have built a rather small example that already used quite more current than expected. This is what I'd like to see uploaded to check every setting.
This is a rather small one...