Excessive current draw with mega169 - 329 - 649

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

It happens when the LCD is disabled and the MCU is not in power save mode. The fix is to set the port pins used for the LCD as outputs and drive them low. When the LCD is disabled these ports revert to normal I/O ports. If the software leaves these ports in their default state, the inputs are apparently floating and this apparently is what causes the high current draw.

This abnormal current wanders around. It can exceed 2 ma. Sometimes it is zero. When there is no excessive current draw, touching some of the LCD pins can get it started.

According to the data sheet, there can be no DC voltage on the LCD when it is disabled as this can damage the LCD. So there are only two acceptable ways to set up the I/O ports. Either "tri-state" or driven low. Using pullups is not an option. I guess the default for the I/O pins is "tri-state". I think the Atmel Butterfly code leaves them this way, so I did it also. This is apparently safe for the LCD but can result in abnormal current draw.

I suppose this excessive current isn't generally a big problem. The mega chip on the Butterfly is usually in the power save mode. There is no excessive current draw in power save. Apparently in power save, the pins are decoupled from the rest of the Atmega and don't cause a problem. I can see this high current draw when I have the USART running and the LCD disabled. To make the USART work properly, I need to use idle mode instead of power save mode. The current draw in idle mode with the USART enabled should be around 285 uA. On a good day, that's what it is, until I touch some of the LCD pins.

Usually when the current draw is very high, all or almost all the pins read as high. For instance port A reads as 0xff. Driving just one of the port A pins low usually diminishes the current considerably. Driving all the LCD common pins low (port A pins 3-0) usually cuts the excess current to a few dozen uA. But to eliminate it entirely all the LCD pins need to be driven low. I think that's all pins on ports A and C, port D pins 7-2 and port G pins 4-0.

Just to make it clear, you can set up all these ports to drive the pins low at startup. It won't affect the operation of the LCD. When the LCD is enabled, it takes over the operation of these pins so how you set them up as general purpose I/O pins doesn't matter. It's when the LCD is disabled and these pins revert to general purpose I/O pins that it matters how they are set.

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

Now, this is very interesting information. Perchance, would it be easier to just >>not<< disable the LCD? ;) After all, the processor is still running--how much extra current could it take to display all blank segments?

Lee

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:
Now, this is very interesting information. Perchance, would it be easier to just >>not<< disable the LCD? ;) After all, the processor is still running--how much extra current could it take to display all blank segments?

Lee

I've thought about that option but I think my solution is better. If the LCD is kept running all the time the current draw is around 28 uA when in power save mode. Without the LCD the draw diminishes to 2 uA for the "P" chips and 8 uA for the non-p chips. Quite significant for battery operation over the long term.

The Butterfly with the original code disables the LCD after a few minutes of joystick inactivity and that seems to be a good idea. The coin cell lasts for several years.

Another possibility is to enable the LCD whenever the USART is enabled. I'm sure there are other schemes as well, but thinking about it makes my head hurt. :)

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

I've seen an avr get hot.... evidently any input pin that gets pulled up to vcc plus one diode drop starts heating up the internal protection diode... so the lesson is... keep the inputs <= vcc

Imagecraft compiler user

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

Hi,

the problem you descirbe seems to be the so called "crowbar current".

--> don´t leave pins floating.
If all pins of an LCD are the same level (segments and backplane. either low or high) there are no problems.
So i recommend to set them all to the same level.

another option may be to pull them gently to VCC or GND. I think a 1MOhms per line should be enough.
for sure this causes additional current flow when the display is enabled.

Klaus
********************************
Look at: www.megausb.de (German)
********************************

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

MegaUSBFreak wrote:
Hi,
the problem you descirbe seems to be the so called "crowbar current".

I agree.

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

MegaUSBFreak wrote:
Hi,
If all pins of an LCD are the same level (segments and backplane. either low or high) there are no problems.
So i recommend to set them all to the same level.

Interesting. I think you are right. Now that you mention it, it would seem the pins don't have to be low, as long as all pins are at the same voltage.

Maybe you should write Atmel's data sheets, because their's says either tri-state or output low (sink). I was just repeating what the data sheet said.

I should have known I would get in trouble if I read the data sheet. :)

Attachment(s): 

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

MegaUSBFreak wrote:
another option may be to pull them gently to VCC or GND. I think a 1MOhms per line should be enough.
for sure this causes additional current flow when the display is enabled.

Now that we agree they could all be high, why not use the built-in pullups? I just checked the schematic for the Butterfly and it seems all the LCD pins are connected to Atmega I/O port pins, so either high or low would seem to do the job.

Actually I will probably continue to drive them low, unless there is a reason to do otherwise.