USB: UNIVERSAL SERIAL BUS Joe Kaewbaidhoon Alex Motalleb Vishal Joshi Prepared for EECS 373 University of Michigan, Ann Arbor 1
2 What do we use to connect a device to a computer? dellcomputer.jpg drives.ecoustics.com/d/f/USB-3.0
USB The most widely used hardware interface for connecting peripheral devices to a computer.
History Developed in the mid 1990’s by Compaq, DEC, IBM, Intel, Microsoft, NEC, Nortel Purpose: Reduce cabling Reduce type of ports Simplifying software configuration More efficient transfers, higher data rates Versions: 1.0, 2.0, and 3.0 4
5 How do we physically connect a device?
Connectors Single master, up to 127 slaves Type A (faces upstream) The connector found on host and hubs Type B (faces downstream) The connector found on slave devices miniA, miniB, and several other types used for smaller devices 6
Pins/wires 4 pins Ground V cc : power the devices (5V output from master), note that some devices can draw power from 2 USB ports 2 data lines (D + and D - ) Twisted Pair Differential Transmission: If D + - D - > 200 mV, send ‘1’. If D - - D + > 200 mV, send ‘0’. Polarity switches with speed 7
J-K state 8 Polarity switches with speed J and K are logical states Hi-speed differential signal Low-speed differential signal J state10 K state01
9 Once connected, how does the hardware communicate?
Protocol Terms Hub: Connects slaves to host (master) Endpoint: a logical entity, found on a device. A USB connection may have up to 32 endpoints (16 for master and 16 for slave) in one connections Pipes: connection from one endpoint to another 10 vd-rom/cd-rw_slim_external_combo_drive
Endpoint Example 11
Hardware Initialization 12 Hub port has status bits plugged in, status bit = 1 Idle = 0 Hub automatically updates when something plugs in Host polls the status bits If 1, initializes the hardware and software protocol
Powering a Device with V cc Devices can be powered using the V bus (V cc ) line Functions divided into three types Low-power bus powered function May use up to one unit load (100 mA) High-power bus powered function May use up to 5 unit loads (500 mA) after configuration Self-powered function May use up to one unit load Rest of the power supplied by external source 13
Transfer Speeds on D + and D - Low speed = KB/s Used for Human Interactive devices (ex. keyboard, mouse, etc) Full speed = 500 KB/s – 10 MB/s Used for audio and compressed video (ex. Microphone) High speed = MB/s Used for video and storage (ex. Digital camera) USB 1.0 USB
Drivers Once the connector is plugged in, the host detects and interrogates it Loads appropriate driver based on PID/VID (Product ID/Vendor ID) combination VID provided by USB Implementer's forum for a fee 15
16 Once connected and synchronized, how is the software going to facilitate communication?
Hierarchy of Data Transfers 17
Hierarchy of Data Transfers 18
Transfers Control: used for command and status operations Most common type of transfer Interrupt: a polling transfer which checks devices for interrupts Isochronous: continuous, periodic transfers Generally used for audio or video streaming Bulk: used for large bursts of data Example: print-job, scanner image 19
Hierarchy of Data Transfers 20
Stages Typical stage involves three types of packets Token: Describes what follows, read/write, address of device, designated endpoint Data (optional): Carries the payload Low speed – 8 bytes Full speed – 1023 bytes High speed – 1024 bytes Status: reports whether data/token was received, if endpoint stalled 21
Control Transfer: Setup Stage Setup Stage: 3 packets – Token, Data0, Ack 22
Control Transfer: Data Stage Data Stage: IN or OUT depending on direction of transfer 23
Control Transfer: Status Stage Status Stage: IN or OUT depending on direction of transfer 24
Hierarchy of Data Transfers 25
Packet Types Token Packets In: Host requests read Out: Host requests write Setup: Used to begin control transfers Data Packets Data0 Data1 Handshake Packets ACK: Successfully received NAK: Failed to receive (also used during interrupts) STALL: Host must intervene 26
Hierarchy of Data Transfers 27
Packet Fields Sync: 8-32 bits used to synchronize host clock with device clock Packet ID (PID): defines the type of packet being sent Sent as 8 bits -> ADDR: specifies which device the packet is being sent to 7 bits for addressing to 127 slaves Address 0 is invalid 28 shell/usb3.shtml
More Packet Fields ENDP: defines the target endpoint 4 bits for 16 possible endpoints Endpoint 0 must exist CRC: Cyclic Redundancy Checks 5 bits within token 16 bits within data EOP: End of packet 29
Data Encoding Uses NRZI (Non Return to Zero Inverted) Transition -> 0 No transition -> 1 30 Adapted from
Bit Stuffing 31 Bit stuffing after 6 th consecutive ‘1’
Questions? 32
References