# P-Channel MOSFET power selector question

I've seen this circuit used in several ESP32 designs (e.g. the Sparkfun ESP32 Thing) and in an answer on this site that allows a device to be powered by either 5V from a USB connection or a battery. V_OUT shown in the schematic usually goes to an LDO to convert 5V to 3.3V.

I'm clear on what happens when just the USB is connected: power goes from VBUS through D1 and out V_OUT. The p-channel MOSFET M1 is open.

When USB is not connected and a battery is, the 10K pulldown resistor pulls the MOSFET gate to 0V, and current flows from V_BATT through the MOSFET's body diode which causes the voltage at V_OUT to be higher than the gate, so the MOSFET channel closes and conducts (I hope this is the correct interpretation of events, please correct me if I'm wrong).

What I don't understand is what happens when both the USB and V_BATT are connected simultaneously. I expect the gate voltage to be high enough that the MOSFET channel doesn't conduct, but I also expect some current to flow through the body diode from drain to source. Is this what happens? Is this in some way bad or harmful to the circuit?

If I wanted to create a circuit to switch between one or the other supply exclusively, but prefer the supply tied to the gate (i.e. VBUS), is a p-channel enhancement mode MOSFET the correct part to use?

simulate this circuit – Schematic created using CircuitLab

• Source tied to gate. Methinks you muddle and muddy your question by mentioning the (power) source and gate (of a MOSFET that also has a source pin). Dec 14, 2021 at 8:40
• @Andyaka Yep. Reworded for clarity.
– par
Dec 15, 2021 at 3:25
• M1's body diode is reversed bias when both USB and battery are connected. It requires 0.3V forward to conduct. Dec 15, 2021 at 3:27
• @DKNguyen Of course! That makes a lot of sense. There are so many nuances to consider here.
– par
Dec 15, 2021 at 3:40
• @par My bad on the last sentence. D1 is the one that requires 0.3V because it is a Schottky. The body diode requires more so if D1 is conducting then body diode gets reverse biased. Dec 15, 2021 at 3:43