0% found this document useful (0 votes)
132 views44 pages

Usb 2.o

The document provides an overview of USB 2.0, including: - USB speeds up to 480Mb/s for High-Speed mode, an improvement over USB 1.1. - The USB architecture involves a host controlling downstream devices using four transfer types. - Devices are detected and assigned addresses during the enumeration and configuration process. - Data is transferred between endpoints using token, data, and handshake packets with error checking. - Descriptors provide device information to the host like supported speeds and configurations.

Uploaded by

RADHA KRISHNA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
132 views44 pages

Usb 2.o

The document provides an overview of USB 2.0, including: - USB speeds up to 480Mb/s for High-Speed mode, an improvement over USB 1.1. - The USB architecture involves a host controlling downstream devices using four transfer types. - Devices are detected and assigned addresses during the enumeration and configuration process. - Data is transferred between endpoints using token, data, and handshake packets with error checking. - Descriptors provide device information to the host like supported speeds and configurations.

Uploaded by

RADHA KRISHNA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 44

UNIVERSAL SERIAL BUS 2.

Presentation By S.Kiran Kumar      


USB Contents
 USB Introduction
 USB History
 USB Architecture
 USB Physical Interface
 USB Speeds
 USB Power
 USB Endpoints
 USB Communication Protocol
 USB Descriptors
 USB Class Devices
 USB Enumeration and Configuration Process
USB Introduction
 USB Stands for Universal  Serial Bus.
 USB is an interface that connects a device to a computer.
 With this Connection computer sends or retrieves the data
from the device .
 USB gives developers a standard interface to use in many
different types of applications .
 A USB device is easy to connect and use because of
systematic design process.
 This application makes the process simpler
USB History
 This standard was developed in order to replace larger and
slower connections such as serial and parallel ports.
 The standard was developed through a joint effort,
starting in 1994, between Compaq, DEC, IBM, Intel,
Microsoft, NEC, and Nortel.
 The goals were to develop a single interface that could be
used across multiple devices, eliminate the many different
connectors currently available at the time, and increase the
data throughput of electronic devices
USB Speeds
 It all started with USB 1.0, which was finalized in January
of 1996. The original specification only included support
for two speeds.
 Low-Speed (LS), which supported 1.5 Mb/s. (USB 1.0)
 Full-Speed (FS), which supported 12 Mb/s.(USB 1.1)
 High-Speed(HS),which supported 480Mb/s.(USB 2.0)
 This specification revision is backward-compatible with
USB 1.1 and 1.0.
USB Data Transfers
 In USB there are 4 types of data Transfers.
 Control Transfers : Used for sending commands to the device, make
inquiries, and configure the device. This transfer uses the control pipe.
 Interrupt Transfers :Used for sending small amounts of bursty data that
requires a  guaranteed minimum latency. This transfer uses a data pipe.
 Bulk Transfers :Used for large data transfers that use all available USB
bandwidth with no guarantee on transfer speed or latency. This transfer
uses a data pipe.
 Isochronous Transfers : Used for data that requires a guaranteed data
delivery rate. Isochronous transfers are capable of this guaranteed
delivery time due to their guaranteed latency, guaranteed bus bandwidth,
and lack of error correction. Without the error correction, there is no halt
in transmission while packets containing errors are resent. This transfer
uses a data pipe
Communication Flow
USB Architecture
 Only one host can exist in the system and communication with
devices is from the host‘s perspective. A host is an upstream
component, while a device is a downstream component.
 Data moved from the host to the peripheral is an OUT transfer.
Data moved to the host from the peripheral is an IN transfer. The
host, specifically the host controller, controls all traffic and issues
commands to devices.
There are three common types of USB host controllers:
 Universal Host Controller Interface (UHCI)
 Open Host Controller Interface (OHCI)
 Extended Host Controller Interface (EHCI)
USB Hardware Interface at the Device
 There are two main hardware blocks required to interface with USB:
 Transceiver, also known as a PHY (abbreviation for Physical Layer),
