About a month ago I started shipping USB host shields built on PCB bearing revision number 2.0.1. On this PCB I added a new feature, suggested by Andrew Kroll – a VBUS power switch. The board comes with power switch unpopulated and if you don’t care about this feature it can simply be ignored. However, if you do care about power control, read on.
The ability to turn VBUS on and off at will can be very beneficial. In battery-powered projects the run time can be significantly increased by powering on USB device only when needed. Some other devices can’t even be initialized reliably without a powercycle. Also, many power switches incorporate current limiting circuitry allowing VBUS overload detection and prevention.
An example of populated power switch is shown in the title picture (click on it to make it larger). A is a power switch IC (in this case, Micrel MIC2004). B is 0.1uF ceramic capacitor in 0603 package. C is a wire from MAX3421E GPX pin to the ENABLE pin of the power switch. Finally, D is VBUS Power jumper which needs to be opened, as pictured. Current revision of USB Host 2.0 library is needed to support power control.
Next picture will be used to explain the details of the power control circuitry.
- Arrow A points to the jumper which needs to be cut open
- Arrow B shows the position where 0603 0.1uF ceramic capacitor needs to be placed
- C and D show the places for the power switches (only one switch is needed). Many switches packaged in SOT23-5 and SOT23-6 use this footprint, use On Semiconductor NCP380 as a reference. Also, some other 5 pin switches, such as Maxim MAX4793 and Micrel MIC20xx, will work while placed on SOT23-6 footprint, as shown on the title picture.
- Certain switches, such as 6 pin NCP380, allow for adjustable current limit. The position for current setting 0603 resistor is marked ILIM – for the value of this resistor consult the datasheet for the part you’re planning on using
- Many switches provide FAULT pin to signal various fault conditions, like output overload, reverse votage, or over-temperature. The pin is typically active low open drain type. It is broken out to a pad labelled VBUS OVL. The signal can be used in several different ways. A LED with a series resistor can be connected across VBUS OVL and a power rail. Also, it can be connected to a MCU input. In this case, a position labelled 10K should be populated with 0603 resistor, typical value is 10K. The other (upper) end of the resistor is connected to 5V rail with a trace which is placed under the letter K; if 3.3V level signal is desired, cut the trace and solder the upper end of the resistor to the 3.3V rail.
The power control signal is labelled VBUS EN. The library uses GPX pin for
Init()functions. There is also a variant of
Init()function which will hold the VBUS off for the number of milliseconds passed to it as a parameter. See usbhost.h file for details. Also, testusbhostFAT.ino demonstrates usage of powercycling