USB
Universal Serial Bus
Basic Architecture Host-to-Device Connections and Transactions
Features
n Asynchronous serial communication. n Attachment is detected and device is configured
automatically. n Single standard connector. n 127 devices can be connected via hubs. n Three device speeds:
n n n
Low (1.5Mb/s) Full (12Mb/s) High (480Mb/s)
n Power: 5V, 100mA-500mA n Error detection/recovery is automatic.
Terminology
PC Host Software (USB Communication Flow)
I/O Device
Multiple Personalities
Enumeration
n When a device is attached, the OS enumerates the
device, identifies its driver, and assigns an address to it. n In the numeration process, data structures (transfer descriptors) contain information needed by the host to generate transactions. This information includes:
n n n n n n
USB device address. Type of transfer. Direction of transfer (write or read). Transfer size (# of bytes). Speed. Address of the device drivers memory buffer.
Enumeration Steps
n Getting the device descriptor. n Setting an address. n Getting the device descriptor again. n Getting the configuration descriptor. n Selecting the device driver. n Setting the configuration.
Frames
The Fundamental Packet
n All communications on the USB are
organized into small packets. n Four types of packets:
n
Token, Data, Handshake, and Special. Start (SYNC), information and end.
n Each packets consists of 3 parts:
n
Packet Types
Group PID Value 0001 1001 0101 1101 0011 1011 0111 1111 0010 1010 1110 0110 1100 1100 1000 0100 Packet Identifier OUT Token IN Token SOF Token SETUP Token DATA0 DATA1 DATA2 MDATA ACK Handshake NAK Handshake STALL Handshake NYET (No Response Yet) PREamble ERR Split Ping
Token
Data
Handshake
Special
Four Transaction Types
Type Interrupt Bulk Isochronous Control Important attributes Quality + time Quality time Quality + time Max size LS 8 8 Max size FS 64 64 1023 64 Max size HS 3072 512 3072 64 Examples Mouse, keyboard Printer, scanner Audio, video System control
Interrupt Transfer
Isochronous Transfer
Control Transfer