Cables
USB cables have been
designed to ensure correct connections are always made. By having
different connectors on host and device, it is impossible to connect
two hosts or two devices together.
Unfortunately it is possible
to buy non-approved cables and adapters with illegal combinations
of connector. These may be useful in certain development situations,
but can lead the unsuspecting user to make connections which can
easily damage their equipment.
|
|
|
Cables - Electrical
USB requires a shielded
cable containing 4 wires.
Two of these, D+ and
D-, form a twisted pair responsible for carrying a differential
data signal, as well as some single-ended signal states. (For low
speed the data lines may not be twisted.)
The signals on these
two wires are referenced to the (third) GND wire.
The fourth wire is called
VBUS, and carries a nominal 5V supply, which may be used by a device
for power.
|
|
Makeup
of USB Cable
'A' Plug,
'B' Plug and 'Mini-B' Plug
|
Connectors
As stated above, USB
uses different connectors on host and device to enforce correct
connections.
"A" receptacles
point downstream from a Host or Hub, while "B" receptacles
point upstream from a USB device or hub.
Series A plugs mate with
A receptacles, and B plugs mate with B receptacles.
Standard "A"
and Standard "B" Plug and Receptacle Pin Assignments
Contact
Number |
Signal
Name |
Typical
Cable Colour |
1 |
VBUS |
Red |
2 |
D- |
White
|
3 |
D+ |
Green |
4 |
GND |
Black |
Shell |
Shield |
Drain
Wire |
|
|
|
Cable Types
The USB specification
defines three forms of cable:
-
A high/full speed
detachable cable with one end terminated with an A plug
and the other end with a B or mini-B plug.
-
A captive high/full
speed cable where one end is either hardwired to the vendors
equipment or connected via a vendor specific connector and the
other end is terminated with an A plug.
-
A low speed version
of 2.
The maximum length of
a high/full speed cable is determined by the attenuation and propagation
delay. But, for a low speed cable, it is the signal rise and fall
times that determine the maximum length. This forces the maximum
length for low speed cable to be shorter than that for high/full
speed.
|
|
1
2
3
|
Power Distribution
A device (or hub) can
only sink (consume) current from its upstream port.
A 'self-powered' device
is one which does not draw power from the bus.
A device which draws
its power from the bus is called a 'bus-powered' device. In normal
operation, it may draw up to 100mA, or 500mA if permitted to do
so by the host.
|
|
|
A
device which has been 'Suspended', as a result of no bus activity,
must reduce its current consumption to 0.5 mA or less. |
|
If a device is configured
for high power (up to 500 mA), and has its remote wakeup feature
enabled, it is allowed to draw up to 2.5mA during suspend. |
|
Device Powering
The availability of a
5V supply is a very attractive feature of USB, and can simplify
the design of a device considerably. And a device with a single
connection is also attractive to the user.
However before designing
a bus-powered device it is well to consider the limitations of this
approach.
The voltage supplied
can fall to 4.35V at the device. There can also be transients on
this taking it 0.4V lower, due to other devices being plugged in.
Your device needs to cope with these voltage levels.
The standard unit load
available is 100mA. No device is permitted to take more than this
before it has been configured by the host. It must also reduce
its current consumption to 2.5mA* whenever it is 'suspended' by
a lack of activity on the bus. However it is not required to obey
this rule for a period of 1s from when it connects.**
It should be remember
that of this 2.5mA, the required 1.5k pullup resistor is already
drawing 0.3mA. This leaves you a budget of 2.2mA to power the rest
of your device circuitry. If the device contains a micro-controller
it will need a sleep mode which meets this requirement, but do not
forget that a badly placed resistor can very easily draw current
which you hadn't expected. Measure your suspend current with a meter.
A device may draw up
to 500mA after it has been configured as a high-power device. Being
configured is dependent on the Hub being able to supply 500mA, which
implies a self-powered hub. So there is always a degree of
uncertainty whether more than 100mA will be available. It would
be well to offer the option of external power via a socket on such
a device.
Devices requiring more
than 500mA are obliged to be self-powered. The practice of attempting
to draw power from two adjacent USB ports, using a modified cable,
is not permitted and can easily damage the ports.
* The USB 2.0 core
specification specifies the value 0.5mA for suspended standard load
devices, but this value was superceded as a result of a later ECN
(Engineering Change Note).
** The same ECN removed
the need to suspend during the first second after connect.
|
|
"Hot-Pluggable"
To achieve the
goal of being able to plug a device into and out of a running
system, some design rules must be followed. Firstly it is
important to realise that if you pull a plug out at the far
end of the cable from the device while current is being drawn,
then the cable will develop a potentially large flyback voltage
across your device. The specification suggests that a minimum
solution to this is to place a capacitance of at least 1uF
across Vbus and GND.
The second thing
to consider is that when you plug your device in, any capacitance
between Vbus and GND will cause a dip in voltage across the
other ports of the hub to which you are connecting. To limit
the consequences of this (such as crashing other devices),
the specification places a maximum on the value of capacitance
across Vbus and GND of 10uF.
For the same reason,
the hub port supply must be bypassed with at least 120uF.
|
Self-Powered Devices
When designing
a self-powered device, remember that you must not pull a D+
or D- line above the Vbus voltage supplied. This means that
you must, at the very least, sense when Vbus is connected.
The D+ or D- resistor
should, strictly speaking, be pulled up to a 3.3V supply derived
from Vbus, or controlled by Vbus in such a way that the resistor
never sources current to the data line when Vbus is switched
off.
If you pull, say
D+, high in the absence of Vbus then you will risk faulty
operation with On-The-Go hosts. (See later).
|
|