2
\$\begingroup\$

I’m planning on constructing a circuit like the one below as a way to reduce quiescent current draw from the components in series with the transistor T1 (n-channel MOSFET). There will be several components in series with T1 such as sensors, RF-transceivers and a MCU, but to keep things simple my focus for this question is the GPIO connection P1-P2 between the MCUs.

If both MCUs have power I can configure P2 as input and it would seem that the high impedance will prevent any damage from occurring. But what if the transistor T1 is turned off? Extrapolating from what I found during my internet research it would then seem to be unwise to set P1 as output low, since this would cause MCU2 to start pushing a substantial current through P2, possibly powering up MCU2 in the process.

Assuming the above is correct, there are still several other possible configurations for which I could find no clear answer. Thus, under the assumption that the transistor T1 is off, my questions are:

  1. What would happen if P1 is set as output high?
  2. What would happen if P1 is set as input low?
  3. What would happen if P1 is set as input high?
  4. Would it be beneficial to use an optocoupler or something similar between P1 and P2, to separate the MCUs and reduce possible leakage current?

If my questions do not have a general answer, please assume MCU1 is ATtiny13a and MCU2 is ATmega328p.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • \$\begingroup\$ Why not put the ATmega328p into power-down mode, disable the watchdog timer, and use a wake-up on pin change method to stir it back up? I think the datasheet says that's about 100nA of current. I just looked at the datasheet and it seems to say that in power-down mode the pin change wake-up does work. And I don't think the watchdog is required for it, either. But that's from a few seconds scanning the sheet. Still, why not? \$\endgroup\$ – jonk Sep 17 '16 at 13:05
  • \$\begingroup\$ Good thought. However, I'm actually going to use more components than just the ATmega328p, some which have sleep current in the milliamps, so I'll have to find another way to reduce the current. I left the other components out for clarity. \$\endgroup\$ – Anders Sep 17 '16 at 13:22
  • \$\begingroup\$ Okay. I couldn't tell, from the question. \$\endgroup\$ – jonk Sep 17 '16 at 13:23
  • \$\begingroup\$ The additional circuitry will matter to a good answer. It may help to provide more details in your question. \$\endgroup\$ – jonk Sep 17 '16 at 13:25
  • \$\begingroup\$ I've added some more details about the other circuits. The project is still in the planning phase, though, so I'm still not sure exactly what will be in it. \$\endgroup\$ – Anders Sep 17 '16 at 13:46
1
\$\begingroup\$
  1. Output high: you would place 3.3V at an input pin with a floating ground. Not recommended.

    1. Input high: Assuming you mean input with pull-up enabled. Less problematic than output high, as the pull up is about 47k Ohms. Less current can flow, still not recommended.

    2. Input low: Also not recommended. Not sure of AT MCU use pull-down resistors, but it would provide a 47k Ohm path to ground. The switched chip will have a ground through its low side ESD diodes. But current limited. It may brown out or other effects.

  2. Similar to 2, as the optocoupler will need a pull up or pull down to the input pin. Only difference is that current would flow through the optó and not the master mcu, protecting it's pins.

Worst case, output low, you power the mcu through the master, and it could cause too much current leading to a rise in the masters low level output voltage, or burning out both pins if current is too high.

Solutions: Use a suitable, logic level P-channel mosfet on the high side of the target mcu. Or use the reset pin of the target mcu. Or use low power states with its input pin as a "enable" pin.

Or use a series resistor between both pins to limit any current between them. A 100 kohm resistor should be sufficient.

\$\endgroup\$
  • \$\begingroup\$ OK, thanks for the answer. Some follow up questions: 2.1: I assume that the problem with a floating ground is that it could in theory assume a completely arbitrary potential? Wouldn't that also be a problem with a floating VCC? (i.e. why is floating ground worse than floating VCC?) 2.2: When using a high side p-channel MOSFET, the new worst case would be setting P1 as output high while the MOSFET is off, right? \$\endgroup\$ – Anders Oct 24 '16 at 17:39
  • \$\begingroup\$ 2.3: Regarding the optocoupler, my plan was to connect the MCU2 side of it only to two GPIO pins on MCU2 (one input pin and one output pin). There would thus be no direct connection between optocoupler and VCC (which I think was the situation you described?). With no direct VCC connection, I think the only time the optocoupler can make an input voltage appear on MCU2 is when MCU2 is supplying a voltage to it (through the output GPIO), regardless of what MCU1 is doing. Would this still be problematic? \$\endgroup\$ – Anders Oct 24 '16 at 17:40
0
\$\begingroup\$

What would happen if P1 is set as input high?

The pin (or any other pin on P2 at GND level) will reverse-power the chip. The deblocking caps will charge up and at some point the chip may start running - at low voltage level (= brownout) conditions. This may erase/modify parts the flash content, if the brownout reset was disabled.

This could happen on all I/O pins on P2, which is why you usually switch the VCC off with a p-channel MOSFET.

\$\endgroup\$
  • \$\begingroup\$ Hmm... you mean that MCU2 will become reverse-powered, right? Would current then flow from VCC on MCU2 to P2 to P1 to GND on MCU1? So the high impedance when P1 is input would not limit the current sufficiently? Would this apply to question 1 and 2 as well? \$\endgroup\$ – Anders Sep 17 '16 at 15:32
  • 1
    \$\begingroup\$ Switching VCC off is not enough either -- you can reverse power CMOS chips through the upper ESD diodes, with Vcc completely disconnected (this actually led to me killing a BJT on a LCD module by way of an nigh unavoidable hotplug situation as a result of this) \$\endgroup\$ – ThreePhaseEel Sep 17 '16 at 21:04
0
\$\begingroup\$

If you want to save power consumed by MCU2:

  1. Control the reset line of MCU2 from MCU1. MCU2 will consume only leakage current in reset. Remember that there also is a built-in pullup resistor on the reset line, so when it is held low it will source some current.
  2. Put MCU2 into power-down mode. The 328P consumes typically 0,1uA in that mode(table 29-8)
  3. Use a proper load switch - examples
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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