Documente Academic
Documente Profesional
Documente Cultură
Architecture
(USB 2.0)
Key features.
Single connector type: USB replaces all the different legacy connectors
with one well-defined, standardized USB connector
Hot-swappable: USB devices can be safely plugged and unplugged as
needed while the computer is running.
Plug and Play: Operating system software automatically identifies,
configures, and loads the appropriate device driver when a user connects a
USB device.
High performance: USB offers low speed (1.5 Mbits/s), full speed (12
Mbits/s) and high speed (up to 480 Mbits/s) transfer rates that can support a
variety of USB peripherals. USB 3.0 (SuperSpeed USB) achieves the
throughput up to 5.0 Gbit/s.
Expandability: Up to 127 different peripheral devices may theoretically be
connected to a single bus at one time.
Power supplied from the bus: USB distributes the power to all connected
devices eliminating the need for external power source for low-power
devices.
Low-cost implementation: Most of the complexity of the USB protocol is
handled by the host, which along with low-cost connection for peripherals
makes the design simple and low cost.
Data transaction
When a transaction is sent over the USB, all devices (except lowspeed devices) will see the transaction.
Each transaction begins with a packet transmission that defines the
type of transaction being performed along with the USB device and
endpoint addresses.
This addressing is managed by USB software.
Other non USB devices and related software within the system are
not impacted by these addresses.
Every USB device must have an internal default address location
(called endpoint zero) that is reserved for configuring the device.
Via endpoint zero, USB system software reads standard descriptors
from the device.
These descriptors provide configuration information necessary for
hardware and software initialization.
In this manner, system software can detect the device type and
determine how the device is intended to be accessed.
Transactions
Every transfer, broadcast over the USB consists of a
combination of packets.
These packets are combined to define individual
transactions that are performed as part of a larger
transfer.
Each transaction consists of one or more packets that
are transmitted over the USB wire.
Each transaction type is defined, along with the
individual packets that compose it.
Transfers are performed across the USB using one or
more transactions consisting of a series of packets.
The basic building blocks of USB transactions are packets
Synchronization sequence
The synchronization sequence consists of eight bits starting with
seven consecutive logic 0s and ending with a logic 1.
The synchronization sequence alerts USB receivers that a packet is
being sent, which will immediately follow the 8-bit synchronization
sequence.
Packets can be broadcast at a full speed (12Mb/s) bit rate or a slow
speed (1.5Mb/s) bit rate depending on the speed of the device being
accessed.
The USB receiver must detect the logic state of each bit value within
the packet by sampling the data lines at the correct point during each
bit time.
The synchronization sequence is transmitted at the transfer speed
being used, allowing the receiver to synchronize to either incoming
data rate.
A variation to the packet sequence occurs when the host sends a
low-speed packet to a low-speed target device.
Packet Identifier
Packet identifiers define the purpose and the format and content of a given
packet.
Packets are grouped into three major categories:
Token Packets Token packets are sent at the beginning of a USB
transaction to define the target device and endpoint address
Data Packets These packets follow token packets during transactions
that require data payloads be transferred to or from USB devices.
Handshake Packets Handshake packets are typically send by the device
that receives the data, thus providing feedback to the sender to verify the
success of the data transfer.
In some cases, the USB device being requested to send data to the system
may send a handshake packet to indicate that it currently has no data to
send.
Special Packets Currently the only special packet defined for low- or
full speed devices is the preamble packet used to enable low-speed ports
prior to sending a downstream low-speed packet.
The format and length of a packet depends on its type.
Token packets are all 4 bytes in length, but contain different information
that describes some aspect of the transaction that it defines.
Data packets are variable length depending on the transfer type associated
with the transaction.
Packet IDs consist of a 4 bit identifier field followed by a 4-bit check field.
The check field contains the inverted value (1s complement) of the packet
ID value.
Immediately following the 8-bit packet ID is the packet specific
information.
Token packets
Token packets define the type of transaction that is to
be broadcast over the USB.
All transactions begin with a token packet.
Four types of token packets are defined by the USB
specification:
SOF (Start of Frame) indicates start of the next 1ms
frame.
IN specifies a USB transaction used to transfer data
from a target USB device to the system.
OUT specifies a USB transaction used to transfer data
from the system to a target USB device.
SETUP indicates the start of a control transfer. SETUP
is the first stage of a control transfer and is used to send a
request from the system to the target USB device.
SOF packet
SOF provides a way for target devices to recognize the beginning of a
frame.
The SOF packet is broadcast to all full-speed devices (including hubs) at
the beginning of each frame.
SOF packets are never transferred to low-speed devices
Embedded within the SOF packet is an 11-bit frame number
The frame number is verified by the receiver with the five CRC bits. Note
that the SOF packet defines a transaction consisting solely of the token
packet.
No data or handshake packet is associated with an SOF packet, so delivery
is not guaranteed.
IN packet
When software wishes to read information from a given device, an IN
token is used.
The IN packet notifies the target USB device that data is being requested
by the system.
OUT packet
System software specifies an OUT transaction when data is to be
transferred to a target USB device.
SETUP packet
SETUP packets are used only during the setup stage of control transfers.
The setup transaction starts a control transfer, and is defined as the setup stage.
DATA packet DATA 0 and DATA 1
Data packets carry the data payload associated with a given transaction. They are
defined to support synchronization of long transfers between the sender and
receiver.
Direction of data packets
Handshake packets
USB devices use handshake packets to report the completion status of a
given transaction.
The receiver of the data payload is responsible for sending a handshake
packet back to the sender.
Isochronous Transfers
Bulk Transfers
Interrupt Transfers
Control Transfers