and a Serial Interface Engine, also known as an SIE.
 The transceiver provides the hardware interface between the USB
connector and the chip circuitry that controls USB communication.
 The SIE is the core of the USB hardware. It performs many functions
such as decoding and encoding the USB data, error correction, bit
stuffing, and signaling. SIEs can take many different forms. 
 They are not regulated by the USB specification unlike transceivers.
 In fact, some devices incorporate SIE that are more software based to
reduce cost, while other devices use more of a hardware-centric SIE. 
Serial Interface Engine(SIE)
Many peripherals Can connect to One Host
USB Physical Interface

 The physical interface of USB has


two components: cables and
connectors. These connectors
connect devices to a host.
 The V bus wire gives a  constant
4.40 - 5.25 V supply  to all attached
devices. While  USB supplies up to
5.25 V to  devices, the data lines
(D+  and D-) function at 3.3 V.
USB D+ and D- Communication
USB Ports and Connectors
USB Speed Detection
 A low-speed and full-speed USB
device will use 48 MHZ clock.
 When a USB device is connected
to a host, the speed of the device
needs to be detected.
 This is done with pull-up resistors
on the D+ or D- line. A 1.5-kΩ
pull-up on the D+ line indicates
that the attached device is a Full-
Speed device.
 A 1.5-kΩ pull-up resistor on the
D- line indicates the attached
device is a Low-Speed device.
 High-Speed devices start as Full-
Speed devices, so they have a
1.5-kΩ pull-up on the D+ line.
USB Speeds
USB Power
 USB power, there are two device categories: bus
powered and  self- powered.
 Bus Powered means taking power itself from the bus.
Bus  power has two classifications low powered device
and high powered device.
 Self  Powered means supply their own power with
the use of an  external power source such as DC
adaptor or a battery.
 USB 2.0 supports upto 500mA.
USB End Points
 An endpoint is an addressable  buffer on a USB device.

The
 host can send the data and receive the data from the buffer.
USB device can  have max 32 endpoints.(16 IN and 16 OUT).

Since EP0 IN and EP0 OUT are set aside as control endpoints.

The maximum endpoints available to transmit the data.

Endpoint uses to check the CRC’S and to detect errors in

transactions.
Endpoints are of 4types :-
Control endpoint

Interrupt endpoint

Bulk endpoint

Isochronous endpoint.

Endpoint Transfer Type Features
USB Communication Protocol

 Each frame consists of a Start of Frame (SOF)


followed by one or more transactions. Each
transaction is made up of a series of packets.
Types Of Packets
 Each packet contains different pieces of information. 
 Packet ID (PID) - (8 bits : 4 type bits and 4 error check bits ). These bits declare a
transaction as an IN/OUT/SETUP /SOF.
 Device Address  -  (7 bits : max 127 devices)
 End Point address - (4 bits : max 16  end points)
 Payload Data -  0 to 1023 bytes.
 Transaction block diagram as shown below

HAND 
TOKEN PACKET DATA PACKET SHAKE
 PACKET
Types of packets
 Token packets
 Data packets                                     
 Hand shacking packets
 Special packets
 Token packets
 Token packets are four types they are
 IN :      IN token packet are used to request the data from the device.
 OUT :  OUT token packet are used to transfer the data to the device.
 Setup : SETUP Token packet are used to send the commands.
 SOF : SOF token packet are used to mark the frames.
 With an IN,OUT, SOF and SETUP  token packets there is a 7-bit device
address ,4-bit endpoint ID  and 5-bit CRC
DATA Packets
 Data packet follows IN ,OUT and SETUP token packets.
 The packet ID toggles between DATA0 and DATA1 for each successful data  packet
transfer ,and the packet closes with the 16-bit CRC.
 The data field can carry 0- 1023 bytes of data.
 Data must be always sent in multiple of bytes.
 For low speed devices, maximum data field is of 8bytes.
 For full speed devices, maximum data field is of 1023bytes.
 For high speed devices, maximum data field is of 1024bytes
 The data toggle is updated at the host and device for each successful data packet
