In USB 2.0’s NRZI encoding, a zero causes a state transition and a one keeps the state. Bit stuffing inserts a zero after six consecutive ones in the applicable packet bit stream so the receiver has transitions for clock recovery. The receiver removes stuffed bits before interpreting the recovered data. Packet framing, synchronisation and end-of-packet rules are separate.
This isolated example starts the stuffing run count at zero and considers only six data ones followed by a data zero. It is not a whole packet or an electrical waveform. A full-speed signalling rate is 12 Mb/s and high-speed is 480 Mb/s; token, handshake, framing, stuffing and scheduling mean neither equals application payload throughput.
USB 2.0: bits on the wire are not payload bytes — worked trace
Illustrative isolated example; not measured silicon behaviour.
Input / processing | Result | Interpretation |
|---|---|---|
Six consecutive input ones | 111111 | Six data bits with no NRZI transition |
Insert stuffed zero | 1111110 | One additional transmitted bit creates a transition |
Then transmit the input zero | 11111100 | Two zeros have different roles: stuffed then real |
Receiver removes only stuffed zero | 1111110 | Original seven data bits recovered |
No. Only the zero inserted after the six-one run is removed. The following zero is original data; removing it corrupts the payload.
Scope: Universal Serial Bus Specification Revision 2.0, conventional full-speed/high-speed transfers. The host schedules transactions; devices attach to root or hub ports. Enumeration includes address assignment, descriptor reads and selecting a configuration. This survey does not describe USB 3.x packet/link state machines or every USB 2.0 hub split-transaction rule.
An endpoint is a device-side source or sink associated with a host pipe. Control supports setup/management, bulk provides error-recovered data delivery without reserved bandwidth, interrupt provides scheduled service, and isochronous prioritises bounded-time service without transaction retry. Packet-size and service-interval meanings depend on speed and transfer type; a bulk endpoint does not have a universal polling interval.
What to notice
The host directs the transaction even when an IN payload travels from device to host.
Descriptor endpoint number, direction and type must agree with controller/firmware configuration.
No. EP0 control and the selected data endpoint are distinct choices. Enumeration success does not match firmware's data queue to EP1.
USB 2.0 full-speed bulk IN: not ready, then data
Illustrative configured device address 1, IN endpoint 1, maximum packet size 8 bytes. A host transfer requests 16 bytes, the initial expected data PID is DATA0, no reset/clear-halt/error intervenes, and both successful packets contain eight bytes. Scheduling gaps are unspecified; no hub split transactions appear.
Transaction | Host sends | Device responds | Host result |
|---|---|---|---|
First attempt | IN token for address 1 / endpoint 1 | NAK: data not ready | No data accepted, no ACK packet; DATA0 remains expected. |
Later attempt | IN for the same endpoint | DATA0 with bytes 0–7 | Accept valid packet and send ACK; next expected PID becomes DATA1. |
Following attempt | IN for the same endpoint | DATA1 with bytes 8–15 | Accept valid packet and send ACK; requested 16 bytes are satisfied. |
What to notice
NAK is temporary flow-control information for this bulk transaction, not evidence of a damaged cable or an endpoint halt.
An IN transaction is host-directed even though its data payload travels from device to host.
No. No data was accepted, so the host still needs all 16 bytes and still expects DATA0. The two later successful eight-byte packets satisfy this request. This is not an isochronous retry model.
For USB 2.0 control, bulk and interrupt transfers, transactions use token, optional data and applicable handshake packets. Isochronous transfers do not use a transaction-level retry handshake. NAK can report temporary inability on applicable transfers; STALL reports a halted or unsupported endpoint condition whose recovery depends on the transfer and host-stack contract.
USB 3.x has revision-specific link training, link states and packet mechanisms rather than reusing the USB 2.0 transaction model. Treat PCIe LTSSM only as a layering analogy, not as the USB state machine, and name the USB revision when discussing recovery or streams.
For USB 2.0 timing, full-speed SOF packets mark 1 ms frames; high-speed SOF packets mark 125 µs microframes, eight per millisecond. At high speed, a 1 ms interval therefore spans eight microframes, not one. This is the scheduling timebase, not a promise that every endpoint transfers in every microframe: service depends on transfer type, endpoint configuration and the host schedule.
SOF (Start of Frame): 1 ms at full speed, 125 µs per microframe at high speed; keep speed and endpoint service interval distinct.
Packet-size limits depend on both speed and transfer type; do not apply a bulk-endpoint table to interrupt or isochronous endpoints.
ZLP (zero-length packet) marks end of some transfers.