ROCKET SCIENTIST
Member level 3
Hi dear friends,
I'm working with an mega169a ultra low power version which is running arduino butterfly. On the datasheet it says, during power save mode the current goes down to 0.8uA.
Anyway, in my code I've shut down everything as much as I can remember, but still it won't go below 210uA. I turned off
USART, SPI, TIMER0, TIMER1, TIMER2, ADC, ANALOG COMPARATOR, need to keep the LCD turned on though.
then I set some of the floating pins as pulled up inputs and some of them as low logic outputs as per the peripheral circuitry connected to the mcu.
I suspected that in arduino usart0 and timer0 for millis are turned on be default, so I disabled them, but still the current isn't going low. I need help in this issue. Any possible suggestion or clues would be extremely helpful.
With Best Regards....
I'm working with an mega169a ultra low power version which is running arduino butterfly. On the datasheet it says, during power save mode the current goes down to 0.8uA.
Anyway, in my code I've shut down everything as much as I can remember, but still it won't go below 210uA. I turned off
USART, SPI, TIMER0, TIMER1, TIMER2, ADC, ANALOG COMPARATOR, need to keep the LCD turned on though.
then I set some of the floating pins as pulled up inputs and some of them as low logic outputs as per the peripheral circuitry connected to the mcu.
HTML:
*****************************
PM::PM()
{
SMCR |= (1<<SM1)|(1<<SM0); //configure as power save mode
}
PM::~PM()
{
}
//---------------------protected
void PM::pinConfig()
{
// LCD module will be running so, not touching PORTA & PORTC
DDRB = 0b10110111; PORTB = 0b01001000;
DDRD |= (1<<0)|(1<<2)|(1<<3)|(1<<4);
PORTD &= ~(1<<0) & ~(1<<2) & ~(1<<3) & ~(1<<4);
DDRD &= ~(1<<1); PORTD |= (1<<1);
DDRE = 0b01000001; PORTE= 0b10111110;
DDRF = 0b11000011; PORTF= 0b00111100;
DDRG |= (1<<3) | (1<<4); DDRG &= ~(1<<3) & ~(1<<4);
DIDR1 |= (1<<AIN1D) | (1<<AIN0D); DIDR0 = 0xFF;
PRR |= 0x0F;
}
void PM::cpuGoToSleep()
{
SPCR=0; //spi
ACSR|=(1<<7); //analog
ADCSRA|=(1<<7); //adc
ASSR=0;//async
TCCR2A=0; //rtc
TCCR1A=0; //tmr1
TCCR0A=0; //delay
SMCR |= (1<<SE); // enable power save option
asm volatile ( "SLEEP" "\n\t" :: );
}
//----------------------public
void PM::goToSleep()
{
pinConfig();
delay(2000);
cpuGoToSleep();
}
***************************************
I suspected that in arduino usart0 and timer0 for millis are turned on be default, so I disabled them, but still the current isn't going low. I need help in this issue. Any possible suggestion or clues would be extremely helpful.
With Best Regards....