When USB is plugged in,
The internal diode inside T1 becomes forward biased and supplies the needed voltage to [IC6] to get the 3.3 regulator working.
IC7B comparator keeps the fet on all the time unless Vin power is plugged in ,
When VIN is plugged in , T1 turns OFF and allows the 5V from IC1 (NCP1117STSDT39) 5V regulator to pass to supply the 5V for the board (and IC6 , 3.3v Regulator)
The 3.3V regulator IC6 (LP2985-33DBVR) ( see attached datasheet) is powered from the 5V from one of the two above sources. Only one of the above is allowed to supply 5V due to the way it is designed (the explanation above). When nothing is plugged into the VIN, there is no voltage on the gate of T1
P-channel FET, (see attached datasheet), consequently it is ON, and the USBVCC passes to IC6 3.3V regulator. When voltage is applied to VIN, the comparator turns off T1, blocking USBVCC1. For understanding operation of Comparator see this:
Vo=0, if V+<V-
FET IS ON for 0V.
@OP,
At some point , maybe now , maybe later , maybe never, you might wonder "if the +5V from USBVCC1 can pass freely through the internal diode, then how can the comparator block the voltage when power is plugged into VIN ?
The answer is that when power is plugged into VIN there is 5V coming from IC1 5v regulator on the CATHODE of T1 diode. If the diode has 5V on it's CATHODE and you apply 5V to it's ANODE , WHAT HAPPENS ? Answer, NOTHING , because the diode has the same voltage on both terminals and no current flows through the diode, thereby blocking USBVCC1 by not conducting. (thanks Larry)
lp2985-18.pdf (1.04 MB)
FDN340P.pdf (207 KB)