USB - Universal Serial Bus
The Universal Serial Bus is an external, packet driven, plug and play,
serial, extension bus.
No bus master, all transactions initiated by host controller.
Even interrupts are 'discovered' by host controller using scheduled polling
of all devices on bus.
A new device makes its presence know by forcing power and data lines to
non-valid states.
The root controller detects the power and data line anomalies and polls devices for their IDs.
The new device ids itself as device 0.
The controller then 'chirps' to probe device 0 for speed capabilities.
The controller then assigns a non-zero ID to the device.
Communication is implemented between root controller and logical constructions
known as endpoints on each device. A device is capable of implementing 32
endpoints, 16 in and 16 out, but is not required implement all of them.
Endpoints are created as part of a device's initial configuration and are
usually associated with specific functions on the device. Function 0
provide configuration information for device.
The connection between the root hub and a set of endpoints on a device is
known as a pipe. A pipe is a transient construction created when communication
is needed. A pipe may be uni-directional or bi-directional.
Polling :
In general, most devices attached to the USB bus are passive. Any interaction
with these devices is initiated by user from the system. Applications and
system calls then contact the root controller initiating a task and the root
controller then contacts the targeted device with appropriate commands.
However, some devices receive triggering actions from outside of the system,
devices such as a keyboard or mouse. Such devices indicate this capability
during the configuration stage and are flagged as polled devices. The
controller then polls these devices on a regular basis.
Communication transactions between the host and devices cannot be interleaved.
But USB 2 allows a device to pause or split a task. This frees up the bus while
the device buffers or processes a block of data. The controller will poll the
device occasionally to determine when to resume data transfer.
Configuration :
- All address, data, and control information is passed over same lines.
- Single pair of lines for data transmission. USB 1.1 & 2.
- Transmitted using differential signaling.
- Half duplex transmission, USB 1.1 & 2. - data in both directions pass over same pair of lines.
- Single pair of power/ground lines for powering smaller devices.
- Packet driven communication.
- Although point to point connections, switching hubs allows physical
tree topology.
- Root controller hub capable of recognizing 127 devices.
- Each device may provide multiple functions.
- Function zero used by plug and play protocol to negotiate connection.
- NRZI - zero identified by transition.
- USB 1 and 2 use bit stuffing, zero stuffed after 6 consecutive 1s.
- USB 1.1
- 1.5 Mib/s (low speed) or 12 Mib/s (full speed) (Mib - megabits)
- USB 2
- USB 3
- 5 Gib/s (super-speed)
- Uses 8b/10b encoding.
- Two additional unidirectional differental line pairs for data transmission.
(Superspeed)
- Full duplex transmission via use of both data pair.
- original D+/D- used to 'discover' USB 3 device and initialize,
but once configured, all super speed activity processed over superspeed pairs.