I tried a lot of different things, but nothing works really good.
1 digital Input with pullup (used for WakeUp Key)
1 digital Output on 3.2 PWM mode strong drive
If I try the following:
still I consume aprox. 670µA on 3.3V
But only if I run this after a fresh Power-On Reset.
If I start the PWM, and run then in the same Power-Off, i come to 1.8mA
How can I save more Power? The Hibernate-Mode don´t exists on this device.
In the Datasheet should be the Power-cosum in DeepSleep 4.5µA - this would be nice.
What must I do, to save the maximum power as possible. I will wakeup on Key-IRQ, I must not keep nothing in Ram - I can reinitialize all again.
To explain this a little bit mor deeply:
The Chip runs in 3,3V regulator mode.
If I run this program:
Mode == Off
if (Mode == Off)
Then the Chip consumes aprox. 328µA directly after Start.
If I start the PWM, and stop the PWM, to enter then in CySysPmDeepSleep();, the chip consumes 2,42mA in Sleep-Mode.
It looks, as the Processor don´t enter the sleep mode. If I go with the debugger through the code it enters the sleep mode and waits for the KeyPress to wake up.
So, I tried a other technique. 🙂
RunFlag = 0;
if (Mode == Off)
if (RunFlag) CySoftwareReset();
So, if I wake up I set in the ISR RunFlag=1, and after enter again the sleep mode, I make before a SoftReset(). But this also dont set the initial state like a PowerOn Reset. The Chip still consumes 2,42mA.
So - how can I set the Chip to DeepSleepMode() only for one wakeUp on GPio-Pin (H/L flank).
Can you please post your complete project, so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.
Sorry, this I can´t. The project is for a client and the code isn´t public.
One thing: I have a digital output (the only one) and this was set to the PWM. It´s Pin 3.2
Before I enter the SeepSleep mode I will set
to drive the Pin without leakage. But nothing happens... The pin still is driven by StrongMode.
Perhaps is this the Problem...
Is there a reason why you do not use PWM_Sleep()?
Why are you setting the pin to analog? I presume it is initially a digital output pin, set it to Motor_DM_DIG_HIZ
You probably know that debugging is consuming mAs.
Yes, Debugging consumes, but like you can see in my other post, I cant disable to GPIO, because I loose the chips 😞
If you disconnect the debugger, after a power-on reset the pins are disabled.
I don´t use sleep()/wakeup() because I don´t need the settings. I can stop directly like documented in the API.
I change to analoge HiZ, because its documented in the AN: "set all unused Pins to tristate." Thats what I tried.
The problem is, that after a clean PowerOnReset without starting the PWM I run in a SleepMode that consumes aprox. 328µA. This is not, what the datasheet (2,5µA) tells, but its pretty enough for me.
But if I run the PWM onces, I can stop but never I can go to DeepSleepMode.
I read also in the Documentation, if during call DeepSleepMode() the processor in a nonReady Mode the systems don´t enter the DeepSleepMode, instead the Sleep mode. And in Sleep it consumes >1.3mA.
So - it could be a reason that on component is not ready and I dont have permission to enter the DeepSleepMode.
In this case I hate the APIs, I like to programm in assembler or C++ native, to write directly to the registers of the processor.
It should be possible to write a 0 to all Power-Registers for all components to shut down, set all pins on tristate
, change the clock to loclk and wait on IRQ for the selected GPIO Pin.
Can anyone provide a document where I can found a real description of the processor? In example, the following line:
( *(reg32 *)(portPC) = (*(reg32 *)(portPC) & ~(CY_SYS_PINS_PC_DRIVE_MODE_MASK << ((pin) * CY_SYS_PINS_PC_DRIVE_MODE_BITS))) | ((mode) << ((pin) * CY_SYS_PINS_PC_DRIVE_MODE_BITS)))
sets very simple and clear explained the mode of the Pins. Why exists a lot of wrappers of this simple functions? This makes the complete project only more complex and longer... It´s very simple to programm the chip, if I know the registers and can program directly.
Create a new project showing the error which you can upload here.
but like you can see in my other post, I cant disable to GPIO, because I loose the chips 😞 This is not acceptable and points to a hardware problem on your board / your configuration. I would address this issue first.
You may create a support case and send your project to Cypress. They will keep it confidentioal.