Technical Details of USB Communication

DATA ENCODING
The encoding scheme used for Universal Serial Bus is Non-Return to Zero Inverted (NRZI), where the logic 0 defines a voltage change and the logic 1 defines a voltage that remains the same.  An example is as follows (without bit stuffing):

IDLE________-------------_--_____---------------_______-----------
         011111110111111110001111011111111101111110111111





Bit Stuffing

When multiple 0's are sent, the signal continues to change, but if multiple 1's are sent, the signal stays constant.  This causes problems because the clock can get out of sync if a larger amount of 1's are in a row.  Therefore, NRZI uses a method called bit stuffing where if there are six 1's in a row, it will insert a 0.  This ensures at least one transition every seventh bit being transferred.  The receiver then detects and discards any bit that follows six consecutive 1's.  Bit Stuffing ensures data synchronization.

PACKET FORMAT
All USB data travels in packets, which are blocks of data with predetermined purposes.  Each block of data contains a field, which have a particular type of information.  Here is a table of the field types:

· SYNC
o Serves as the Start-of-Packet delimiter, and may transmit only on an idle bus.
· Packet Identifier Field
o Bits 0-3 identify what type of packet and bits 4-7 are the one's complement of these bits, used for error checking.
· Address Field
o Identifies the function that the host is communicating with.  The function is a device (possibly a hub).
· Endpoint Field
o Identifies an endpoint number within a function.  A low-speed function will have no more than three numbers while a full- or high-speed function can have up to 16 numbers.
· Frame Number Field
o Identifies the specific frame that the packet is being sent on. 
· Data Field
o Can range anywhere from 0 to 1024 Bytes depending on the transfer type, the amount of data in the transaction, and the USB version.
· Cyclic Redundancy Check Field
o This is used for error checking.

USB
An Introduction  | Is USB Right For You? | How Old School USB 1.1 Works | Technical Details of USB Communication | Technical Details of USB Communication | Blazing fast USB 2.0 | What about Fire Wire?

Seattle Pacific University
3307 3rd Ave. W.
Seattle, WA 98119