I noticed an interesting circuit in the Lolin32 ESP32 schematic. I think it's trying to detect a USB brownout and force switch over to battery.
But in general, I'm thinking... why does this circuit even exist? So..... Here's how far I got:
+5V in this picture feeds a 3.3V LDO.
+5V also goes to a P-Channel MOSFET which cuts off a battery when VBUS/USB +5V is present.
So things are probably well even if we only get +4v?
R2/R3 are pulldowns which activate the PNP transistors U2 (Left Qa PNP and Right Qb PNP).
Q1 P-Channel MOSFET turns on if Gate = 0, so that requires pulldown R3 to be "active"
In order for R3 to really be a pulldown to that would require Qb to be "off". That requires VE to be high. That can only happen if Qa is conducting to VBUS.
Well... if VBUS is 5V and all is well, then the pulldown R2 turns on Qa, which causes VE => 5V. That turns off Qb, and R3 pullsdown causing Q1 to turn on. Good
Hold on a second #1:
So Qa turns on, and suddenly Qa Base/Collector/Emitter are all == Vbus? What does a PNP transistor do when all 3 pins are +X volts?
Question #1:
If VBUS is grounded to 0V, then Qa and Q1 can't turn on and disappear. Without anything for Qb Emitter, Qb turns off and goes away, and +5V is left floating??
Question #2:
If VBUS == Vbrown is in a brownout/undervolt condition, then I suppose we want Q1 to turn off quickly. Working backwards, Q1-Gate needs to get a high enough voltage of say 4V to turn off. How? Qb needs to conduct that bad voltage by turning on. That only happens if VE == 0, which allows say Vbrown to go through Qb and hit Q1G. So Q1is off now.
But then with VBUS == Vbrown and VE pulling Qa Base to 0V, that would turn on Qa. That would put Vbrown on VE and turn Qb back off. That would have R3 pull VG back to 0v, turning Q1 back on?
Curiousity A:
Okay so strangely(?) Qa base and collector are connected together.. what does this mean?
Curiousity B:
It seems any time that Qb is on, that would turn Q1 off. So odd for Q1 to be "feeding its own death".
Are you serious #1:
So really we're looking for Vbrown to be "so low" that we can "just turn on Qa"... so that anytime Q1 turns on, Qb turns off Q1???
Curiousity C:
My mind is confused, but since both Base of Qa and Qb are connected together, if Q1 is on, Arent' Qa and Qb's operation kind of in lock step?
Perhaps I don't understand fully #1:
So... is this really an effective brownout detection circuit? Or is it more like a complicated/expensive pullup/down for the battery?