# Why is a resistor divider used on gate of P-channel MOSFET of discrete USB power path circuit?

I noticed this discrete power path circuit on the design of the ESP32-A1S Wi-Fi+BT Audio Development Kit:

Sorry, but unfortunately none of the designators are numbered and the resistors does not have values. I took the liberty of numbering them D1, Q1, R1 and R2. I have also explicitly indicated the body diode of Q1 (as pointed out by @Damien).

I understand the job of D1, Q1 and R2. When USB is disconnected, current is sourced from VBAT to VCC5V via the body diode of Q1. R2 pulls the gate of Q1 to 0V and Q1 switches on so that there is a much lower voltage drop than the body diode of Q1 (a.k.a. "ideal diode function"). When USB is connected Q1 is switched off and VBUS supplies current to VCC5V via D1 (with a regular diode voltage drop). The preferred current path is via D1, because VBUS >= 4.4V and VBAT <= 4.2V.

Update: Here is the design that I used (I have indicated the normal voltage ranges of +5V_USB and +VBAT; Gate, Source and Drain of MOSFET explicitly shown):

The designs I have seen and used does not have R1 (R1 = 0 Ohm). There must be a good reason why they included R1. Can anyone offer an explanation and what resistor values are good?

Update: Thanks @Cristobol for pointing out voltage spikes (e.g. ESD) on VBUS / +5V_USB. A low value resistor for R1 (e.g. 1k) will offer some protection for Q1 with Vgs_max = +-8V (of course only if Q1 has an internal zener connected between Gate and Source to protect the Gate).

Update: Thanks @Dorian! I think your answer is excellent! A resistor divider prevents a transient dip on VCC5V during the time that USB is disconnected and VBUS (battery) must take over and supply current.

• It does not have R1 soldered, or R1 is there and is 0ohm ? Commented Oct 17, 2018 at 8:55
• Please fix the schematics, in the first the parasitic diode is reversed , in the second Q1 is reversed!!!!! The second design works as a simple diode connected VBAT to VPWR. Commented Oct 18, 2018 at 9:07
• @Dorian, actually that is the intended direction of the parasitic diode and Q1. You can see this use when you search for "reverse battery protection using MOSFET", e.g. TI SLVA139. The parasitic diode is intended to conduct until Q1 switches on. Also, see Figure 1 in Linear P-Channel PowerPath Controllers & Ideal Diodes FAQ. The direction of the P-Channel MOSFETs are the same. Commented Oct 18, 2018 at 12:35
• Also, if Q1 was reversed, the parasitic diode would allow current to flow to the battery while USB was plugged in. Commented Oct 18, 2018 at 12:41
• It's not the parasitic diode that is conducting but Q1 itself that stays opened in some amount. In the second link the controller switches the gate as so the Q1 opens at the right time comparing the battery voltage with the load voltage, you cannot achieve this with such simple circuit. True for reverse polarity connected battery. Commented Oct 18, 2018 at 13:14

While VBUS drops from 5V to 0 Q1 will open to late at VBUS below 3.3V (given a gate threshold voltage of 0.7V) and VCC5V will have a drop to.

R1 and R2 makes a divider which raise the VBUS threshold voltage around 4V.

It's true as Damien noted that it's a design flaw that the Q1 reverse diode might cause trouble if VBUS is to high or the battery is severely discharged.

simulate this circuit – Schematic created using CircuitLab

See here the simulation results for R1 = 0 (VBUS on X axis, battery current and load voltage on Y axis), the load voltage drops to 2.8V while VBUS is going from 0 to 5.2V

and the same simulation with R1 = 15Kohm the load voltage is steady until D1 is conducting.

• Thanks for a truly excellent answer! Thanks also for demonstrating how to simulate the transient when switching over from USB to Battery. It makes so much sense now :) Commented Oct 18, 2018 at 10:51

I understand the job of D1, Q1 and R2. When USB is disconnected, R2 pulls the gate of Q1 to 0V and Q1 switches on so that VBAT.

Actually it's not the case. VBat always supplies the VCC5V due to the protection diode in Q1, the only difference is that when it's pulled down, it will have less loss as the mos will switch.

Supposedly it is supposed to work like this: As the battery is 3.7V, when you connect the USB, R2 (0ohm) will pull the gate up to 5V, and thus disconnecting the battery from the circuit if the gate threshold is below 1.3V, drawing current from the USB instead of the battery.

But this implementation is quite strange and if VUSB increase for some reason, or the battery voltage decrease, you might overload the battery, and have a nice fire. Also the gate threshold voltage vary a lot with temperature.

I've seen this divider used before in cases where the gate-source voltage would be exceeded with a direct connection. It seems a bit overcautious for 5V, but perhaps that FET has a protection diode from source to gate that would provide a path from VBUS straight to the battery. It may also be protection from spikes or noise on VBUS. Of course, it may just be that it was copied from a higher-voltage circuit. My money's on the protection diode.