The Universal Serial Bus

The Universal Serial Bus
The Universal Serial Bus
Most of the material is taken from
Jan Axelsson: USB Complete, third edition
Lakeview Research
ISBN: 1-931448-02-7
Demands to forfill
• Usability, easy to use
• Speed,
d fast
f t enough
h nott to
t hinder
hi d traffic
t ffi
• Reliability, low error rate, retry when errors occur
• Versatility, suitable for many types of peripherals
• Cheap, specially in the device end
• Low power, batteries, bus power
• Support from common OS: Windows, Linux, Mac OS, Android
• Use the same interface for many kinds of peripherals
using the same connector
• Get automatic configuration. When the OS detects
a new device it will load the appropriate driver
• Easy connection. The connector is small and
can not be inserted the wrong way
• Hot plug, the devices can be connected whenever
we want
want. No restarting of the system
• Starts communication without user settings.
No address to set. No interrupts to allocate
• In many cases bus powered
Interface comparison
USB versus FireWire
• In FireWire the communicating nodes can be
any nodes on the bus
• USB communication is always between
the host and a device
• FireWire has broadcasting capabilities
• Higher demands on peripheral nodes in FireWire
• FireWire nodes are more complicated,
as a result also more expensive
USB versus Ethernet
• Ethernet can use long cables
• Ethernet has broadcasting capabilities
• Ethernet has support for Internet protocols
• Ethernet has a more complicated interface than USB
• USB is more flexible with four transfer types
and three speed grades, not counting USB3
USB disadvantages
• Too slow for demanding applications
Does not apply to version 3.0
• Short distance, up to 5 meters
Could be extended using an active repeater
• The host handles all communication,
devices can not talk to each other
• No broadcasting capability
• All communications goes through the OS
and a driver, you can not interact directly
with the port
The USB bus
• Root hub in host (PC)
• Additional
l external
l hubs
h b
• Tired star
• Hubs connect to devices
The USB bus cont.
• The host is in charge of the bus
• Only one device at a time can communicate with the host
• The host detects devices connected to the bus
• The host controller hardware and drivers do most
of the handling of the bus
• The
Th applications
li ti
use standard
t d d OS calls
ll tto send
and retrieve data
• The applications does not have to be aware of
USB details or even that the bus uses USB
Speed grades
• Low-speed, 1.5 Mbits/sec
USB 1.x
• Full-speed, 12 Mbits/sec
USB 2.0
• High-speed, 480 Mbits/sec
USB network
2.0 host
and root
Hi h speed
L /f ll speed
High speed
Low speed
Full speed
2.0 hub
Low speed
High speed
Full speed
Full speed
Full speed
Hi h
1.x hub
Low speed
Low- and full-speed transfers use 1 millisecond long frames,
within which each transfer is allocated space
At high-speed every frame is divided into 8
125 microsecond long microframes
Device 2, endpoint 0
Device 2, endpoint 0
Start of Frame
Device 1, endpoint 2
Device 5, endpoint 3
Device 5, endpoint 3
Device 2, endpoint 0
Start of Frame
Device 1, endpoint 2
Device 5, endpoint 3
Device 5, endpoint 3
Device 5, endpoint 3
Device 1, endpoint 2
Start of Frame
Device 1, endpoint 2
Each frame or microframe starts with a Start-of-Frame
timing reference
Endpoints and pipes
All transactions on the bus are between endpoints
Endpoints are connected through pipes
All pipes except control pipes are one-directional
All endpoints except control endpoints are one-directional
IN endpoints pass information to the host
OUT endpoints pass information from the host
Endpoints and pipes cont.
Control endpoints are used for control and status
information but can also transfer data
Other endpoints transfer data
Transfer types
• Control transfer
Used by the host to read information about a device
set the device´s address and configuration,
can send vendor specific information,
can transfer small amounts of data.
Must be supported by all USB devices
• Bulk transfer
Used when the transfer rate is not of the highest
priority but the data size may be large.
Printers, scanners external drives
Transfer types cont.
• Interrupt transfer
Used by devices that must receive attention
periodically. The only way for low-speed devices
to communicate, besides control transfers.
Used for mice and keyboards
• Isochronous transfer
Have guaranteed delivery time but no error correction
Typically for audio and video in real time
Transfer types cont.
Control transfer
Carry requests are used by the host to learn about
and configure devices
All USB devices must support control transfers
Three stages
• Setup stage
The host sends information about the request
• Data stage
D t is
i send
d through
h IN or OUT transactions.
The stage is optional since not all requests carry data
• Status stage
Reports success or failure of previous stages
Control transfer cont.
Maximum size of data packet
speed 8 bytes
• Low
• Full-speed 8, 16, 32 or 64 bytes
• High-speed 64 bytes
Control transfers can be used to transfer other kinds
of information but the overhead is quit large
The only way for low-speed devices to transfer
information, except through interrupt transfer
The response time for control transfers can be quit long
Bulk transfer
Transfers when the time isn´t critical
C ttransfer
f large
t off data
d t without
ith t filling
the bus since it defers other types of transfer and
waits for available bus time
Fast on an idle bus
Only full- and high-speed transfers.
Data to printers, from scanners,
to and from external drives
Uses error detection and re-sending
Interrupt transfer
Useful when the data has to transfer within a
specific amount of time
Keyboards, mice, game controllers
We don´t want a delay between pressing a key
on the keyboard and the response on the screen
The host polls the device for data like any other device.
The transfer type guarantees that the host requests
or sends data with minimal delay
There is no guaranteed transfer rate.
All three speeds allowed
Interrupt transfer cont.
The host may begin each transaction at any time up to
the maximum latency since the last transaction began.
Interrupt transfers doesn´t guarantee a precise
rate of delivery.
Can be very fast at high-speed, 24.576 Megabytes/sec.
The same error-checking as bulk transfer
Isochronous transfer
For streaming real-time transfers when data must
arrive at a constant rate or by a specific time.
Transfer of voice and music played in real-time
real time
No error-checking. No re-transmission of erroneous data
For data transfered first and played back later
bulk transfer might be a better choice
Data doesn´t have to arrive at a constant rate as long
as the data is available when needed, that is the
transmission can take place in bursts
Before setting up a isochronous transfer the host
determines if the requested bandwidth is available
Before applications can communicate with a device
the host needs to learn about the device and assign
a device driver.
driver This is done in the enumeration process
The process includes assigning an address to the device,
reading descriptors from the device, assigning and
loading a device driver and selecting a configuration
The enumeration process is invisible to the user except
maybe for a message that a new device has been detected.
On first use the user may be prompted for the location
of driver files
Enumeration sequence
1. The user attaches a new device or the system power-up
2. The hub detects the device
3. The host learns of the new device
4. The hub detects whether the device is full- or low-speed.
A high-speed device will start-up as full-speed
5. The hub resets the device
6. The hub learns if a full-speed device supports high-speed
7. The hub establishes a signal path between the device and the bus.
Communication use the defauilt address 0x00
Enumeration sequence cont.
8. The host requests the maximum packet size from the
default pipe
9. The host assigns an unique address to the device
10. The host learns the capabilities of the device
11. The host assigns and loads a device driver
12. The host´s device driver selects a configuration
USB descriptors are data structures that enable the host
to learn about a device.
During enumeration the host requests the descriptors
from the device.
There are four basic descriptor types
Descriptors cont.
• Device descriptor
Basic information about the whole device. Specifies
the number
b off configurations
the device
d i supports
• Configuration descriptors
Information about the device´s use of power and the
number of interfaces supported by the configuration
• Interface descriptors
Specifies the endpoint descriptors
• Endpoint descriptors
Specifies how the endpoint transfers data
Device classes
A device class gathers devices that have much in common
and perform simular functions
The devices or interfaces in a class share many attributes
and provide or request simular services
The class has a common class driver
The specification defines the number and type of required
and optional endpoints.
endpoints It may also define or name formats
for data to be transferred
Vendors can add filter drivers to support added features
Device classes with approved class
The audio class
For devices that send or receive audio data, which may
include encoded voice, music or other sounds
Often part of devices that also support video
video, storage
or other functions
Uses isochronous transfer for audio streams or
bulk transfer for data using the MIDI protocol.
The AudioControl interface access controls such as
volume, mute, bass and treble
Zero or more AudioStreaming interfaces transfers
audio using isochronous transfer
Zero or more MIDIStreaming interfaces transfers
MIDI data using bulk transfer
Musical Instrument Digital Interface
Standard for controlling synthesizers, sound cards and
other electronic devices that generate music or other sounds
The data includes values for pitch, length, volume and
other characteristics
The interface does not transfer sound
The interface uses asynchronous transfer at 31.25
31 25 kbits/sec
A USB interface that carries MIDI data does not use
the asynchronous interface but use bulk transfer
The chip/smart card interface class
Smart cards are used in phones, gift cards, keyless entry,
t i medical
di l data,
d t storing
t i photographs,
h t
h enabling
bli off satellite
t llit
TV receivers and other applications that require storing small or
moderate quantities of data with easy and portable access
Each card contains memory and often a CPU
Many cards allow updating of the contents using a
connector or an embedded antenna
The chip/smart card interface class
To access the card you connect it to a Chip Card
Interface Device,
Device CCID (smart card reader)
Some of these CCIDs have USB interfaces and these
use this class
The CCID use bulk transfer to exchange data
between the host and the device
The CCID use interrupt transfer to report errors and
the insertion or removal of a card
The communication device class,
The class have two broad device types:
• Telephones including analog telephones and modems
ISDN terminal adapters and digital phones
• Medium-speed networking devices including ADSL
modems, cable modems and 10BASE-T Ethernet
adapters and hubs
Two subclasses:
• The Wireless Mobile Communications subclass
including terminal equipment for wireless devices
• The Ethernet Emulation Model subclass including
devices that send and receive Ethernet frames
The communication device class,
CDC cont.
The Remote Network Driver Interface Specification
(Remote NDIS) defines a protocol for using USB and
other buses to configure network interfaces and to
send and receive Ethernet data
CDC supports three basic models for communications:
• The Plain Old Telephone Service (POTS) model for
communicating via ordinary phone lines
• The Integrated Services Digital Network (ISDN) model
for communications via phone lines using ISDN
• The Networking model for communications via
Ethernet or Asynchronous Transfer Mode (ATM)
The content security class
The class defines a way for owners to control access to
files, music, video and other data transmitted on the bus.
The control can use either of two defined Content
Security Methods (CSM)
• Basic Authorization (CSM-1) only enables a host to
request an ID from the device
• Digital Content Protection (DTCP, CSM-2) can be
used to specify whether copying is allowed
allowed, identify
authorized users and specify an encryption method
The class defines a method for activating and deactivating
a content security method and for associating a method to
a channel
The device firmware upgrade class,
The class defines a protocol to enable a host to send
firmware enhancements and patches to a device
The device must have two sets of descriptors:
run-time and DFU-mode descriptors
DFU communications
i ti
l use the
th control
t l endpoint
d i t
The human interface class, HID
Human interfaces (HID) are devices that the host uses to react
to human input such as keypresses and mouse movement
The host must react quickly so the user doesn´t notice
a delay between input and response
Low-speed is fast enough to avoid notable delays
All data travels in reports with tags that tell the host or
device how to use the data
HIDs communicate by exchanging reports using control
and interrupt transfers
The Infrared Data Association
(IrDA) bridge class
The IrDA interface defines hardware requirements
protocols for exchanging data over short distances
using infrared light
A USB IrDA bridge converts between USB and IrDA data
The IrDA link uses the Infrared Access Protocol
(IrLAP) which defines the format of the IrDA frames
The USB IrDA bridge uses bulk transfers to exchange
data with the host
The mass storage class
For devices that transfers files in one or both directions,
typically floppy, hard, CD, DVD and flash-memory drives
Under Windows the devices of this class appears as
drives in My Computer and the file system
The devices use bulk transfers to exchange data. Control
transfers can send class-specific requests. To exchange
other information the device may use bulk or
control/bulk/interrupt transfer
A mass storage device can use just about any full- or
high–speed controller chip
The printer class
For devices that convert received data into text and/or
images on paper or other media
Most printers understand one or more page description
languages (PDL)
The USB Printing Device specification is for printers
of all types
Transfers use bulk transfer
A printer class device can use just about any full- or
high–speed controller chip
The still image capture class
For devices like cameras that capture still images
(not video) and scanners
To transfer image files from a camera the mass storage
class is another option
The devices use bulk transfer to transport both image
and non-image data. An interrupt transfer is required to
transfer event data
The information travels in structures called containers.
are four
d Block,
Bl k D
t Bl
Response Block and Event Block
A still image capture class device can use just about
any full- or high–speed controller chip
The test and measurement class
Suited for instrumentation devices where the data
´t need
d guaranteed
t d timing
ti i
The device may be stand alone or a card in a computer
The USB488 subclass defines protocols to communicate
using IEEE488´s (GPIB) data format and commands
The class uses bulk transfers. The USB488 subclass
requires an interrupt transfer as well. This is optional
for other devices in the class
The video class
Supports digital camcorders, webcameras and other
devices that send,
send receive or manipulate transient
or moving images
Transfering high-quality video requires high bandwidth
so high-speed hosts are in most cases required
Every video function must have a VideoControl interface.
Most functions also have one or more VideoStreaming
Host communication
An application that wants to access a USB peripheral
must communicate with a device driver
Under Windows the driver is layered:
• The application communicates with a client driver
using API functions
• The client driver communicate with USB drivers
consisting of a host controller and a hub driver
The host controller manages tasks common to all
host controllers.
The hub driver manages communications with
the system´s hub.
Host controllers
For low- and full-speed communication:
• The Open Host Controller Interface (OHCI) that
places a lot of the burdon on hardware
• The Universal Host Controller Interface (UHCI)
that places a lot of the burdon on software
F high-speed
hi h
d communication:
i ti
• The Enhanced Host Controller Interface (EHCI)
Matching a driver to a device
Windows stores information about installed hardware
and software in the registry
For USB devices some of the information comes from
the device during enumeration
Other information comes from the Device Setup
Information File (INF file). A file linked to the device
driver that the host assigns to the device
Every USB peripheral must connect to a hub. An
intelligent device that provides attachment points
for devices and manages each device´s connection
to the bus
Devices that plug into the PC connect to the root hub
Devices that plug into external hubs plug into a hub
downstream from the host
The hub manages the device´s connection by helping
new devices to connect and start running and by
blocking out missbehaving devices
External hubs
The hub has one upstream connection connecting either
directly to the root hub or to another hub upstream
The hub has one or more downstream connections to
connect devices or other hubs
Hubs can use version 1.x or version 2.0 of the USB standard
Every hub contains a hub repeater and a hub controller
The hub repeater passes information from the host to
downstream devices and from the devices to the host
The hub controller manages the communications
between the host and the hub repeater
1.x hubs
A 1.x hub can only handle low
low- and full-speed
full speed
The hub repeater repeats all low- and full-speed packets
to all full-speed downstream ports
The repeater doesn´t translate, examine the contents of
or process the traffic from the full-speed source in any
way it just regenerates the edges of the signal
Only low-speed packets are repeated to low-speed ports
2.0 hubs
0 hub
h b uses high-speed
hi h
d upstream
h the
th hub
h b
connects to a high-stream bus segment
In this case all communications upstream uses
high-speed even if the traffic is to or from a fullor low-speed device
To do this the hub has to translate between bus speeds
USB network
2.0 host
and root
Hi h speed
L /f ll speed
High speed
Low speed
Full speed
2.0 hub
Low speed
High speed
Full speed
Full speed
Full speed
Hi h
1.x hub
Low speed
Voltage and power
Devices can be powered through the USB connection
or use their own power supply.
The USB bus can supply a voltage of 5 volts.
There is also a ground connection.
There is a limit to the available current.
There are two classes of devices:
• Low power, up to 100 Milliamperes, laptops
• High power, up to 500 Milliamperes , tabletop PC´s
self-powered hubs
Voltage and power cont.
Low power devices can be bus powered from any
host or hub.
High power devices can use bus power when attached
to a self-powered hub or any host except some
batteri powered hosts (laptops).
Some devices, like digital cameras, needs to function
when theyy are not attached so theyy need their own
power supply.
Some of these can charge their batteries when attached to
the bus.
Hubs and power
A bus powered hub can draw 500 Milliamperes from
the host. The hub uses some of this leaving less than
500 Milliamperes to supply to all attached devices.
A self powered hub doesn´t have this limitation.
It can supply 500 Milliamperes to all attached devices.
A hub should be able to detect an over-current condition,
limit the current and inform the host.
Bus signals
The USB bus is a balanced bus
Low/full speed (V) High speed (V)
Vout,low min
Vout,low max
Vout,high min
Vout high max 3.6
0 440
Vin,low max
Vin,high min
Limited by eyepattern in USB
USB wires
There are four conductors in a USB cable:
Vbus +5 volts
Gnd, ground reference
D+, positive in differential signal pair
D-, negative in differential signal pair
USB connectors
USB 2.0 defines the Series-A plug for the
upstream end of the cable
and the Series-B plug for the downstream end.
Two smaller versions, mini-B and micro-B has been
defined for applications where the other connectors
are too bulky
USB connectors cont.
USB On-the-Go
Makes it possible for a device to function as a limited host.
In this way it is for example possible for a digital camera
that normally functions as a device to act as a host when
it connects to a printer without having to connect to a
host computer.
Wireless USB
• Should behave as USB but without the wire
• Keep the software infrastructure of USB intact
• Preserve the USB model of a smart host
and a simple device
• Without wires batteries are usual so power
efficency is important
• Keep the security of USB
• A new USB class, the wire adapter device class
allows existing PCs to upgrade to wireless
support and allows wired devices to have
wireless connection to PC
Wireless USB cont.
• A hub and spoke model
• The host is the hub at the center
• Each device sits at the end of a spoke
• Each spoke is a point-to-point connection
between the host and the device
• A host can support up to 127 devices
• Without wires there is no need
for port expansion
Wireless USB cont.
• Wire adapters that connect through wire to a
PC and gives it USB capability are called
Host Wire Adapters
• Wire adapters that connect wirelessly to the PC
are called Device Wire Adapters
• Each adapter creates a new USB system with
one host talking to one or more devices
• Wireless devices are divided into classes just
as wired devices
Wireless USB cont.
• The physical layer follows the Multiband OFDM
Alliance UWB PTY specification
3.1 – 10.6 GHz with a 7.5 MHz bandwidth
• Wireless devices must support data rates of
53.3, 106,7 and 200 Mb/s
80, 160, 320, 400 and 480 Mb/s are optional
• Logically a polled, TDMA based protocol
similar to wired USB is used
• Each transfer consists of token, data and
• Devices attach to a host by sending a message
to the host and then authentification takes place
The future of USB
The USB 3.0 (SuperSpeed USB) specification has
been presented
• Speed up to 4
8 Gbit/s
• Backward compatable with USB 2.0
• New wiring with four conductors enables simultaneous
bi-directional traffic
• The connectors have som extra pins but can still take
the old connectors.
The extra pins are used as two twisted pairs for the
SuperSpeed communication and an extra ground
• Current limit raised to 900 Milliamperes
• Maximal wire length 3 meters
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF