A keyboard, a webcam, a flash drive and a microphone share one USB port through a hub. None of them ever starts a conversation. The host asks each one, in a schedule it controls: "any keystrokes?", "next video packet", "next block". A busy device says "not yet" and is asked again later. Putting all the scheduling in the host is what lets a USB mouse cost less than its cable.
How does USB answer each question when the host decides everything?
Constraint | USB |
|---|---|
C1 Distance and medium | Cables of a few metres, connectors, hubs |
C2 Bandwidth and latency | 1.5 to 480 Mb/s for USB 2.0 (fact S25); bounded latency for periodic devices |
C3 Wires | One differential data pair (USB 2.0) plus power |
C4 Topology | A tiered star: one host, hubs, many devices |
C5 Who builds each side | Any vendor; devices must be cheap; USB-IF certification (fact P37) |
Each answer links to the lesson that explains the idea behind it.
# | Question | Answer |
|---|---|---|
1 | When is the data valid? | No separate clock: receivers recover timing from transitions, guaranteed by bit stuffing (fact S2) (1.4) |
2 | Where does a message start and end? | Packets start with SYNC and a packet ID and end with end-of-packet; NRZI with bit stuffing (facts S2, S25) (2.3) |
3 | Is the receiver ready? | Devices answer the host's tokens with ACK, NAK (not ready) or STALL (fact S25) (3.6) |
4 | How much may I send before I hear back? | NAK is flow control: a device that cannot take or give data says so and the host retries later (fact S25) (4.2) |
5 | What exactly is being asked? | Four transfer types: control, bulk, interrupt and isochronous, each with different guarantees (fact S25) (5.1) |
6 | How many requests can be in flight? | On a USB 2.0 bus the host runs one transaction at a time, scheduled into frames and microframes (fact S25) (6.3) |
7 | In what order do results become visible? | In order per endpoint (7.1) |
8 | Who gets the wire? | The host schedules everything and reserves bandwidth for periodic transfers, at most 80% of a high-speed microframe (fact S25) (8.7) |
9 | Why can it hang? | Devices never initiate, so they cannot deadlock each other; a device that NAKs for ever stalls only its own transfers, and host software times out (9.9) |
10 | What if bits go wrong? | CRC5 on tokens, CRC16 on data; retry for all but isochronous; DATA0/DATA1 toggling, a one-bit sequence number, discards duplicates (fact S25) (10.10) |
11 | How do the two sides agree at start-up? | The host detects attach, resets the port, and enumerates the device at address 0 (fact T24) (11.6) |
12 | How do we save power without losing data? | Suspend with remote wake-up; USB 3.x adds U1, U2 and U3 link states (fact S19) (12.6) |
13 | What if there are several copies of one value? | Not applicable |
14 | Who is allowed to ask? | Not addressed by the protocol: the host trusts what a device reports about itself |
15 | How do we know it is correct? | USB-IF certification (fact P37) (15.8) |
Host-centric: all scheduling, bandwidth allocation and intelligence in the host; devices only respond.
Transfer types as guarantees: isochronous trades reliability for timing, bulk trades timing for reliability.
A one-bit sequence number: with one transaction outstanding per endpoint, DATA0/DATA1 is enough to catch duplicates.
Plug and play: hot-plug, enumeration and descriptors are part of the protocol from the start.
A device (illustrative) did not toggle its data PID correctly after a host retry. When an ACK was corrupted, the host resent the token, the device sent the same data again with the same PID, and the host, expecting the other PID, accepted it as new: one block was duplicated in a file. Correct DATA0/DATA1 toggling, which exists exactly for this case, fixed it.
Devices never initiate; the host schedules every transaction, so no device waits on another.
It is lost: isochronous has no handshake or retry; the application tolerates the loss.
USB is host-centric: devices speak only when polled; NAK is flow control.
Four transfer types give different guarantees; DATA0/DATA1 is a one-bit sequence number.
Hot-plug, enumeration and suspend with remote wake are built in.