USB specifies 4 pins:
1. VBUS +5V
2. D- Data-
3. D+ Data+
4. GND Ground
Why is this not 3? Could the Data and Power not share a common ground? Am I correct in understanding that D-
is the ground for D+
?
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It only takes a minute to sign up.
Sign up to join this communityUSB specifies 4 pins:
1. VBUS +5V
2. D- Data-
3. D+ Data+
4. GND Ground
Why is this not 3? Could the Data and Power not share a common ground? Am I correct in understanding that D-
is the ground for D+
?
No, D-
is not ground. Data is sent over a differential line, which means that D-
is a mirror image of D+
, so both Data lines carry the signal. The receiver subtracts D-
from D+
. If some noise signal would be picked up by both wires, the subtraction will cancel it.
So differential signalling helps suppressing noise. So does the type of wiring, namely twisted pair. If the wires ran just parallel they would form a (narrow) loop which could pick up magnetic interference. But thanks to the twists the orientation of the wires with respect to the field changes continuously. An induced current will be cancelled by a current with the opposite sign half a twist further.
Suppose you have a disturbance working vertically on the twisted wire. You could regard each half twist as a small loop picking up the disturbance. Then it's easy to see that the next tiny loop sees the opposite field (upside down, so to speak), so that cancels the first field. This happens for each pair of half twists.
A similar balancing effect occurs for capacitance to ground. In a straight pair one conductor shows a higher capacitance to ground than the other, while in a twisted pair each wire will show the same capacitance.
edit
Cables with several twisted pairs like cat5 have a different twist length for each pair to minimize crosstalk.
D+
and which is D-
(apart from the color coding, of course). That means both D+
and D-
will be exposed to the disturbance in the same way. And when the noise is the same on both subtracting will cancel it almost completely.
\$\endgroup\$
It's a differential (or balanced) signal, rather than a single ended (unbalanced) signal.
This means the receiver "measures" the voltage between them, rather than between one and ground.
Say D+ is at 2V, and D- is at 1V. Now say the wire picks up some external noise (RF, mains hum, etc) It is very likely that both cables will pick up the same noise signal since they are twisted together and of the same impedance.
Say we pick up 50mV of noise. So now D+ has 2050mV on it, and D- has 1050mV - the difference between them is still 1V (1000mV) though, and this is what the receiver will "see".
If this had been done with a single ended cable, then D+ (no D-) would be at 1050mV, and ground would still be at 0V, so the receiver would see 1050mV.
This is an bit of an over simplification (but gets the basic concept across) - the ground could also pick up some noise (or have it present to start with), but due to the mismatched impedance between it and the signal the amount of noise picked up on each line will be different and this difference will be seen at the receiving end. Also it may be present initially (e.g. ground loop) which is a big problem for single ended systems.
Matching the impedances of the lines in a balanced connection is very important for good common mode rejection (i.e. rejection of the signal common to both signals) as it only works if both lines pick up exactly the same amount of noise. The signals do not have to be symmetrical. However the noise is created, as long as it affects both signals equally then the common mode rejection will be very good.
Actually, that was tried once: The Apple Desktop Bus (ADB) was used to connect keyboards and mice to Apple Macintosh computers from about 1986 until Apple ditched it for USB in 1997 with the iMac.
It had four wires: 5V, ground, data, and power-switch. The power-switch line was just for the power button on the keyboard, which connected the line to ground, and told the power supply to start up the machine. It had to be its own wire so it still worked even if the 5V line was off.
Other than that, the data line carried everything... very slowly. The bus never really progressed beyond being a desktop device bus because it not only had a single-ended signal, but it had length limits (you get reflections off the end of the bus, since it's not terminated at each end).
So Intel decided to use differential signaling for USB. If you want a good idea of what differential signaling buys you, compare the performance in noise of the single-ended RS-232 bus to the differential RS-422 bus. RS-422 can be driven over a longer cable with less source voltage at a given bit error rate.
Why is this? The long version takes a day's lecture in electromagnetics class. The short version is that a noise signal will induce the same voltage in both wires of a differential pair, so the comparator at the receiver end cancels it out (it rejects common-mode voltage very well). A single-ended line has no comparable guarantee, since there's no guarantee that the ground line and signal line will pick up the same noise signal; grounds might even be connected via chassis ground and the return current will take completely different routes.
0
to a 1
or vice versa), then as the cable gets longer you get a lot more errors, until it's completely gone. It's not like radio's r^-2 spreading loss. (Back on topic, in ADB's case, the ground wire carries both signal and power return current.)
\$\endgroup\$
Sep 26, 2011 at 17:06
Actually a lot of USB has 5 lines, not 4. (The 5th line is for negotiating who is master in OTG applications. Note this is limited to mini and micro USB connectors.)
As others have already pointed out, the D+ and D- lines are a differential pair. Since a receiver can ignore the common mode voltage, a differential pair provides better noise immunity than a single ended signal. Logically, the D+ and D- lines are a single signal.
I can't say definitively that this is the only consideration that went into it, but that's not for grounding, it's for EMI cancellation. The data +/- wires are twisted pair carrying differential signals.
It's just like you'd find in a typical household phone cord or network cable.
The D+ D- differential data transmission mechanism is adopted to reduce the noise affected, hence the bandwidth of the transmission can be highly increased.
Like USB there are several other transmission protocol which uses differential physical layer. Some examples are RS485, Ethernet...
But, even with differential data, there are times when single-ended signaling is used in the USB: The end-of-packet is signaled with a single-ended-zero (SE0), namely, both D+ and D- in low state. This state last the time of 2 bits. if SE0 last for more than 10ms it means a bus reset.
This single-ended signaling makes the USB quite sensitive to electromagnetic interference, like those I found recently when a hair dryer motor was causing a lot of disconnects in a nearby USB peripheral. And no common-mode filters can be effectively used because these can degrade the SE0 signal... Another well conceived standard...
Beyond Logic has an overview of the essential points of the electrical portion of the USB spec here (also in PDF format here):
... USB uses a differential transmission pair for data. This is encoded using NRZI and is bit stuffed to ensure adequate transitions in the data stream.
...
The receiver defines a differential ‘1’ as D+ 200mV greater than D- and a differential ‘0’ as D+ 200mV less than D-. The polarity of the signal is inverted depending on the speed of the bus.