Skip to main content

USB host, hub, device and packets

Short answer

The USB host controls the bus, enumerates devices, and initiates transfers via tokens. A hub expands ports and repeats signals. A device is a slave that responds with descriptors and data. Packets are token (OUT, IN, SETUP, SOF), data (DATA0/1), handshake (ACK, NAK, STALL), and special types.

Explain the functions of USB Host, USB Hub and USB Device. Discuss different packets used in USB protocol.

USB Host

The host is the USB master. There is only one host per bus (the PC) with a host controller and root hub. Functions: detects attachment and removal, enumerates devices (assigns addresses), controls all transfers by sending tokens, manages bandwidth, supplies power, sends SOF every 1 ms, and performs error checking.

USB Hub

A hub expands the number of ports (star topology, up to 7 tiers, 127 devices). Functions: detects connect/disconnect on its downstream ports, reports status to the host, repeats signals upstream and downstream, supplies power (self- or bus-powered), isolates low-speed devices, and handles reset and suspend/resume.

USB Device

A function (keyboard, flash drive, printer) or hub that responds to the host. Functions: answers to the assigned address, supplies descriptors (device, configuration, interface, endpoint), sends or receives data via endpoints (endpoint 0 is control), supports suspend/resume. Devices are slaves and cannot start a transfer.

Packets used

GroupPacketsPurpose
TokenOUT, IN, SETUP, SOFStart a transaction, give address and endpoint
DataDATA0, DATA1 (DATA2, MDATA)Carry the payload
HandshakeACK, NAK, STALL, NYETReport status
SpecialPRE, ERR, SPLIT, PINGHub and high-speed control

A transaction is: token (host) -> data (host or device) -> handshake (receiver). Every packet has SYNC, PID and EOP; token and data packets also carry their fields (address and endpoint, or data) and a CRC. Example IN transaction: the host sends an IN token, the device sends DATA0 and the host replies ACK; if the device has no data it replies NAK.

✓ Answer checked by Claude Sonnet 5.5

All Instrumentation II chapter 3 questions →