transfer.
 One advantage to the data toggle is acts as an additional error detection method .
 If a different packed ID is received then than what is expected ,the device also to
be know there was an error in the transfer and it can be handled appropriately. An
example where the data toggle is used is if an ACK is sent but not received.
 Handshake Packets
  Handshake packets conclude each transaction.
  Each handshake includes an 8-bit packet ID
and is sent by the receiver of the transaction.
  Each USB speed has several options for a
handshake response. Which ones are
supported depend on the USB speed:
   ACK: Acknowledge successful completion.
(LS/FS/HS) 
  NAK: Negative acknowledgement. (LS/FS/HS)
   STALL: Error indication sent by a device.
(LS/FS/HS)
  NYET: indicates the device is not ready to
receive another data packet. (HS Only).
Special Packets
 The USB specification defines four
special packets.
  PRE: Is issued to hubs by the host to
indicate that the next packet is low
speed.
 SPLIT: Precedes a token packet to
indicate a split transaction. (HS Only)
  ERR: Returned by a hub to report an
error in a split transaction. (HS Only)
 PING: Checks the status for a Bulk
OUT or Control Write after receiving a
NYET handshake (HS Only).
USB Descriptors
 A Descriptor contains information like type of the device, Vendor
ID, Compliant USB Version, number of configurations device
supports, number of endpoints, etc. The USB peripheral must
respond with descriptors when requested by the host. During
enumeration, the host uses control transfer to request the device
for descriptors.
Descriptors types :-
 Device Descriptors
 Configuration Descriptors
 Interface Descriptors
 Endpoint Descriptors
 String Descriptors
