The board I am working on has on board USB OTG port (KL25Z). Actually it is dual role, 'cause I haven't implemented OTG protocol yet. The VBUS design bothers me a lot.
Above is recommended from FSL application note.
Here is some snapshots of my schematics.
Fig 1: USB Port
Fig 2: Power Supply
Fig 3: Load Switch
In USB dual role design, we have two power source, Vin (5V) and VBUS (5V). These sources are ORed by diodes to LDO to offer 3.3V Vcc.
When in USB device mode, VBUS offers 5V, via diode, to LDO, generates 3.3V.
When in USB host mode (loaded with host firmware), Vin offers 5V, via diode, to LDO, generates 3.3V. VBUS output is controlled by a load switch SP619.
The VBUS will be switched on in host mode only if ID-pin is grounded. However what happens if an abnormal cable (terrible connector with internal short-circuit ID-pin to GND) is used between external host to this board? VBUS and Vin have contention here. SP619 has 0.377Ohm Rds, so even 0.1V gap between VBUS/Vin will generate 265mA current. Yes, the situation is abnormal and doesn't appear too often, but we must prevent it.
I add two sense networks on VIN/VBUS. That makes things more complex since it involves firmware interaction.
- If firmware senses VBUS during SP619 switch off, then external host is judged, the firmware will not switch on SP619 anyway.
- If firmware doesn't sense VBUS during SP619 switch off, and ID-pin is grounded, the firmware will switch on SP619 to offer VBUS to external device.
- If firmware doesn't sense VBUS during SP619 switching off, and ID-pin is floating (it is normal situation in standard A device like USB memory stick), the firmware can not detect any activities. The user has to manually switch on, alternatively, the firmware can regularly switch on SP619 as a trial. (What a terrible user experience! Some marketing guy can say that is a selling point for saving power. But ......)
Is there a better and mature circuit for USB dual role? Actually I referred circuit design from IOIO(microchip), Arduino Due(Atmel). The first one also implements a user button to enforce VBUS. The latter one uses an external comparator and two NMOS circuit.