From a high-level overview, the physical interface of USB has two components: cables and connectors. These
connectors connect devices to a host.
A USB cable consists of multiple components that are protected by an insulating jacket. Underneath the jacket is an
outer shield that contains a copper braid. Inside the outer shield are multiple wires: a copper drain wire, a VBUS wire
(red), and a ground wire (black). An inner shield made of aluminum contains a twisted pair of data wires as seen in
Figure . There is a D+ wire (green) and a D- wire (white).
In Full-Speed and High-Speed devices, the maximum cable length is 5 meters. To increase the distance between the
host and a device, you must use a series of hubs and 5-meter cables. While USB extension cables exist in the
market, using them to exceed 5 meters is against the USB specification. Low-Speed devices have slightly different
specifications. Their cable length is limited to 3 meters and Low-Speed cables are not required to be a twisted pair as
Figure shows.
The VBUS wire gives a constant 4.40 – 5.25 V supply to all attached devices. While USB supplies up to 5.25 V to
devices, the data lines (D+ and D-) function at 3.3 V. The USB interface uses a differential transmission that is nonreturn-to-zero inverted (NRZI) encoded with bit stuffing across the twisted pair.
NRZI encoding is a method for mapping a binary signal for transmission over some medium, in this case, a USB
cable. With this encoding scheme, a logic 1 is represented by no change in voltage level and a logic 0 is represented
by a change in voltage level as Figure shows. On the top is the data that will be transmitted over USB. On the
bottom is the encoded NRZI data.
The bit stuffing occurs by inserting a logic 0 following seven consecutive logic 1s. The purpose of the bit stuffing is for
synchronization of the USB hardware by maintaining phase-locked loop (PLL). If there are too many logic 1s in the
data, then there may not be enough transitions in the NRZI encoded stream to synchronize from. The receiver on the
USB hardware automatically detects this extra bit and disregards it. This extra bit stuffing contributes to the extra
overhead on the USB. Figure shows an example of NRZI data with bit stuffing. Notice in the ―Data to Send‖ stream
there are eight 1s. In the encoded data, after the sixth logic 1, a logic 0 is inserted. The seventh and eighth logic 1
then follow this logic 0.
The hardware in USB devices will handle all the encoding and bit stuffing upon receiving any data and before
transmitting any data. The reason for using the differential D+ and D- signal is for rejecting common-mode noise. If
noise becomes coupled into the cable, it will normally be present on all wires in the cable. With the use of a
differential amplifier in the USB hardware internal to the host and device, the common-mode noise can be rejected as
shown in Figure.
USB communication occurs through many different signaling states on the D+ and D- lines. Some of these states
transmit the data while others are used as specific signaling conditions. T
Differential 0 and Differential 1: These two states are used for general data communication across USB. Differential
1 is when the D+ line is high and the D- line is low. Differential 0 is when the D+ line is low and the D- line is high. An
example of USB data communication is shown in Figure below.
J-State and K-State: In addition to the differential signals, the USB specification defines two additional differential
states: J-State and K-State. Their definitions depend on the device speed. On a Full-Speed and High-Speed device,
a J-State is a Differential 1 and a K-State is a Differential 0. The opposite is true for a Low-Speed device.
Single Ended Zero (SE0): Condition that occurs when both D+ and D- are driven low. This condition indicates a
reset, disconnect, or End of Packet.
Single Ended One (SE1): Condition that occurs when D+ and D- are both driven high. This condition does not ever
occur intentionally and should not be seen occurring in a USB design.
Idle: Condition that occurs before and after a packet is sent. An Idle condition is signified by one of the data lines
being low and the other line being high. The definition of high versus low depends on device speed. On a Full-Speed
device, an idle condition consists of D+ being high and D- being low. The opposite is true for a Low-Speed device.
Resume: Used to wake a device from a suspend state. This is done by issuing a K-State.
Start of Packet (SOP): Occurs before the start of any Low-Speed or Full-Speed packet when the D+ and D- lines
transition from an idle state to a K-State.
End of Packet (EOP): Occurs at the end of any Low-Speed or Full-Speed packet. An EOP occurs when an SE0
state occurs for 2 bit times (bit times are discussed later), followed by a J-State for 1 bit time.
Reset: Occurs when an SE0 state lasts for 10 ms. After a SE0 has occurred for at least 2.5 ms, the device may
recognize the reset and begin to enter a reset state.
Keep Alive: Signal used in Low-Speed devices. Low-Speed devices lack a Start-of-Frame packet that is required to
prevent suspend. They use an EOP every 1 ms to keep the device from entering suspend.
The upstream connection always uses a Type A port and connector, while the device uses Type B ports and connectors. Initially, the USB specification included only the larger Type A and Type B connectors for devices but later included the Mini and Micro connections. These Mini and Micro connectors were initially developed for USB On-the-Go (USB OTG), which is a USB specification that allows devices that would normally act as slaves to become hosts. This is why below figure shows the Mini and Micro ports as Mini-AB and Micro-AB. However, due to the smaller size of the Mini-B and Micro-B connectors compared to Type B, they were adopted in many electronics despite lacking USB OTG capabilities.
Above figure shows that the Mini and Micro connectors have five pins, rather than four. The extra pin is the ID pin and
identifies the host and the device in OTG applications. Since PSoC does not support USB OTG, this application note
does not include details about it. The reason for having different connection types (Type A and Type B) is to prevent
loopback connections on hubs. Some USB devices also contain a captive, or attached cable, with the only visible
connector being the Type A. Table 2 and Table 3 show the pinout for USB connectors depending on the connector
type.
There are two main hardware blocks required to interface with USB: a transceiver, also known as a PHY
(abbreviation for Physical Layer), and a Serial Interface Engine, also known as an SIE. The transceiver provides the
hardware interface between the USB connector and the chip circuitry that controls USB communication. The SIE is
the core of the USB hardware. It performs many functions such as decoding and encoding the USB data, error
correction, bit stuffing, and signaling. SIEs can take many different forms. They are not regulated by the USB
specification unlike transceivers. In fact, some devices incorporate SIE that are more software based to reduce cost,
while other devices use more of a hardware-centric SIE.