4
\$\begingroup\$

Is it safe to drive the pins of this AVR chip while it's unpowered?

For example, if I were to share a motor driver such that it can be driven by two microcontrollers, would either microcontroller be damaged while the other is unpowered, but is seeing the signal voltages on its pins from the other microcontroller?

EDIT: Because this was marked as a duplicate, here is some clarification. The MCU specified here is different from a different manufacturer. Though I'm not sure, their operation and limits would most certainly differ. This question was not about wether it'll 'weaken' the MCU but about if its safe to do so in the first place. IMO weaken would mean that it is possible but over time it'll degrade the performance of the MCU.

\$\endgroup\$
3

7 Answers 7

17
\$\begingroup\$

You may be interested in EEVBlog's video about powering an MCU without connecting the power pins. If you drive the I/O pins on the MCU, you may end up powering up the MCU through its protection diodes.

If, after the diode drop, your VCC ends up being below or above the minimum voltage required to drive your MCU (or draw more current than the internal diodes can handle), then it will not operate correctly. Of course, this is assuming your VCC is open circuit and not shorted to ground (or zero volts).

Here is a diagram of the equivalent circuit for your Atmega328p:

enter image description here

Note the diodes from ground to VCC.

Either way, the datasheet does not explicitly specify the exact behaviour of driving the Atmega328p from an I/O pin.

However, it does say the absolute maximum voltage you can apply to an (non-nRESET) I/O pin is Vcc+0.5V. As mbrig pointed out in the comments, if you phantom power the chip, the diode drop will very likely cause the voltage on the I/O pin to be larger than Vcc+0.5V.

The data sheet states that operating the ATmega328p outside of it's absolute maximum ratings can cause permanent damage so I would recommend against it.

\$\endgroup\$
7
  • 2
    \$\begingroup\$ And if VCC is grounded, a voltage on the I/O pin would just short-circuit to ground, resulting in excessive current and possibly blowing at least the protection diode, right? \$\endgroup\$
    – ilkkachu
    Commented Mar 16, 2017 at 20:45
  • 6
    \$\begingroup\$ I downvoted because this situation isn't "unspecified", it's fairly clear from the datasheet: applying voltages >Vcc+0.5 (which must be true to phantom power the IC) to any pin violates the absolute maximum ratings and can damage the chip. \$\endgroup\$
    – mbrig
    Commented Mar 16, 2017 at 23:11
  • \$\begingroup\$ Got it. If I were to then keep the MCU powered, that would keep the I/O voltages within safe limits and that should be okay right? \$\endgroup\$ Commented Mar 17, 2017 at 2:24
  • \$\begingroup\$ @electrophile Check the data sheet against your design. If you're operating it within recommended thresholds, you'll be fine \$\endgroup\$
    – tangrs
    Commented Mar 17, 2017 at 4:26
  • 1
    \$\begingroup\$ Great, downvote removed! \$\endgroup\$
    – mbrig
    Commented Mar 17, 2017 at 4:54
9
\$\begingroup\$

From the datasheet:

ATmega328p datasheet: "Electrical Characteristics: Absolute Maximum Ratings"

The maximum voltage on any pin other than _RESET is specified as "Vcc + 0.5V". If the chip is unpowered, Vcc is 0, so no -- you cannot safely apply any voltage above 0.5V.

If you want to share an I/O between two parts, where one of them may be unpowered, you need some kind of switch.

\$\endgroup\$
3
  • 5
    \$\begingroup\$ Unpowered could mean open circuit and not nessecarily 0V \$\endgroup\$
    – tangrs
    Commented Mar 16, 2017 at 18:09
  • 1
    \$\begingroup\$ @tangrs True. The datasheet doesn't really account for that possibility, but it certainly doesn't say it's OK either. (And it definitely isn't.) \$\endgroup\$
    – user39382
    Commented Mar 16, 2017 at 18:13
  • 3
    \$\begingroup\$ Likely is that power rails will contain capacitance that would require charging to lift up the Vcc so "unpowered" is very similar to "at 0 volts". +1. \$\endgroup\$
    – Andy aka
    Commented Mar 16, 2017 at 18:16
5
\$\begingroup\$

No.

At the input of most pins on a device such as the AVR ATmega328 there are diodes to protect the chip from electrostatic discharge (ESD). These diodes connect to the supply rail of the device.