Example Full-Speed USB Device Descriptors
 /********************************************************************* 
 Device Descriptors
  *********************************************************************/
  uint8 CYCODE USBFS_1_DEVICE0_DESCR[] =
  { /* Descriptor Length                                   
  /* Descriptor Type: DEVICE                            
  /* bcdUSB (Ver 2.0)                                        
 /* bDeviceClass                                               
 /* bDeviceSubClass                                         
  /* bDeviceProtocol                                          
 /* bMaxPacketSize0                                          
  /* idVendor                                                    
 /* idProduct                                                       
  /* bcdDevice                                                        
 /* iManufacturer                                                  
  /* iProduct                                                         
  /* iSerialNumber                                                
  /* bNumConfigurations                                       
 };
Configuration Descriptor
 /********************************************************************* 
 Config Descriptor
  *********************************************************************/
  uint8 CYCODE USBFS_1_DEVICE0_CONFIGURATION0_DESCR[] = {
  /* Config Descriptor Length                                           
 /* Descriptor Type: CONFIG                                              
 /* wTotal Length                                                             
  /* bNum Interfaces                                                         
 /* bConfiguration Value                                                  
  /* iConfiguration                                                          
  /* bm Attributes                                                             
 /* bmaxpower      
 };                                                          
  /*********************************************************************
Interface Descriptor
 /********************************************************************* 
 Interface Descriptor
  *********************************************************************/
  /* Interface Descriptor Length                         
 /* Descriptor Type: INTERFACE                          
 /* bInterface Number                                       
 /* bAlternate Setting                                         
 /* bNum Endpoints                                           
 /* bInterfaceClass                                               
 /* bInterface Subclass                                        
  /* Protocol                                          
  /* iInterface                                                         
  /********************************************************************
 Endpoint Descriptor
 /*********************************************************************
  Endpoint Descriptor *********************************************************************/
  /* Endpoint Descriptor Length 
  /* DescriptorType: ENDPOINT 
  /* bEndpointAddress 
  /* bmAttributes 
  /* wMaxPacketSize 
  /* bInterval 
 };
  /********************************************************************
String Descriptor
 /********************************************************************* 
 String Descriptor: "USB Example"
*********************************************************************/ 
 /* Descriptor Length */ 0x18u, 
 /* Descriptor Type: STRING */ 0x03u,
  'U', 0,'S', 0,'B', 0,' ', 0,'E', 0,'x', 0,'a', 0,'m', 0,'p', 0,'l', 0 ,'e', 0,
  /*********************************************************************/
  /* Marks the end of the list.                              */ 0x00u
 };
  /*********************************************************************/
USB Enumeration and Configuration

• Enumeration is the process of exchanging


information between the host and the device. It
happens before the data transfer.
 Enumeration process consists of 3 stages.
 Dynamic detection : Device gets detected.
 Enumeration : Host will assign a new unique ID to the
device.
 Configuration : Host will configure the device.
Dynamic Detection
• USB there are 4 rails. V bus , D+ , D- and Ground .
• Here D+ and D- are low when no device is connected to
port.
• Suppose when the device is connected to any one of line D+
or  D- are transition to high that time device is detected.
• If it is full speed device pull up resistor is connected to the
D+  line.
• If it is low speed device pull up resistor is connected to
the D-  line.
• After detection the bus provides 100mA to device.
Enumeration
• The host upon detecting the voltage changes, send GET PORT
STATUS  command to know about the speed of the device.
• Then host will again send a GET PORT STATUS
command to the  device, to get to know more details
about the device.
• The host will issue SET_PORT_FEAUTURE request to the hub to
reset  the address for newly attached device.
• It will done by pulling down D+ &D- lines to ground (0V).Holding
these  lines low for greater than 2.5us, issues the reset condition
. This reset state  is held for 10ms by the hub.
• During his reset state, a series of J-state and k-state occurs to
determine device supports high speed or not. 
• The host applies an address to the device with
the SET_ADDRESS request . The device completes the status
stage of this request  using the default address 00h before using
the newly assigned address  
Configuration
 The host will send GET DESCRIPTOR command
to the device. This  time it will read the entire
descriptor and learn about the device and its 
abilities. It will again send a GET DESCRIPTOR to
learn about the  configuration.
 The host now has  to load the drivers, it will load
the drivers using the .Inf  file and .SYS file. Once
the drivers are loaded the host will configure the
device.
 To do this the host will send SET CONFIGURATION
request and sent a  configuration on the device.
  The Device is Configured state.
 This entire process is called as Enumeration.
Sequence of Enumeration Events
USB Validation
USB Analyzer output Sample
Understanding of Packet Information
 The above Figure is help understand about how the data has been transfer in USB
in the form of packets
  Packet #190 
  L/S: Implies Low-Speed.
 Sync: Synchronizes the sending of packets between the host and the device.
 SETUP: Implies it is a SETUP token.
  ADDR: The current address is zero because it is the first transfer to the device. All
control transfers are initiated from endpoint 0, address 0.
 ENDP: End point- gives the endpoint location. ENDP 0 implies it is a control
transfer.
 CRC5: CRC 5 bits - detects errors in tokens.
 EOP: End of Packet - Signifies that the packet has ended.
Packets  Information
  Packet #191 ​
 DATA0: Implies it is a data token.
 CRC 16: 16-bit CRC check for data.
 Idle: The time between the current packet and the
previous packet.
 Packet #192.
 ACK: Indicates the successful completion of the data
packet.
Common issues on
Target board issues
 The common issue that coming
at the target board side is that,
 Voltage issues.
 Damages on tracks .
 Driver related issues.
 Mismatching of the connections.
Applications of USB 2.0
 Low-Speed devices:
  Examples: keyboards, mice, and game peripherals
  Bus Rate: 1.5 Mb/s 
 Maximum Effective Data Rate: 800 B/s
  Full-Speed devices: 
 Examples: phones, audio devices, and compressed video
   Bus Rate: 12 Mb/s 
 Maximum Effective Data Rate: 1.2 MB/s
 Hi-speed devices
   Examples: video, imaging, and storage devices 
 Bus Rate: 480 Mb/s
   Maximum Effective Data Rate: 53 MB/s
Thank You

You might also like