I have two identical ATMega328P-PU chips. Both sleep unless wakened on digital pin 3 (INT 1). One chip has power, the other one does not. The chip with power can send a signal when awake via digital pin 9 (PCINT1) to the digital pin 3 (INT 1) of the second (un powered chip) to wake it.

Everything works great. No problems.

When I put an ammeter on the power to the chip with power I see ~ 35mA wake, ~12mA sleep. If I disconnect either the pin 3 - to pin 9 or the serial RX - to - TX wires my readings are

~0.1mA sleep and ~ 22mA wake. Please keep in mind digital pin 9 is HIGH only when the powered chip is awake. When it sleeps all pins (that are output) are low.

I am a beginner so please bear with me if this question is basic.

It appears to me even though the second (un powered) chip is not on. some how it can draw amperage from another chip even if the wires connecting are LOW.

My goal is power savings so obviously a 22mA cost vs. 0.1mA is an issue for me.

You should "never" connect an unpowered MCU to other circuits with power. The BIG issue that that every GPIO pin (except RESET, which is not a standard GPIO) has input protection diodes to Vcc. If you apply a signal to the unpowered MCU, it will try to start using the power it can get from that input signal through the internal protection diode. Besides the limited current capability of those diodes and the inherent voltage drop, the MCU may not even have time to boot up before the signal goes away.

OK, I'll bite: How do you "awaken" an "unpowered" chip via a signal on a common pin?

I kind of question your whole approach. Let's start with the choice of two microcontrollers, apparently "nearby". As you have seen, you immediately start adding a lot of complexity, along with board space and cost, versus using a single microcontroller.

[We haven't yet seen schematic/wiring diagram/picture. We haven't seen the complete test programs that show the symptoms. We don't know language or toolchain or version or optimization settings. We don't know which clock source the AVR's use. That said, UART "rides high" when idle and my guess would be parasitic power through the UART. Obviously, when "unpowered", one can turn off the UART and invoke PRR for it.]

Why try to "unpower" the second unit, vs. a deep-sleep mode?

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.

As mentioned earlier, this is expected operation. Each gpio pin has protection diodes to vss and vdd. So power is sneaking from your powered avr to the gpio pin of the unpowered avr then via the protection diode to vdd and powering the avr. Solution: set the output low.

So that's probably it then. Even when the powered AVR is asleep, the TXD pin will ride high, so VCC is being provided to the unpowered AVR via PD0/RXD, and (when 'pin 9' is low) GND is being provided via PD3/OC2B.

Very bad juju.

Answer: disable the USART on the powered AVR and make it an output low before going to sleep.

"Experience is what enables you to recognise a mistake the second time you make it."

Yup. That seems to have done it. When both MCUs are connected to VCC and GND this problem goes away even with out mucking with the USART settings. When VCC and GND are not common the second MCU seems to suck amps from the first even though it has no power attached.

Thank you all for the help!!

I am going to read up more on how these pins and their diodes work and how the UART / USART work.

I am a new AVR programmer. I am learning alone out of books, the Internet, etc. Please excuse me if I ask simple questions. Thanks.

Yup. That seems to have done it. When both MCUs are connected to VCC and GND this problem goes away even with out mucking with the USART settings. When VCC and GND are not common the second MCU seems to suck amps from the first even though it has no power attached.

Well, no.

Your goal was to test what happens when the battery dies on one of them.

What you found was that the unpowered AVR was pulling power from the (asleep) powered one. The reason is that the USART on the powered one was still enabled in sleep, keeping TXD (pin 1) high, thus powering the unpowered one through the protection diodes on RXD (pin 0).

The solution is:

1) disable USART before sleeping, make sure pin 0 is output low

2) make sure any other connected pins are held low

3) ensure all GND pins on both are all connected to the common circuit ground

My advice to connect all power pins (VCC and AVCC) was not to suggest that both MCU needed to be connected to the same VCC. Only the GND need be shared. If you connect the VCC of the two MCU together, that hardly resembles the system you're trying to test.

Bottom line: If VCC is 'off' i.e. battery dead, the MCU will remain powered >>if<< any of the input pins are held high. That's what's happening with the USART staying enabled on the other (sleeping, powered) MCU. You must disable it before sleeping.

"Experience is what enables you to recognise a mistake the second time you make it."