If you drive a logic signal into a pin when the device is unpowered it will attempt to power via the diode. This may not cause damage, but often it will affect the power-on-reset circuitry, so the device will not power up correctly when power is available. It is often a cause of unexpected power consumption in battery powered circuits.

You need to put in a multiplexer to select which MCU drives your motor driver or arrange that both MCUs are powered, but the one that is not intended to operate the motor keeps its I/O ports in a high-impedance state (e.g. as an input).

Typical MCU I/O port

\$\endgroup\$
3
  • \$\begingroup\$ I know that they can be configured as inputs through software, however, is there a way through hardware to put all the IO ports in high impedance state? \$\endgroup\$ Commented Mar 17, 2017 at 2:29
  • \$\begingroup\$ You could put tri-state buffers between the I/O pins of each microcontroller and the motor driver. You would arrange for the buffers to always be powered, but set the output-enable signal on the buffer accordingly based on which microcontroller is powered on. This is essentially the same hardware that's inside the MCUs' output drivers, but by breaking it out as a discrete part, you can control it separately from the MCU power. \$\endgroup\$
    – Jason R
    Commented Mar 17, 2017 at 2:34
  • 2
    \$\begingroup\$ If you hold the processor in reset all the IO ports should go high impedance (the data sheet explains what happens in reset). It will take time for the processor to startup when you release the reset. That may work for you though. \$\endgroup\$ Commented Mar 17, 2017 at 2:35
4
\$\begingroup\$

Unsafe for both AVR and the other MCU. The AVR will try to power up when the other MCU drives its I/O pin "high". Not good for AVR - it is meant to power-up from its dedicated supply pin. Bad things can happen otherwise. Since the manufacturer explicitly says "don't do this", the manufacturer is not obliged to say what "bad things" you might encounter. My experience is that "bad" ranges from very strange to smoke.
Since the AVR may look like a short-circuit to ground, the other MCU (trying to pull its output pin high) would encounter a heavy load. It may fail to pull as high as it should, and cause too much current to flow (putting it at risk).
At risk also is your motor driver, especially if it is PWM. Not knowing if it is to be "high" or "low" (somewhere in-between), it can overheat.
So you risk everything.

\$\endgroup\$
0
2
\$\begingroup\$

According to the spec Vih = VCC + 0.5 V so from that alone it's no.

However, if VCC is really "open", feeding the I/O pins will apply a phantom VCC to the device so it won't really be off, so that kind of negates the above issue, but it opens a whole new can of worms.

Even if the above were not an issue, there is no guarantee you will actually be ABLE to drive an I/O pin high when the device is powered off. You may find the output is extremely low resistance to ground.

The latter issue also applies to input pins too by the way. Assuming the chips VCC has decayed to ground, the input will represent a diode to a capacitor to ground on any signal you are trying to measure with the other device.

Basically... don't do it.

\$\endgroup\$
0
1
\$\begingroup\$

Although it is not in the datasheet, the rule of thumb is that the internal ESD protection diodes can have 1mA for a 8-bit AVR chip. The diodes allow more current, but the 1mA is the recommended maximum.
When a voltage divider is made with two resistors, this 1mA can be used to calculate the maximum allowed voltage for the voltage divider.

The Atmel Application Note AVR182 mentions the 1mA.

A positive current into a pin flows to VCC and could power the AVR chip and/or the circuit. That could result into unpredictable behaviour when the AVR chip is running near its lower voltage limit.
With enough voltage and current it could even raise the voltage far above 5.5V, and destroying the AVR chip. Especially when the AVR chip is in sleep mode. It is therefor dangerous to use, but it can be done.

Always be careful when applying voltages to a pin. Use a protection resistor to limit the current. That is also safer for normal operation. That means that when two AVR 5V chips are connected to each other, there should be 4k7 resistors between them to limit the current to about 1mA when one AVR chip has no power. Depending on the circuit, that 4k7 might influence the signals.

There might be even more consequences, I'm not sure that mentioned them all.

\$\endgroup\$
-1
\$\begingroup\$

Is it safe to drive the pins of this AVR chip while it's unpowered?

what's safe or not is relative.

phantom powering a device can be handy -> powering on demand basically. for example, you can have a set-up where the slaves are phantom powered and normally off. the master can send a few pulses on the transmission line to wake it up and once the transmission is over, the device goes off all by itself.

but as everything in life, it comes with its own risks that need to be recognized and managed appropriately.

so it is wrong to say categorically that phantom powering is a good or bad practice.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.