Universal Serial Bus Motivation


USB Transfers and Transactions



Download 205.96 Kb.
Page5/5
Date23.04.2018
Size205.96 Kb.
#46015
1   2   3   4   5

USB Transfers and Transactions

Transfers


USB supports 4 transfer types

  • Interrupt transfer

Used for devices typically though of as interrupt driven

In legacy PC applications

Example

Keyboard


USB does not support interrupt

Therefor such devices must be periodically polled

Polling rate clearly critical

Data must not be lost

Not so frequent that bus bandwidth is wasted


  • Bulk transfer

Used for transferring large blocks of data

Typically such transfers have no periodic requirement

Example

Print job



  • Isochronous transfer

Such transfers require constant delivery rate

Applications must ensure rate matching

Between sender and receiver

Example


USB microphone and speaker

Want to ensure no data distortion

Results from transfer


  • Control transfer

Used to transfer specific requests to USB device

Most commonly used during device configuration



Transactions


Typically consist of three phases

  1. Token packet phase

  2. Data packet phase

  3. Handshake phase




Token Packet Phase


Each transaction begins with token phase

Defines type of transaction

Device address also included in this phase

When transaction targets specific device

Two kinds of tokens

Stand alone

Not followed by additional packets

Others


Followed by one or two additional packets

Data Packet Phase


Payload associated with the transfer

Can carry maximum of

1023 bytes during each single transaction

However max payload depends upon

Transfer type being performed

Handshake Packet Phase


All USB transfers implemented

To guarantee data delivery

Except isochronous

No handshake phase

Provides feedback to sender of data

If transaction occurred without errors

If errors occur

Retries attempted



Packets


Packet is mechanism used to perform all USB transactions

Format given as follows



S
ynchronization Sequence

Sequence consists of 8 bits

7 consecutive 0s

1 single 1
Recall 0s encode the transitions on differential data lines

Synchronization sequence also alerts receiver

Data packet on way

Will immediately follow sync sequence



Packet Identifiers

Define purpose and content of given packet

Grouped into 3 major categories



  • Token packets

  • Data packets

  • Handshake packets

  • Special packets

Currently only special packet is preamble

Used to signal low speed transactions

Format and length of packet depends upon its type

Token packets

4 bytes
Data packets

Variable length

Depends upon transfer type

Bulk transfers

Limited to 64 bytes durning each transaction

Isochronous transfers

Set at 1024 bytes


Configuration Process


Host software is responsible for

Detecting and configuring

All devices attached to root hub
Process commonly referred to as USB device enumeration
Enumeration begins at root hub

Each hub port powered in turn

When powered

Hub determines if

Low, full speed, no device attached

If device present

Status bits within hub set to indicate device present

Port enabled

Issues USB reset to device

Assigns unique address

Completes configuration

Process repeated until all devices attached to root hub

Identified and configured

Configuration

Root Hub


Host software begins enumeration by configuring root hub

Recall two designs have been defined

Open Host Controller

Universal Host Controller


Each provides same basic functionality

Individual Device Isolation


Initially each attached device isolated from hub

Since all ports initially disabled

Host software detects presence of device when power applied

Recall earlier discussion


Next each attached device issued reset command

Reset to Address Zero


Resetting device forces it to respond to

Default device address

Zero

Following reset



Every USB device responds to address zero
Using such a scheme

Configuration software can read every device’s descriptor

At same default address

Address Assignment


During configuration

Each device assigned unique address

Device will respond to that address tehreafter

With such a scheme

Possibility of address contention eliminated

Configuration Verification


During configuration host software probes each device

Must determine

Endpoints associated with device

If endpoints can be accommodated based upon remaining free bandwidth

If bus power required by device can be accommodated
Devices may have one or more configurations

Each configuration descriptor

Represents different set of resources that can be chosen

Host software ensures that all required resource requests can be satisfied

If cannot - configuration refused

Power Requirements


Host software must verify

Bus power required by device

Can be supplied by hub port
During configuration

Device specified to consume no more than 100 mA of bus current


Max bus power needed specified in configuration descriptor

Bus Bandwidth


Host software must verify that bus bandwidth required by device

Can be satisfied

Each configuration

Defines set of endpoints

Each endpoint must specify amount to USB bandwidth it requires

If sufficient bandwidth available

Communication pipe set up

Such set up reserves required bandwidth

After successfully allocating bandwidth to each endpoint within device

Device can be configured


If bandwidth not available

Other configurations checked

If every configuration exceeds bandwidth

Device not configured



Configuration Value Assigned


Once configuration selected

Host software configures device

Done by assigning configuration value that corresponds to

Chosen configuration


Configuration value obtained from

Selected configuration descriptor


Device can now

Be accessed by client software

Consume the max amount of current specified in its configuration

Client Software Notification


Once device successfully configured

USB system must locate appropriate

Class driver or drivers

Designated to access device

USB class drivers must be notified that

Device has been installed

Must be provided with information regarding

Characteristics

Capabilities of device

Exact procedure USB system software uses to identify

USB device driver etc
Operating system dependent

USB Device Configuration


Prior to configuring a device

Hub to which device connected

Must have already been configured and had power applied to ports

Next hub and configuration software must detect

Connected device
To convey device information back to host

Device implementers must create device descriptors

These reflect

Characteristics

Behaviour of device
Standard descriptors include


  • Device Descriptor

Describes number of configurations supported by device

  • Configuration Descriptors

Specifies one or more interfaces

Defines certain attributes associated with this configuration



  • Interface Descriptors

Defines number of endpoints related to interface

Defines certain attributes associated with interface



  • Endpoint Descriptors

Specify attributes associated with given endpoint

Information needed by host software

To determine how endpoint should be accessed


  • String Descriptors

Optional descriptors

Consist of UNICODE string that provides human readable information

That can be displayed


  • Class-Specific Descriptors

Given device may require additional descriptors

As defined by particular device class spec



Device Classes


Important aspect of device configuration

Determine which class particular device belongs


Device’s class definition

Provides information used by host and client software

To determine how a device is

Controlled

Accessed
Host software uses information

Identify corresponding device driver

Class driver uses information

Can use information to determine specific characteristics of device


Device classes defined in individual specifications

At present following device classes are defined



  • HID Device Class - Human Interface Devices

  • Communication Devcie Class

  • Monitor Device Class

  • Mass Storage Device Class

  • Audio Device Class


Download 205.96 Kb.

Share with your friends:
1   2   3   4   5




The database is protected by copyright ©ininet.org 2024
send message

    Main page