usb 2.0 architecture overview
TRANSCRIPT
-
8/12/2019 USB 2.0 Architecture Overview
1/51
USB 2.0ARCHITECTURE Overview
KANWAR SAAD BIN LIAQATResearch Assistant - UG
-
8/12/2019 USB 2.0 Architecture Overview
2/51
Main Features & History
Basic Definitions
Device Enumeration Steps
Data Transfer Modes
-
8/12/2019 USB 2.0 Architecture Overview
3/51
HISTORY
USB 1.0 (Jan 1996)
USB 1.1 (Sep 1998)
USB 2.0 (Apr 2000)
USB 3.0 (Nov 2008)
-
8/12/2019 USB 2.0 Architecture Overview
4/51
-
8/12/2019 USB 2.0 Architecture Overview
5/51
BASIC DEFINITIONS-- Bus Speeds
Speed Name USB version Data rate
Low Speed USB 1.0 1.5 Mbps
Full Speed USB 1.1 12 Mbps
High Speed USB 2.0 480 Mbps
Super Speed USB 3.0 4.8 Gbps
-
8/12/2019 USB 2.0 Architecture Overview
6/51
BASIC DEFINITIONS-- Bus Topology
Tiered Star Bus Topology
-
8/12/2019 USB 2.0 Architecture Overview
7/51
BASIC DEFINITIONS-- HOST
Master of the bus
Initializes all transactions.
directly with each other.
The only exception is that a
suspended device can initiate a
remote wake-up call.
-
8/12/2019 USB 2.0 Architecture Overview
8/51
BASIC DEFINITIONS-- Cables
Shielded cable containing 4 wires
Two of these D+ and D- form a twisted pair, responsible for
carrying differential data and single ended signals.
Third one is the ground wire as a reference for D+ and D- named
GND.
Fourth one is the 5V supply called VBUS
-
8/12/2019 USB 2.0 Architecture Overview
9/51
BASIC DEFINITIONS-- Cable Length
Max cable length = 5m
Since hub levels are allowed so a device can be at the most 25m
away from the host.
Hence for transferring data through USB the device should be
closer to the host.
-
8/12/2019 USB 2.0 Architecture Overview
10/51
BASIC DEFINITIONS-- Connectors
-
8/12/2019 USB 2.0 Architecture Overview
11/51
-
8/12/2019 USB 2.0 Architecture Overview
12/51
BASIC DEFINITIONS-- Line States
Detached : No device plugged in. D+ and D- are low.
Attached : Device is plugged in. Either D+ or D- will go high.
Idle : State before and after a packet is sent. One of the D+ or D-
line remains high and other remains low.
-
8/12/2019 USB 2.0 Architecture Overview
13/51
BASIC DEFINITIONS-- J, K, SE0 and SE1
J : Same polarity as the idle state.
K : Opposite of K.
SE0 : Single Ended zero state is when both lines are pulled low.
SE1 : When both lines are pulled high. There is no such signal as
, ence w enever suc a s gna comes, s ows an error.
-
8/12/2019 USB 2.0 Architecture Overview
14/51
-
8/12/2019 USB 2.0 Architecture Overview
15/51
-
8/12/2019 USB 2.0 Architecture Overview
16/51
BASIC DEFINITIONS-- Packets
Smallest Element of data transmission.
Each packet contains integral no. of bytes.
Least Significant Bit(LSB) is transmitted first.
The bus is in the idle state, before and after the packet.
ac e = sync a a y es NRZI Encoding is used.
To ensure synchronized clock bit stuffing is used. A zero is inserted
after every 6 consecutive 1s.
-
8/12/2019 USB 2.0 Architecture Overview
17/51
-
8/12/2019 USB 2.0 Architecture Overview
18/51
Device Enumeration Steps
-
8/12/2019 USB 2.0 Architecture Overview
19/51
DEVICE ENUMERATION
Step 01 : Plug the device in USB port
Port may be in the host or hub.
Hub provides power to the port.
Device is in the owered state.
Step 02 : Hub detects the device
The hub monitors the voltages of signal lines. If there is change in any of the line voltages it means a device is
connected.
-
8/12/2019 USB 2.0 Architecture Overview
20/51
-
8/12/2019 USB 2.0 Architecture Overview
21/51
DEVICE ENUMERATION
Step 04 : Hub detects whether device is low orful l speed.
Hub has both D+ and D- lines pulled down through 1.5k resistors.
A full speed device has a 1.5k pull up resistor on D+ line.
- . . Initially a high speed device is also detected as a full speed device.
Hub detects which line is pulled up by the device. Based on the pulled
up line, the hub knows whether the device is full speed or low speed.
-
8/12/2019 USB 2.0 Architecture Overview
22/51
DEVICE ENUMERATION
Step 04 : Hub detects whether device is low orful l speed.
-
8/12/2019 USB 2.0 Architecture Overview
23/51
DEVICE ENUMERATION
Step 04 : Hub detects whether device is low orful l speed.
-
8/12/2019 USB 2.0 Architecture Overview
24/51
DEVICE ENUMERATION
Step 05 : Hub resets the device.
Host learns that a new device is attached.
It requests the hub to reset the device.
. . .for at least 10ms.
-
8/12/2019 USB 2.0 Architecture Overview
25/51
DEVICE ENUMERATION
Step 06 : Host learns if a full speed devicesupports high speed.
During the 10ms reset the device that supports high speed sends a
chirp K signal.
,signal. KJKJKJ.
When device recieves this signal it removes it full speed pull up and
performs rest of its communication at high speed.
All high speed devices must be capable of responding to enumeration
requests at full speed.
-
8/12/2019 USB 2.0 Architecture Overview
26/51
DEVICE ENUMERATION
Step 06 : Host learns if a full speed devicesupports high speed.
-
8/12/2019 USB 2.0 Architecture Overview
27/51
DEVICE ENUMERATION
Step 07 : The hub establishes a signal pathbetween the device and the hub.
The host first verifies that the device has exited the reset state or not
by sending a GET_PORT_STATUS request.
not.
If necessary the host repeats the request until device exits the reset
state.
When the hub removes the reset, the device is in the default state.
The device is ready for control transfers through EP0. The device can communicate with the host using a default address of
00h.
-
8/12/2019 USB 2.0 Architecture Overview
28/51
DEVICE ENUMERATION
Step 08 : The Host learns about the maxpacket size of the default pipe of the device.
The host sends a request to device 0 at EP0. Because the host can
enumerate only one device at a time hence only one device has an
. The device returns a 8 byte device description that contains the max
packet size supported by EP0.
-
8/12/2019 USB 2.0 Architecture Overview
29/51
DEVICE ENUMERATION
Step 09 : The Host assigns an address.
The host controller assigns a unique address to the device.
The device reads the request and ACKs it.
.
Step 10 : The Host learns about devices abil ities.
The host sends get_descriptor request to the device at new address.
The device replies with the device_descriptor. Device_descriptor contains max packet size of EP0, the no. of
configurations the device supports and other basic information about
the device.
-
8/12/2019 USB 2.0 Architecture Overview
30/51
DEVICE ENUMERATION
Step 11 : The host assigns and loads a device driver.
After host learns as much as it can of the device, it searches for its
device driver so that it can communicate with the device.
match the correct device driver.
If there is no match then host matches any class, sub-class or protocol
values.
Whatever matches, the host the loads its driver for further
communication.
-
8/12/2019 USB 2.0 Architecture Overview
31/51
DEVICE ENUMERATION
Step 12 : The device driver selects a deviceconfiguration.
The device can support multiple configuration.
The host then asks from the user for what configuration to load or it
. When the configuration is loaded, the device is configured and now it
is ready to use.
-
8/12/2019 USB 2.0 Architecture Overview
32/51
HUB ENUMERATION
Hubs are also USB devices.
.
If the hub has devices attached, the host also enumerates each of these
after the hub informs the host of their presence.
-
8/12/2019 USB 2.0 Architecture Overview
33/51
DEVICE REMOVAL
The host constantly polls the hub.
,occurred.
The host sends a GET_PORT_STATUS request to find out what event
has occurred.
The host then removes that device from its list and the address of that
device is assigned to another newly attached device.
-
8/12/2019 USB 2.0 Architecture Overview
34/51
DATA TRANSFER TYPES
Bulk Transfer
Interrupt Transfer
Isochronous Transfer
Control Transfer
-
8/12/2019 USB 2.0 Architecture Overview
35/51
1. BULK TRANSFER
Useful for transferring data when time isnt critical.
. Has lowest priority.
Examples : sending data from PC to a printer, transferring data from a
flash disk e.t.c
When the bus is idle, they are the fastest mode of error free transfer.
-
8/12/2019 USB 2.0 Architecture Overview
36/51
1. BULK TRANSFER
Availability :
Only full speed and high speed devices can do bulk transfer.
All devices do not need to support bulk transfers, only a certain device
. . . .
Data Size :
Max packet sizes of 8, 16, 32, or 64 bytes.
If the data to be transferred do not complete in one packet then the
host completes the transfer using multiple transactions.
-
8/12/2019 USB 2.0 Architecture Overview
37/51
1. BULK TRANSFER
Speed :
Host guarantees that the data transfer completes eventually.
Dont reserve any transfer for the data hence if bus is busy it may take
. When bus is idle, it is the fastest mode of transfer since it has the
lowest protocol overhead.
Detecting and handling errors:
Use handshake packets such as ACK, NACK e.t.c for error free
transmission of data.
If a device doesnt send handshake packet then host retries twice.
Use data toggle bits to ensure no data is lost.
-
8/12/2019 USB 2.0 Architecture Overview
38/51
1. BULK TRANSFER
Example transfer :
-
8/12/2019 USB 2.0 Architecture Overview
39/51
2. INTERRUPT TRANSFER
When a data has to be transferred within a specific amount of time.
,keyboard.
Limited bandwidth available in low and full speed but it becomes
400x in high speed.
It does not generates interrupt as its name implies rather it also works
the same way that all other transfers do i.e through polling.
-
8/12/2019 USB 2.0 Architecture Overview
40/51
2. INTERRUPT TRANSFER
Availability :
All versions of usb support this type of transfer.
All devices do not need to support Interrupt transfers, only a certain
. . . .
Data Size :
Low speed : 1 8 bytes
Full speed : 1 64 bytes
High speed : 1 1024 bytes
If the data to be transferred do not complete in one packet then the
host completes the transfer using multiple transactions.
-
8/12/2019 USB 2.0 Architecture Overview
41/51
2. INTERRUPT TRANSFER
Speed :
No guaranteed transfer rate.
Just ensures that no more latency than specified.
.
Detecting and handling errors:
Use handshake packets such as ACK, NACK e.t.c for error free
transmission of data.
If a device doesnt send handshake packet then host retries twice.
Use data toggle bits to ensure no data is lost.
-
8/12/2019 USB 2.0 Architecture Overview
42/51
2. INTERRUPT TRANSFER
Example transfer :
-
8/12/2019 USB 2.0 Architecture Overview
43/51
3. ISOCHRONOUS TRANSFER
Used for streaming and real time transfers.
Ensures a constant data rate.
. Examples: encoded voice played in real time.
Ensures that a large amount of data gets through quickly on a busy
bus.
Completion time is predictable.
-
8/12/2019 USB 2.0 Architecture Overview
44/51
3. ISOCHRONOUS TRANSFER
Availability :
Only full and high spped devices support this type of transfer.
All devices do not need to support Isochronous transfers, only a
. . . .
Data Size :
Full speed : 0 1023 data bytes
High speed : 1024 bytes packet size
Amount of data in each frame doesnt have to be same.
If the data to be transferred do not complete in one packet then the
host completes the transfer using multiple transactions.
-
8/12/2019 USB 2.0 Architecture Overview
45/51
-
8/12/2019 USB 2.0 Architecture Overview
46/51
3. ISOCHRONOUS TRANSFER
Example transfer :
-
8/12/2019 USB 2.0 Architecture Overview
47/51
4. CONTROL TRANSFER
Two uses.
1. Carry the requests for USB specifications.
. . Interactive transfer. Include IN and OUT transactions.
-
8/12/2019 USB 2.0 Architecture Overview
48/51
4. CONTROL TRANSFER
Availability :
Every device must support control transfer over default pipe EP0.
A device may have additional pipes configured for control purposes.
.
Data Size :
Low speed : 8 bytes
Full speed : 8, 16, 32, or 64 bytes
High speed : 64 bytes
If the data to be transferred do not complete in one packet then the
host completes the transfer using multiple transactions.
-
8/12/2019 USB 2.0 Architecture Overview
49/51
4. CONTROL TRANSFER
Speed :
Host ensures that all control transfers get through the bus as quickly as
possible.
,speed.
Detecting and handling errors:
Two retries if no handshake packet is received.
After that host stops all transactions and informs the software that
there is a problem at the control port which must be rectified.
Use data toggle bits to ensure no data is lost.
C
-
8/12/2019 USB 2.0 Architecture Overview
50/51
4. CONTROL TRANSFER
Example transfer :
-
8/12/2019 USB 2.0 Architecture Overview
51/51
Questions?
Thank you !