mega325 draws too much current in idle mode?

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

mega325, Ucc=5V; 4 mhz crystal
CKSEL = 1011, SUT = 10; CKOUT, OCDEN and JTAGEN fuses unprogrammed. My problem is consumption in idle mode - about 3 ma at 4 mhz with prescaler set.

I ran the following code and measured the consumption

#include 
#include 
#include 
int main()
{
cli();
CLKPR = 1<<CLKPCE;
CLKPR = (0<<CLKPS1)|(0<<CLKPS0);
_delay_ms(4000);

//set prescaler to 1:8
CLKPR = 1<<CLKPCE;;
CLKPR = (1<<CLKPS1)|(1<<CLKPS0);
_delay_ms(4000/8);

//set prescaler to 1:128
CLKPR = 1<<CLKPCE;
CLKPR = (1<<CLKPS2)|(1<<CLKPS1)|(1<<CLKPS0);
_delay_ms(4000/128);

// idle mode
PRR  = (1<<PRADC) | (1<<PRUSART0) | (1<<PRUSART0) | (1<<PRSPI) | (1<<PRTIM1);
set_sleep_mode(SLEEP_MODE_IDLE);
sleep_mode();
}

Current consumption is 6 ma while running at full speed, 4 ma with 1:8 prescaler and 3.3 ma with 1:128 prescaler. The problem is that in idle mode current cosumption is still 3.3 ma that exceeds maximum value for idle at 8 mhz and is way above typical 1.2 for 4 mhz, and this is with prescaler set to 1:128.
In standby mode consumption is about 0.12 ma, as in specs, so it's not like the crystal itself is faulty. Any ideas?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do you have some pin unconnected? I mean with a know logic state?
On the AVRs datasheet ATMEL advice to let all the unconnected pins to know logic level. Go to the I/O pins part of the datasheet, there are explanation about it.

Brunomusw

Regards,

Bruno Muswieck

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

brunomusw wrote:
Do you have some pin unconnected? I mean with a know logic state?

Thanks, it worked.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So, what did you change, and what are your new current draw readings?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:
So, what did you change, and what are your new current draw readings?

I turned on pullups for all unsed pins, and now it's 3.7 ma (full speed), 0.65 (one:eight prescaler), 0.17 (1:128) and 0.15 ( 1:128 idle )

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

On a side note to idle mode, I am using an atmega164 in sleep mode and the current consumption is an amazing 0.6uA. These Atmel engineers are good!