November 23, 2024, 08:56:34 AM

Sleep on pic32-pinguino-otg

Started by blinde, November 27, 2012, 02:38:24 PM

Previous topic - Next topic

blinde

Hi.
Trying to enter sleep mode with the pic32-pinguino-otg.

The power comes from a battery. So Voltage is around 14V

I call asm("wait").
By default the current is ~20ma

If I enable the sleep mode (OSCCONbits.SLPEN = 1)
The current is ~10ma

Is there a way to decrease the 10ma ?
Is it the voltage regulator that is drawing it ?

Thanks

Chris

maria_olimex

Hello blinde,

Here is some pinguino code that I've used in the past to put the PINGUINO MX220 to sleep. Please take a look at the schematic for the 220 to see what the pins I've set are:
https://www.olimex.com/Products/Duino/PIC32/PIC32-PINGUINO-MX220/resources/PIC32-PINGUINO-MX220-REV-A-SCHEMATIC.pdf

Setting some pins to output (and some exceptions to input) reduces power consumption.

Here is the code; it is for another chip, but a lot of things are pretty much the same across the pic32 family.


TRISA = 0x0000;
TRISB = 0x0000;
TRISC = 0x0000;
PORTA = 0x0000;
PORTB = 0x0000;
PORTC = 0x0000;
TRISA |= 0x0080;
TRISB |= 0x0380;


SYSKEY = 0x0;  // write invalid key to force lock
SYSKEY = 0xAA996655;  // Write Key1 to SYSKEY
SYSKEY = 0x556699AA;  // Write Key2 to SYSKEY
OSCCONSET = 0x10; // set Power-Saving mode to Sleep
SYSKEY = 0x0;  // write invalid key to force lock

asm volatile( "wait" );// put device in selected Power-Saving mode

while(1);


Best regards,
Maria/OLIMEX
Software developer at Olimex

blinde

Ok, thx.
I will try with this config.

Chris