Go Down

Topic: Power Down consumption on custom board (Read 7 times) previous topic - next topic

estratos

Feb 28, 2011, 01:02 pm Last Edit: Feb 28, 2011, 01:11 pm by estratos Reason: 1
Hi,

On a custom board, consisting in an Atmega328P and some few passives, I want to check the current consumption of the board in Power Down mode. The only pull-up resistor is the 10k one for the reset circuit. Then there are a number of de-coupling capacitors, that's all. No external crystal used. The atmega is running at 8 MHz internal RC clock, 3.3VDC, BOD disabled.

I've picked some ideas from this post:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1285656727/5

So I've created a very simple sketch that puts the atmega in Power Down State:

Code: [Select]

#include <avr/power.h>
#include <avr/sleep.h>

void setup()
{                
 byte i;
 
 // Ensure no floating pins
 for(i=0; i<32 ; i++)
 {
   pinMode(i, OUTPUT);
   digitalWrite(i, LOW);
 }

 // Power-down state
 set_sleep_mode(SLEEP_MODE_PWR_DOWN);
 sleep_enable();
 // Disable functions
 power_all_disable();
 // Enter sleep mode
 sleep_mode();
}

void loop()
{
}


The issue is that I was hopping to see some few microamps entering the board but I'm finally monitoring 105 uA after entering the Power Down state. Being the circuit so simple I wonder whether I'm entering the low-power state and disabling the functions correctly... On the other hand, I'm now checking the possible leakage through the de-coupling capacitors.

Thanks in advance for your help.

Daniel.

48X24X48X


estratos


Hi,

Is there any 3.3 V regulator?


No, I'm directly powering the board from an external power supply.

Thanks.

Coding Badly

Quote
BOD disabled


Disabled by fuse settings?

Quote

 // Ensure no floating pins
 for(i=0; i<32 ; i++)
 {
   pinMode(i, OUTPUT);
   digitalWrite(i, LOW);
 }


There are no definitions for pins 20 through 31 and neither pinMode nor digitalWrite check for an out-of-bounds pin number.  Change the for condition to "< 20".

Quote
// Disable functions
 power_all_disable();


I vaguely recall that this function does not catch everything.  I can't remember the details so you'll have to search the forum.

estratos

Thank you very much for your response.


Quote
BOD disabled


Disabled by fuse settings?


Yes


Quote

 // Ensure no floating pins
 for(i=0; i<32 ; i++)
 {
   pinMode(i, OUTPUT);
   digitalWrite(i, LOW);
 }


There are no definitions for pins 20 through 31 and neither pinMode nor digitalWrite check for an out-of-bounds pin number.  Change the for condition to "< 20".


OK thanks. I copied that piece of code from an sketch written for the Atmega644...


Quote
// Disable functions
 power_all_disable();


I vaguely recall that this function does not catch everything.  I can't remember the details so you'll have to search the forum.

[/quote]

Indeed, removing "power_all_disable()" from the code does not add a single uA to the consumption so I've decided to directly work with the PRR register instead:

Code: [Select]

#include <avr/power.h>
#include <avr/sleep.h>

void setup()
{               
  byte i;
 
  // Ensure no floating pins
  for(i=0; i<20 ; i++)
  {
    pinMode(i, OUTPUT);
    digitalWrite(i, LOW);
  }
 
  // Power-down board
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
 
  sleep_enable();
  // Disable functions
  PRR = 0xFF;
 
  // Enter sleep mode
  sleep_mode();
}

void loop()
{
}


Unfortunately, the above changes still achieve 105 uA in the global consumption. I'm beginning to think that I have a damaged capacitor or a micro-shortcut somewhere on my board...

Thanks again.

Go Up