SlideShare a Scribd company logo
Universal Serial Bus
• SUBMITTED TO:
• DR. KAMRANULLAH
• SUBMITTED BY:
• MUHAMMAD MUZAFFAR KHAN
• KHAWAR NADEEM
• HAIDER ALI
1
Outline
 Introduction and Background
 Architectural Overview
 Electrical and Mechanical Characteristics
 Protocol Layer
 USB Device Framework
 USB Host Hardware and Software
 How to Create a USB Interface
 Works Cited
2
Introduction and Background
3
Introduction
 Industry standard that defines the cables, connectors and communications
protocols used in a bus for connection, communication, and power supply
between computers and electronic devices
 Developed in1996
 By Joint efforts of
 Intel, Microsoft, Digital Equipment Corporation, IBM, NEC, Nortel, Compaq
 USB has superseded and effectively replaced Serial, Parallel & PS/2 ports
4
Why USB?
 To standardize connections of electrical devices, while maintaining and
optimizing
 High speed
 Reliability
 Cost of manufacturing
 To make it fundamentally easier to connect external devices to PCs
 by replacing the multitude of connectors at the back of PCs,
 addressing the usability issues of existing interfaces,
 simplifying software configuration of all devices connected to USB,
5
Comparison of Speeds of USB
 Low Speed - 1.5Mbits/s (USB version 1.1/1.0)
 Full Speed - 12Mbits/s (USB version 1.1/1.0)
 High Speed - 480Mbits/s (USB version 2.0)
 High Speed – 4.8 Gbit/s (USB version 3.0)
 Super Speed – 10 Gbit/s (USB version 3.1)
6
Architectural Overview
7
Architectural Overview
 Host-controlled
 i.e. there can only be one host per bus.
 Tiered Star Topology
 similar to that of the 10BaseT Ethernet.
 Requires the use of a hub in arrangement.
8
Tiered Star Topology
 Uses 7-bit addressing of devices
 allowing connection of up to 127 devices on a single USB bus
 Allows expandability and ease of use,
 Each device can be handled and removed individually without interrupting
others.
 Allows plug’n’play connectivity which allows for dynamically loadable and
unloadable devices and drivers.
 Plug the device in and the host loads the drivers without needing a reboot or
initiation/termination of connection, etc.
 Unplug the device the absence is automatically detected by the host and the
drivers are unloaded.
9
Tiered Star Topology 10
Hub
 Most devices come with a hub built-into the main circuitry and expose
only the connector required to be plugged into the host (e.g. mouse,
keyboard, etc.).
 Hubs themselves are considered as USB devices, and may or may not have
some level of ‘intelligence’ circuitry.
 They are mainly required to increase the logical and physical fan-out of the
network.
 Devices attached to the Hub may work as any other USB devices, powered
by either the Hub or any external source
 Client, through software, communicates with every device as if it were
connected directly; i.e. through direct addressing
11
Hub 12
Electrical and Mechanical
Characteristics
13
Mechanical Characteristics
 There are commonly two kinds of USB connectors
 Type A
 Type B
 Many cables are made with Type A connector on one end and Type B
connector on the other.
 This is an attempt to prevent improper physical connections between
devices, as the connectors are not physically interchangeable.
14
Type A Type B
Pin Configuration 15
Type A Type B
PIN # Cable Color Signal
1 Red Vbus = +5V
2 White D-
3 Green D+
4 Black Ground
Electrical Characteristics
 All USB devices have an upstream connection
 All hosts have a downstream connection to the device,
 These Connections are not interchangeable.
 While Type A connectors on both ends are available in cables, two
computers should not be connected together using a USB cable.
 This is partly because of the fact that one topology can only have one host
 it is also to prevent damage to the interface: If two computers are connected to
each other using one cable, it would cause their 5V supplies to short and cause
damaging current flow. Two computers can, however, share a single peripheral
device using a hub.
16
Electrical Characteristics
 The parallel data is first serialized, then transmitted, and then parallelized
at the receiving end
 Non-return to zero invert (NRZI) scheme of encoding data
 includes a sync field required to synchronize host and receiver clocks.
17
USB – Voltage Levels
 Transmitted Side:
 Differential ‘1’ is transmitted by
 pulling D+ over 2.8V with a 15k ohm resistor pulled to ground
 D- under 0.3V with a 1.5k resistor pulled to 3.6V
 Differential ‘0’ is transmitted by
 D+ less than 0.3V
 D- greater than 2.8V (with the appropriate resistors).
 Receiver Side:
 Differential ‘1’ is received when D+ is 200mV greater than D-
18
USB – Logic Levels
 Low Speed/Full Speed Bus=>Characteristic Impedance=90Ω+/- 15%.
 Select Impedance matching series resistors for D+ and D- accordingly.
 The polarity of the signal is inverted depending on the speed of the bus.
 Terms ‘J’ and ‘K’ are used to signify the logic levels.
 In low speed
 J state is a differential 0.
 K state is a differential 1.
 In high speed
 J state is a differential 1.
 k state is a differential 0.
19
USB – Logic Levels
 High Speed (480Mbit/s) Mode uses a 17.78mA constant current for
signaling to reduce noise.
 USB device must indicate to the host whether it is using a low speed or
high speed connection.
 For low speed, D- is pulled to 3.3V
 For high speed D+ is pulled to 3.3V
20
Classes of USB Functions
 Low-powered Bus Functions
 Derive all the power from Vbus
 Cannot draw more than 1 unit load defined as 100mA
 Work between voltages of 5.25V down to 4.40V
 High-Powered Bus Functions
 Draw 1 unit load until they are configured, after which they can draw 5 unit loads
(500mA max).
 Work between 4.40V and 5.25V.
 Self-Powered Bus Functions
 Drain upto 1 unit load and consume the remaining power from an external source.
 In case the external source should fail, provisions must be in place to prevent more
than 100mA of current draw.
21
Caution!!!
 Precautions need to be taken in creation of devices, for which the USB
specification require that to prevent excessive inrush current should be
limited by not having a decoupling capacitance of less than 1uF or more
than 10uF.
 The total power draw of the device of 500mA max must include
 Currents drawn by the pull-up and pull-down resistors of D+ and D-,
 Current wasted by the voltage regulator in stepping down from 5V to 3.3V for
the device
22
USB Suspend Mode
 No Activity for 3ms  Suspend Mode
 Rated Suspend Current = 500uA for a device with one unit load.
 Suspend Current includes
 Idle current drawn by resistors and regulator  Design Constraint
 Where battery drain is not an issue, a Keep Alive packet must be sent
periodically to keep device from entering suspend mode.
 The time frames for these are given below.
 A high speed bus will have micro frames sent every 125us +/- 62.5ns
 A full speed bus will have a frame sent each 1ms +/- 500ns.
 A low speed bus will have a keep alive (end of packet) data sent every 1ms in
the absence of data transfer.
23
Protocol Layer
24
USB Packet Types
 Data is sent in packets Least Significant Bit (LSB) first.
 There are 4 main USB packet types:
 Token
 Data
 Handshake
 Start of Frame
 The packets are then bundled into frames to create a USB message
25
USB Packet Fields
 Each packet is constructed from different field types,
 SYNC (synchronize)
 PID (packet ID)
 Address
 Data
 Endpoint
 CRC (cyclic redundancy check)
 EOP (end of packet)
26
USB Packet Fields
 Synchronize (Sync):
 All packets must start with a sync field.
 Used to synchronize clock rate between device and host.
 It is 8 bits for low speed and 32 bits for full/high speed
connection.
 Packet ID (PID):
 Packet ID identifies the type of packet being sent.
 It has 4 bits for the value, and another 4 bits of the
inverted value to prevent errors.
 Address:
 7 bit field
 Specifies the device the packet is intended for out of 127
devices that can be connected to a single bus.
27
USB Packet Fields
 Endpoint:
 4-bit long,
 Allows for further flexibility in addressing.
 Can also be split for IN or OUT data.
 Cyclic Redundancy Checks (CRC):
 Performed on the data with the packet payload.
 All token packets have 5 bit CRC while data packets have 16 bit CRC.
 End of Packet (EOP):
 Signaled by a ‘0’ for approximately 2 bit times followed by a J for 1 bit time.
28
Token Packet Format
 In
 Informs the USB device that host wishes to read information.
 Out
 Informs the USB device that the host wishes to send information.
 Setup
 Used to begin control transfers
 Token packets have the following format:
29
Sync PID ADDR ENDP CRC EOP
Data Packet Format
 Maximum data payload size for low-speed devices is 8 bytes.
 Maximum data payload size for full-speed devices is 1023 bytes.
 Maximum data payload size for full-speed devices is 1024 bytes.
 Payloads must be sent in multiples of bytes.
 Data packets have the following format:
30
Sync PID Data CRC EOP
Handshake Packet Format
 There are three types of packets which consist simply of PID.
 ACK:
 Acknowledgement that the packet has been successfully received.
 NACK:
 Reports that the device can not send or receive data. Also used to interrupt
when no data is available to send.
 STALL
 The device is in a state that requires intervention from the host.
31
Sync PID EOP
Start of Frame Packet Format
 Data is split into frames before being transmitted.
 The start of frame packet is used to signify the frame number to the host.
 The frame number field is 11 bits long.
32
Sync PID Frame Number CRC EOP
Device Framework
33
Virtual Pipes – Logic Channels
 USB device communication is based on Pipes or Logic Channels that connect
the peripheral's Endpoints with the host.
 Virtual Pipe is a Logical Connection from the host controller to a device.
 Since it is a logical connection, the pipe may be opened or closed.
 There are two types of pipes:
 Message Pipe:
 A message pipe is bi-directional and is used for control transfers. Message pipes are
typically used for short, simple commands to the device.
 Stream Pipe:
 A stream pipe is a unidirectional pipe connected to a unidirectional endpoint that
transfers data.
34
End-point
 The point of connection on the device.
 IN and OUT endpoints are different, not multiplexed.
 An endpoint is defined and numbered by the device during the time
period after physical connection, also known as enumeration time.
 The endpoint is permanent.
 An endpoint is addressable in the token packet.
 There are four bits used to address an endpoint, which translates to a
device having up to 15 endpoints
 endpoint 0 is reserved for control transfers throughout the duration the device
is connected to the bus, every peripheral device must support it
35
36
Descriptors
 Data Structure to inform the host about the endpoint's configuration and
expectations.
 When establishing communications with the peripheral, each endpoint
returns a descriptor,
 Descriptors include
 transfer type,
 max size of data packets,
 interval for data transfers,
 the bandwidth needed.
37
Types of Descriptors
 Device Descriptor:
 This contains information that applies globally to the device, such as
 serial number,
 product ID,
 vendor ID, etc.
 This information is used to load device drivers on the host end.
 Configuration Descriptor:
 A Device Descriptor can have one or more Configuration Descriptors.
 These are used to inform the host about
 How the device is powered (bus powered, self powered, etc.),
 The maximum power consumption,
 What interfaces are available for the setup.
 The host can choose to read the entire hierarchy or just the Configuration Descriptor.
38
Types of Descriptors
 Interface Descriptor:
 These help to more finely group the endpoints,
 also contain information to help the host select a driver for communication
with the USB device.
 An interface descriptor defines one or more endpoints.
 Endpoint Descriptor:
 The endpoint descriptor is the last leaf in the configuration hierarchy
 It defines the bandwidth requirements, transfer type, and transfer direction of
an endpoint.
 For transfer direction, an endpoint is either a source (IN) or sink (OUT) of the
USB device.
39
Descriptors Hierarchy
 Every USB device has a hierarchy of descriptors, which are used to inform
the host about the type of device.
40
Descriptors Hierarchy
 Each device can only have one Device Descriptor.
 Multiple Configuration Descriptors can be used to group device functions;
however only one Configuration Descriptor can be active at a time.
 These are further divided into multiple Interface Descriptors, but similar to
Configuration Descriptors, only one can be active at a time.
 The Interface Descriptors can be used to group multiple endpoints for a
single function.
41
Data Transfer Types
 Control
 Isochronous
 Bulk
 Interrupt
42
Data Transfer Types
 Control:
 Control transfers are used to exchange configuration and commands between
the device and the host.
 Isochronous:
 Used by time-critical, streaming devices
 such as speakers and video cameras
 Fixed bandwidth and a Free connection to the host.
 These have almost guaranteed access to the USB bus.
 Data streams between device and host are real-time and hence error correction
is not used.
43
Data Transfer Types
 Bulk:
 Where timing is not critical
 Such as Printers and Scanners.
 Data is sent in bigger packets.
 Error correct is used on these packets.
 Interrupt:
 Data that need immediate attention.
 Such as mouse or a keyboard
 Small amount of Data Exchange
 Error checking validates the data.
44
Data Transfer Types
 The USB divides the available bandwidth into frames, and the host controls
the frames.
 Frames contain 1,500 bytes, and a new frame starts every millisecond.
 During a frame, isochronous and interrupt devices get a slot so they are
guaranteed the bandwidth they need.
 Bulk and control transfers use whatever space is left.
45
USB Host Hardware
46
USB Hardware Classes
 The host controller is part of the computer hardware.
 Control is managed by a device known as a Hardware Controller Device
(HCD) which is defined by the hardware implementer.
 USB defines class codes used to identify a device's functionality and to
load a device driver based on that functionality.
 This enables a device driver writer to support devices from different
manufacturers that comply with a given class code.
47
USB Device Classes
 The USB-IF Device Working Group defines a discrete number of device classes.
 The idea was to simplify software development by specifying a minimum set of
functionality and characteristics that is shared by a group of devices and interfaces.
 Devices of the same class can all use the same USB driver.
 This saves the end-user the time of installing a driver for every single USB device that is
connected to their host PC.
 Input devices such as mice, keyboards and joysticks are all part of the HID (Human Interface
Device) class.
 Mass Storage class covers removable hard drives and keychain flash disks
 However, a device does not necessarily need to belong to a specific device class. In
these cases, the USB device will require its own USB driver that the host PC must load to
make the functionality available to the host.
48
How to Create a USB Interface?
49
Microcontrollers
 Designing an USB Interface needs both hardware and software
competence
 Many commonly used microcontrollers support USB interfacing directly
 Microcontrollers allow the designer a higher level of abstraction when
dealing with the creation of a USB interface.
 Such controllers usually have dedicated pins which may be used at the
+5V, GND, V+ and V- for the USB pins readily.
 Commonly found cheaper microcontrollers are slow compared to the data
transfer rates of the USB protocol.
 Even the low speed USB interface (1.5 Mbit/sec) may be too high for some
controllers. A simple calculation goes as follows:
50
Speed Incompatibility Problem!
Microcontroller
 Say a microcontroller has 6M
instructions per second (at 24MHz
and 4 cycles/instruction),
 i.e. it needs 6 cycles to complete per
second.
USB
 For one bit of low speed USB
processing (i.e. 1.5 Mbit/sec) it would
require 6/1.5 = 4 clock cycles.
 This is simply too slow for USB, and
this is exactly the case with, for
example, the popular controller
PIC16F84.
51
Development Boards
 Prototyping and development boards such as the
 TI Beagleboard,
 NXP mbed,
 Arduino
 provide the designer with an even higher level of abstraction and make
USB interfacing almost trivial to hobbyists and designers who may not be
extremely proficient at writing complicated code.
 These development boards also come with higher quality components (the
BeagleBoard has an ARM core processor) which may be used for high
speed USB connections as well.
52
Device Drivers
 The host is what initiates the USB traffic. When the device is plugged in, the host detects
and connects to the peripheral hardware.
 The descriptor is what informs the host of the device specifications such as the vendor
ID and product ID (VID/PID).
 The USB devices can identify themselves as specific classes and subclasses of devices to
use the framework and drivers which already available by the USB Implementers Forum
(see more at www.usb.org) which have been implemented across many operating
systems.
 This prevents the designer from going through the sizable and needless effort of writing
his/her own device driver to interface with the host.
 USB devices that comply with a specific USB class enable cross-vendor and cross-
platform compatible USB devices.
 The USB specification specifies hundreds of device classes that enable the generic
implementation of, for example, Ethernet dongles, mixing desks, or flash disks and
enable operating systems to provide generic drivers for these classes.
53
Device Drivers
 There are cases where the USB device does not have any OS support and it should
interact with a user program directly. In that case, a generic driver such as the open-
source libusb driver that allows an application program to communicate with any USB
device can be used.
 The device will be advertised as vendor-specific. Through the libusb interface the user
program can detect a device with a VID and PID that it wants to interact with, claim an
interface, open an endpoint, and send IN and OUT requests to that endpoint.
 For connection of USB between a device and a computer, the operating system
dependent drivers are usually available. For instance, Microsoft Corporation has a
database of information pertaining to USB connection between many different types of
devices and their Windows operating system, which can be used for assistance in the
project.
 An excellent collection of info, sample source code, and interfacing using a PIC
microcontroller and generic PC USB drivers can be found their website.
54
Work Cited
 Stevens, Tim. USB 3.0 SuperSpeed... Engadget. [Online] January 10, 2010.
http://www.engadget.com/2010/01/09/usb-3-0-superspeed-gone-wild-at-ces-2010-
trumps-even-your-new-s/.
 Melissa J. Perenson. SuperSpeed USB 3.0: More Details Emerge. PCWorld. [Online]
January 6, 2009. http://www.pcworld.com/article/156494/superspeed_usb.html.
 Cohen, Peter. USB 3.1 vs Thunderbolt - the battle is on! iMore. [Online] August Thursday,
2013. http://www.imore.com/usb-31-spec-finalized-will-match-thunderbolt-1-speeds.
 EE Herald. Online course on Embedded Systems. EE Herald. [Online]
http://www.eeherald.com/section/design-guide/esmod14.html.
 Peacock, Craig. USB In A Nutshell. BeyondLogic. [Online] September Friday, 2010.
http://www.beyondlogic.org/usbnutshell/usb1.shtml.
 FTDI Chip. USB Data Packet Structure Version 1.0. FTDI Chip. [Online]
http://www.ftdichip.com/Support/Documents/TechnicalNotes/TN_116_USB%20Data%20
Structure.pdf.
55
Work Cited
 Universal Serial Bus. Wikipedia. [Online] http://en.wikipedia.org/wiki/USB.
 USB Background. Total Phase. [Online] [Cited: February 16, 2014.]
http://www.totalphase.com/support/articles/200349256/.
 Muller, Henk. How To Create And Program USB Devices. Electronic Design.
[Online] July 27, 2012. http://electronicdesign.com/boards/how-create-
and-program-usb-devices.
 Microsoft Corporation. USB Host Drivers (Compact 2013). Microsoft
Developer Network. [Online] http://msdn.microsoft.com/en-
us/library/gg156249.aspx.
 picusb. Google Code . [Online] http://code.google.com/p/picusb/.
56
57

More Related Content

What's hot

Usb
UsbUsb
Universal serial bus(usb)
Universal serial bus(usb)Universal serial bus(usb)
Universal serial bus(usb)
SwaroopShetty7
 
USB Universal Serial Bus
USB Universal Serial BusUSB Universal Serial Bus
USB Universal Serial Bus
koushik960
 
USB 3.0 -Infinite Possibilities
USB 3.0 -Infinite PossibilitiesUSB 3.0 -Infinite Possibilities
USB 3.0 -Infinite Possibilities
Rehan Guha
 
USB 2.0
USB 2.0USB 2.0
Fpga implementation of utmi with usb 2.O
Fpga implementation of  utmi  with usb 2.O Fpga implementation of  utmi  with usb 2.O
Fpga implementation of utmi with usb 2.O
Mathew George
 
Usb
UsbUsb
Usb universal serial bus
Usb   universal serial busUsb   universal serial bus
Usb universal serial bus
Dr. Anita Bhandari
 
USB Powerpoint
USB PowerpointUSB Powerpoint
USB Powerpointaaron924
 
Pcie basic
Pcie basicPcie basic
Pcie basic
Saifuddin Kaijar
 
Usb
UsbUsb
USB presentation by Mishuk
USB presentation by MishukUSB presentation by Mishuk
USB presentation by Mishuk
mks mk
 
Uart
UartUart
Usb 3.0 technology mindshare
Usb 3.0 technology mindshareUsb 3.0 technology mindshare
Usb 3.0 technology mindshare
Nguyen Nhat Han
 
Usb
UsbUsb

What's hot (20)

USB 3.0
USB 3.0USB 3.0
USB 3.0
 
Usb
UsbUsb
Usb
 
Universal serial bus(usb)
Universal serial bus(usb)Universal serial bus(usb)
Universal serial bus(usb)
 
utmippt
utmipptutmippt
utmippt
 
USB Universal Serial Bus
USB Universal Serial BusUSB Universal Serial Bus
USB Universal Serial Bus
 
USB 3.0 -Infinite Possibilities
USB 3.0 -Infinite PossibilitiesUSB 3.0 -Infinite Possibilities
USB 3.0 -Infinite Possibilities
 
USB 3.0
USB 3.0USB 3.0
USB 3.0
 
USB 2.0
USB 2.0USB 2.0
USB 2.0
 
Fpga implementation of utmi with usb 2.O
Fpga implementation of  utmi  with usb 2.O Fpga implementation of  utmi  with usb 2.O
Fpga implementation of utmi with usb 2.O
 
Usb
UsbUsb
Usb
 
Usb universal serial bus
Usb   universal serial busUsb   universal serial bus
Usb universal serial bus
 
Usb
UsbUsb
Usb
 
USB Powerpoint
USB PowerpointUSB Powerpoint
USB Powerpoint
 
Pcie basic
Pcie basicPcie basic
Pcie basic
 
Usb
UsbUsb
Usb
 
USB presentation by Mishuk
USB presentation by MishukUSB presentation by Mishuk
USB presentation by Mishuk
 
Usb
UsbUsb
Usb
 
Uart
UartUart
Uart
 
Usb 3.0 technology mindshare
Usb 3.0 technology mindshareUsb 3.0 technology mindshare
Usb 3.0 technology mindshare
 
Usb
UsbUsb
Usb
 

Viewers also liked

Usb
UsbUsb
Why Drivers Stay with Fleets
Why Drivers Stay with FleetsWhy Drivers Stay with Fleets
Why Drivers Stay with Fleets
bmweber
 
The USB Generation
The USB GenerationThe USB Generation
The USB Generation
Jacques Warner
 
Computer Interfaces
Computer Interfaces Computer Interfaces
Computer Interfaces
Prasad Deshpande
 
Linux Device Driver Training
Linux Device Driver TrainingLinux Device Driver Training
Linux Device Driver Training
Multisoft Virtual Academy
 
Linux Device Driver’s
Linux Device Driver’sLinux Device Driver’s
Linux Device Driver’s
Rashmi Warghade
 
Introduction of USB 3.1
Introduction of USB 3.1 Introduction of USB 3.1
Introduction of USB 3.1
Rainny Tu
 
Device Driver in WinCE 6.0 R2
Device Driver in WinCE 6.0 R2Device Driver in WinCE 6.0 R2
Device Driver in WinCE 6.0 R2
rahul_p_shukla
 
Device Drivers
Device DriversDevice Drivers
Device Drivers
Kushal Modi
 
Wireless usb ppt
Wireless usb pptWireless usb ppt
Wireless usb pptrajveer007
 
Device Drivers
Device DriversDevice Drivers
Device Drivers
Suhas S R
 
Електронні технології в місті Львові. Уляна Стадник
Електронні технології в місті Львові. Уляна СтадникЕлектронні технології в місті Львові. Уляна Стадник
Електронні технології в місті Львові. Уляна Стадник
Olena Ursu
 
Situation task action_results_document_-_star_original_original
Situation task action_results_document_-_star_original_originalSituation task action_results_document_-_star_original_original
Situation task action_results_document_-_star_original_originalhmckinney704
 

Viewers also liked (16)

Usb
UsbUsb
Usb
 
Why Drivers Stay with Fleets
Why Drivers Stay with FleetsWhy Drivers Stay with Fleets
Why Drivers Stay with Fleets
 
The USB Generation
The USB GenerationThe USB Generation
The USB Generation
 
Usb
UsbUsb
Usb
 
Computer Interfaces
Computer Interfaces Computer Interfaces
Computer Interfaces
 
Pakaagee
PakaageePakaagee
Pakaagee
 
Linux Device Driver Training
Linux Device Driver TrainingLinux Device Driver Training
Linux Device Driver Training
 
Linux Device Driver’s
Linux Device Driver’sLinux Device Driver’s
Linux Device Driver’s
 
Introduction of USB 3.1
Introduction of USB 3.1 Introduction of USB 3.1
Introduction of USB 3.1
 
Device Driver in WinCE 6.0 R2
Device Driver in WinCE 6.0 R2Device Driver in WinCE 6.0 R2
Device Driver in WinCE 6.0 R2
 
Device Drivers
Device DriversDevice Drivers
Device Drivers
 
Wireless usb ppt
Wireless usb pptWireless usb ppt
Wireless usb ppt
 
Device Drivers
Device DriversDevice Drivers
Device Drivers
 
Електронні технології в місті Львові. Уляна Стадник
Електронні технології в місті Львові. Уляна СтадникЕлектронні технології в місті Львові. Уляна Стадник
Електронні технології в місті Львові. Уляна Стадник
 
IS1323 10-Sinyal
IS1323   10-SinyalIS1323   10-Sinyal
IS1323 10-Sinyal
 
Situation task action_results_document_-_star_original_original
Situation task action_results_document_-_star_original_originalSituation task action_results_document_-_star_original_original
Situation task action_results_document_-_star_original_original
 

Similar to Universal serial bus

Networking devices
Networking devicesNetworking devices
Networking devices
frestoadi
 
Chapter 3 esy
Chapter 3 esy Chapter 3 esy
Chapter 3 esy
Yogesh Mashalkar
 
networking devices -161021181705452555
networking   devices -161021181705452555networking   devices -161021181705452555
networking devices -161021181705452555
mercyzyada1999
 
Bus interface 8086
Bus interface 8086Bus interface 8086
Bus interface 8086
University of Gujrat, Pakistan
 
Usb Pinout
Usb PinoutUsb Pinout
Usb Pinout
Sais Abdelkrim
 
Acr5 dcb
Acr5 dcbAcr5 dcb
Acr5 dcb
kisloedxxx
 
The research of_portable_ecg_monitoring_system_with_usb_host_interface
The research of_portable_ecg_monitoring_system_with_usb_host_interfaceThe research of_portable_ecg_monitoring_system_with_usb_host_interface
The research of_portable_ecg_monitoring_system_with_usb_host_interface
ArhamSheikh1
 
Chapter05 -- networking hardware
Chapter05  -- networking hardwareChapter05  -- networking hardware
Chapter05 -- networking hardware
Raja Waseem Akhtar
 
CN 5151(15) Module I part 1.3 21072020.pdf
CN 5151(15) Module I part 1.3 21072020.pdfCN 5151(15) Module I part 1.3 21072020.pdf
CN 5151(15) Module I part 1.3 21072020.pdf
ADARSHN40
 
UART project report by Tarun Khaneja ( 09034406598 )
UART project report by Tarun Khaneja ( 09034406598 )UART project report by Tarun Khaneja ( 09034406598 )
UART project report by Tarun Khaneja ( 09034406598 )
Tarun Khaneja
 
wireless-usb-207-ipx1bSv.pptx
wireless-usb-207-ipx1bSv.pptxwireless-usb-207-ipx1bSv.pptx
wireless-usb-207-ipx1bSv.pptx
TanmayaKar4
 
Network Devices
Network DevicesNetwork Devices
Network Devices
SamiuR RahmaN
 
Network Topologies, L1-L2 Basics, Networking Devices
Network Topologies, L1-L2 Basics, Networking DevicesNetwork Topologies, L1-L2 Basics, Networking Devices
Network Topologies, L1-L2 Basics, Networking Devices
Aalok Shah
 
1.NggggggggggghhhhhhhhhhS UNIT - 1.pptx.pdf
1.NggggggggggghhhhhhhhhhS UNIT - 1.pptx.pdf1.NggggggggggghhhhhhhhhhS UNIT - 1.pptx.pdf
1.NggggggggggghhhhhhhhhhS UNIT - 1.pptx.pdf
sadoyah492
 
Communication protocols
Communication protocolsCommunication protocols
Communication protocols
Piyush Bhardwaj
 
Basic networking in power point by suprabha
Basic networking in power point by suprabhaBasic networking in power point by suprabha
Basic networking in power point by suprabha
Suprabha Sahoo
 
Embedded real time-systems communication
Embedded real time-systems communicationEmbedded real time-systems communication
Embedded real time-systems communicationVijay Kumar
 

Similar to Universal serial bus (20)

Networking devices
Networking devicesNetworking devices
Networking devices
 
Chapter 3 esy
Chapter 3 esy Chapter 3 esy
Chapter 3 esy
 
networking devices -161021181705452555
networking   devices -161021181705452555networking   devices -161021181705452555
networking devices -161021181705452555
 
Bus interface 8086
Bus interface 8086Bus interface 8086
Bus interface 8086
 
Usb Pinout
Usb PinoutUsb Pinout
Usb Pinout
 
Acr5 dcb
Acr5 dcbAcr5 dcb
Acr5 dcb
 
The research of_portable_ecg_monitoring_system_with_usb_host_interface
The research of_portable_ecg_monitoring_system_with_usb_host_interfaceThe research of_portable_ecg_monitoring_system_with_usb_host_interface
The research of_portable_ecg_monitoring_system_with_usb_host_interface
 
Chapter05 -- networking hardware
Chapter05  -- networking hardwareChapter05  -- networking hardware
Chapter05 -- networking hardware
 
CN 5151(15) Module I part 1.3 21072020.pdf
CN 5151(15) Module I part 1.3 21072020.pdfCN 5151(15) Module I part 1.3 21072020.pdf
CN 5151(15) Module I part 1.3 21072020.pdf
 
UART project report by Tarun Khaneja ( 09034406598 )
UART project report by Tarun Khaneja ( 09034406598 )UART project report by Tarun Khaneja ( 09034406598 )
UART project report by Tarun Khaneja ( 09034406598 )
 
wireless-usb-207-ipx1bSv.pptx
wireless-usb-207-ipx1bSv.pptxwireless-usb-207-ipx1bSv.pptx
wireless-usb-207-ipx1bSv.pptx
 
Network Devices
Network DevicesNetwork Devices
Network Devices
 
Network Topologies, L1-L2 Basics, Networking Devices
Network Topologies, L1-L2 Basics, Networking DevicesNetwork Topologies, L1-L2 Basics, Networking Devices
Network Topologies, L1-L2 Basics, Networking Devices
 
USB BASIC
USB BASICUSB BASIC
USB BASIC
 
Project_intership
Project_intershipProject_intership
Project_intership
 
Project_intership
Project_intershipProject_intership
Project_intership
 
1.NggggggggggghhhhhhhhhhS UNIT - 1.pptx.pdf
1.NggggggggggghhhhhhhhhhS UNIT - 1.pptx.pdf1.NggggggggggghhhhhhhhhhS UNIT - 1.pptx.pdf
1.NggggggggggghhhhhhhhhhS UNIT - 1.pptx.pdf
 
Communication protocols
Communication protocolsCommunication protocols
Communication protocols
 
Basic networking in power point by suprabha
Basic networking in power point by suprabhaBasic networking in power point by suprabha
Basic networking in power point by suprabha
 
Embedded real time-systems communication
Embedded real time-systems communicationEmbedded real time-systems communication
Embedded real time-systems communication
 

Recently uploaded

J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
BrazilAccount1
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
BrazilAccount1
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 

Recently uploaded (20)

J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 

Universal serial bus

  • 1. Universal Serial Bus • SUBMITTED TO: • DR. KAMRANULLAH • SUBMITTED BY: • MUHAMMAD MUZAFFAR KHAN • KHAWAR NADEEM • HAIDER ALI 1
  • 2. Outline  Introduction and Background  Architectural Overview  Electrical and Mechanical Characteristics  Protocol Layer  USB Device Framework  USB Host Hardware and Software  How to Create a USB Interface  Works Cited 2
  • 4. Introduction  Industry standard that defines the cables, connectors and communications protocols used in a bus for connection, communication, and power supply between computers and electronic devices  Developed in1996  By Joint efforts of  Intel, Microsoft, Digital Equipment Corporation, IBM, NEC, Nortel, Compaq  USB has superseded and effectively replaced Serial, Parallel & PS/2 ports 4
  • 5. Why USB?  To standardize connections of electrical devices, while maintaining and optimizing  High speed  Reliability  Cost of manufacturing  To make it fundamentally easier to connect external devices to PCs  by replacing the multitude of connectors at the back of PCs,  addressing the usability issues of existing interfaces,  simplifying software configuration of all devices connected to USB, 5
  • 6. Comparison of Speeds of USB  Low Speed - 1.5Mbits/s (USB version 1.1/1.0)  Full Speed - 12Mbits/s (USB version 1.1/1.0)  High Speed - 480Mbits/s (USB version 2.0)  High Speed – 4.8 Gbit/s (USB version 3.0)  Super Speed – 10 Gbit/s (USB version 3.1) 6
  • 8. Architectural Overview  Host-controlled  i.e. there can only be one host per bus.  Tiered Star Topology  similar to that of the 10BaseT Ethernet.  Requires the use of a hub in arrangement. 8
  • 9. Tiered Star Topology  Uses 7-bit addressing of devices  allowing connection of up to 127 devices on a single USB bus  Allows expandability and ease of use,  Each device can be handled and removed individually without interrupting others.  Allows plug’n’play connectivity which allows for dynamically loadable and unloadable devices and drivers.  Plug the device in and the host loads the drivers without needing a reboot or initiation/termination of connection, etc.  Unplug the device the absence is automatically detected by the host and the drivers are unloaded. 9
  • 11. Hub  Most devices come with a hub built-into the main circuitry and expose only the connector required to be plugged into the host (e.g. mouse, keyboard, etc.).  Hubs themselves are considered as USB devices, and may or may not have some level of ‘intelligence’ circuitry.  They are mainly required to increase the logical and physical fan-out of the network.  Devices attached to the Hub may work as any other USB devices, powered by either the Hub or any external source  Client, through software, communicates with every device as if it were connected directly; i.e. through direct addressing 11
  • 14. Mechanical Characteristics  There are commonly two kinds of USB connectors  Type A  Type B  Many cables are made with Type A connector on one end and Type B connector on the other.  This is an attempt to prevent improper physical connections between devices, as the connectors are not physically interchangeable. 14 Type A Type B
  • 15. Pin Configuration 15 Type A Type B PIN # Cable Color Signal 1 Red Vbus = +5V 2 White D- 3 Green D+ 4 Black Ground
  • 16. Electrical Characteristics  All USB devices have an upstream connection  All hosts have a downstream connection to the device,  These Connections are not interchangeable.  While Type A connectors on both ends are available in cables, two computers should not be connected together using a USB cable.  This is partly because of the fact that one topology can only have one host  it is also to prevent damage to the interface: If two computers are connected to each other using one cable, it would cause their 5V supplies to short and cause damaging current flow. Two computers can, however, share a single peripheral device using a hub. 16
  • 17. Electrical Characteristics  The parallel data is first serialized, then transmitted, and then parallelized at the receiving end  Non-return to zero invert (NRZI) scheme of encoding data  includes a sync field required to synchronize host and receiver clocks. 17
  • 18. USB – Voltage Levels  Transmitted Side:  Differential ‘1’ is transmitted by  pulling D+ over 2.8V with a 15k ohm resistor pulled to ground  D- under 0.3V with a 1.5k resistor pulled to 3.6V  Differential ‘0’ is transmitted by  D+ less than 0.3V  D- greater than 2.8V (with the appropriate resistors).  Receiver Side:  Differential ‘1’ is received when D+ is 200mV greater than D- 18
  • 19. USB – Logic Levels  Low Speed/Full Speed Bus=>Characteristic Impedance=90Ω+/- 15%.  Select Impedance matching series resistors for D+ and D- accordingly.  The polarity of the signal is inverted depending on the speed of the bus.  Terms ‘J’ and ‘K’ are used to signify the logic levels.  In low speed  J state is a differential 0.  K state is a differential 1.  In high speed  J state is a differential 1.  k state is a differential 0. 19
  • 20. USB – Logic Levels  High Speed (480Mbit/s) Mode uses a 17.78mA constant current for signaling to reduce noise.  USB device must indicate to the host whether it is using a low speed or high speed connection.  For low speed, D- is pulled to 3.3V  For high speed D+ is pulled to 3.3V 20
  • 21. Classes of USB Functions  Low-powered Bus Functions  Derive all the power from Vbus  Cannot draw more than 1 unit load defined as 100mA  Work between voltages of 5.25V down to 4.40V  High-Powered Bus Functions  Draw 1 unit load until they are configured, after which they can draw 5 unit loads (500mA max).  Work between 4.40V and 5.25V.  Self-Powered Bus Functions  Drain upto 1 unit load and consume the remaining power from an external source.  In case the external source should fail, provisions must be in place to prevent more than 100mA of current draw. 21
  • 22. Caution!!!  Precautions need to be taken in creation of devices, for which the USB specification require that to prevent excessive inrush current should be limited by not having a decoupling capacitance of less than 1uF or more than 10uF.  The total power draw of the device of 500mA max must include  Currents drawn by the pull-up and pull-down resistors of D+ and D-,  Current wasted by the voltage regulator in stepping down from 5V to 3.3V for the device 22
  • 23. USB Suspend Mode  No Activity for 3ms  Suspend Mode  Rated Suspend Current = 500uA for a device with one unit load.  Suspend Current includes  Idle current drawn by resistors and regulator  Design Constraint  Where battery drain is not an issue, a Keep Alive packet must be sent periodically to keep device from entering suspend mode.  The time frames for these are given below.  A high speed bus will have micro frames sent every 125us +/- 62.5ns  A full speed bus will have a frame sent each 1ms +/- 500ns.  A low speed bus will have a keep alive (end of packet) data sent every 1ms in the absence of data transfer. 23
  • 25. USB Packet Types  Data is sent in packets Least Significant Bit (LSB) first.  There are 4 main USB packet types:  Token  Data  Handshake  Start of Frame  The packets are then bundled into frames to create a USB message 25
  • 26. USB Packet Fields  Each packet is constructed from different field types,  SYNC (synchronize)  PID (packet ID)  Address  Data  Endpoint  CRC (cyclic redundancy check)  EOP (end of packet) 26
  • 27. USB Packet Fields  Synchronize (Sync):  All packets must start with a sync field.  Used to synchronize clock rate between device and host.  It is 8 bits for low speed and 32 bits for full/high speed connection.  Packet ID (PID):  Packet ID identifies the type of packet being sent.  It has 4 bits for the value, and another 4 bits of the inverted value to prevent errors.  Address:  7 bit field  Specifies the device the packet is intended for out of 127 devices that can be connected to a single bus. 27
  • 28. USB Packet Fields  Endpoint:  4-bit long,  Allows for further flexibility in addressing.  Can also be split for IN or OUT data.  Cyclic Redundancy Checks (CRC):  Performed on the data with the packet payload.  All token packets have 5 bit CRC while data packets have 16 bit CRC.  End of Packet (EOP):  Signaled by a ‘0’ for approximately 2 bit times followed by a J for 1 bit time. 28
  • 29. Token Packet Format  In  Informs the USB device that host wishes to read information.  Out  Informs the USB device that the host wishes to send information.  Setup  Used to begin control transfers  Token packets have the following format: 29 Sync PID ADDR ENDP CRC EOP
  • 30. Data Packet Format  Maximum data payload size for low-speed devices is 8 bytes.  Maximum data payload size for full-speed devices is 1023 bytes.  Maximum data payload size for full-speed devices is 1024 bytes.  Payloads must be sent in multiples of bytes.  Data packets have the following format: 30 Sync PID Data CRC EOP
  • 31. Handshake Packet Format  There are three types of packets which consist simply of PID.  ACK:  Acknowledgement that the packet has been successfully received.  NACK:  Reports that the device can not send or receive data. Also used to interrupt when no data is available to send.  STALL  The device is in a state that requires intervention from the host. 31 Sync PID EOP
  • 32. Start of Frame Packet Format  Data is split into frames before being transmitted.  The start of frame packet is used to signify the frame number to the host.  The frame number field is 11 bits long. 32 Sync PID Frame Number CRC EOP
  • 34. Virtual Pipes – Logic Channels  USB device communication is based on Pipes or Logic Channels that connect the peripheral's Endpoints with the host.  Virtual Pipe is a Logical Connection from the host controller to a device.  Since it is a logical connection, the pipe may be opened or closed.  There are two types of pipes:  Message Pipe:  A message pipe is bi-directional and is used for control transfers. Message pipes are typically used for short, simple commands to the device.  Stream Pipe:  A stream pipe is a unidirectional pipe connected to a unidirectional endpoint that transfers data. 34
  • 35. End-point  The point of connection on the device.  IN and OUT endpoints are different, not multiplexed.  An endpoint is defined and numbered by the device during the time period after physical connection, also known as enumeration time.  The endpoint is permanent.  An endpoint is addressable in the token packet.  There are four bits used to address an endpoint, which translates to a device having up to 15 endpoints  endpoint 0 is reserved for control transfers throughout the duration the device is connected to the bus, every peripheral device must support it 35
  • 36. 36
  • 37. Descriptors  Data Structure to inform the host about the endpoint's configuration and expectations.  When establishing communications with the peripheral, each endpoint returns a descriptor,  Descriptors include  transfer type,  max size of data packets,  interval for data transfers,  the bandwidth needed. 37
  • 38. Types of Descriptors  Device Descriptor:  This contains information that applies globally to the device, such as  serial number,  product ID,  vendor ID, etc.  This information is used to load device drivers on the host end.  Configuration Descriptor:  A Device Descriptor can have one or more Configuration Descriptors.  These are used to inform the host about  How the device is powered (bus powered, self powered, etc.),  The maximum power consumption,  What interfaces are available for the setup.  The host can choose to read the entire hierarchy or just the Configuration Descriptor. 38
  • 39. Types of Descriptors  Interface Descriptor:  These help to more finely group the endpoints,  also contain information to help the host select a driver for communication with the USB device.  An interface descriptor defines one or more endpoints.  Endpoint Descriptor:  The endpoint descriptor is the last leaf in the configuration hierarchy  It defines the bandwidth requirements, transfer type, and transfer direction of an endpoint.  For transfer direction, an endpoint is either a source (IN) or sink (OUT) of the USB device. 39
  • 40. Descriptors Hierarchy  Every USB device has a hierarchy of descriptors, which are used to inform the host about the type of device. 40
  • 41. Descriptors Hierarchy  Each device can only have one Device Descriptor.  Multiple Configuration Descriptors can be used to group device functions; however only one Configuration Descriptor can be active at a time.  These are further divided into multiple Interface Descriptors, but similar to Configuration Descriptors, only one can be active at a time.  The Interface Descriptors can be used to group multiple endpoints for a single function. 41
  • 42. Data Transfer Types  Control  Isochronous  Bulk  Interrupt 42
  • 43. Data Transfer Types  Control:  Control transfers are used to exchange configuration and commands between the device and the host.  Isochronous:  Used by time-critical, streaming devices  such as speakers and video cameras  Fixed bandwidth and a Free connection to the host.  These have almost guaranteed access to the USB bus.  Data streams between device and host are real-time and hence error correction is not used. 43
  • 44. Data Transfer Types  Bulk:  Where timing is not critical  Such as Printers and Scanners.  Data is sent in bigger packets.  Error correct is used on these packets.  Interrupt:  Data that need immediate attention.  Such as mouse or a keyboard  Small amount of Data Exchange  Error checking validates the data. 44
  • 45. Data Transfer Types  The USB divides the available bandwidth into frames, and the host controls the frames.  Frames contain 1,500 bytes, and a new frame starts every millisecond.  During a frame, isochronous and interrupt devices get a slot so they are guaranteed the bandwidth they need.  Bulk and control transfers use whatever space is left. 45
  • 47. USB Hardware Classes  The host controller is part of the computer hardware.  Control is managed by a device known as a Hardware Controller Device (HCD) which is defined by the hardware implementer.  USB defines class codes used to identify a device's functionality and to load a device driver based on that functionality.  This enables a device driver writer to support devices from different manufacturers that comply with a given class code. 47
  • 48. USB Device Classes  The USB-IF Device Working Group defines a discrete number of device classes.  The idea was to simplify software development by specifying a minimum set of functionality and characteristics that is shared by a group of devices and interfaces.  Devices of the same class can all use the same USB driver.  This saves the end-user the time of installing a driver for every single USB device that is connected to their host PC.  Input devices such as mice, keyboards and joysticks are all part of the HID (Human Interface Device) class.  Mass Storage class covers removable hard drives and keychain flash disks  However, a device does not necessarily need to belong to a specific device class. In these cases, the USB device will require its own USB driver that the host PC must load to make the functionality available to the host. 48
  • 49. How to Create a USB Interface? 49
  • 50. Microcontrollers  Designing an USB Interface needs both hardware and software competence  Many commonly used microcontrollers support USB interfacing directly  Microcontrollers allow the designer a higher level of abstraction when dealing with the creation of a USB interface.  Such controllers usually have dedicated pins which may be used at the +5V, GND, V+ and V- for the USB pins readily.  Commonly found cheaper microcontrollers are slow compared to the data transfer rates of the USB protocol.  Even the low speed USB interface (1.5 Mbit/sec) may be too high for some controllers. A simple calculation goes as follows: 50
  • 51. Speed Incompatibility Problem! Microcontroller  Say a microcontroller has 6M instructions per second (at 24MHz and 4 cycles/instruction),  i.e. it needs 6 cycles to complete per second. USB  For one bit of low speed USB processing (i.e. 1.5 Mbit/sec) it would require 6/1.5 = 4 clock cycles.  This is simply too slow for USB, and this is exactly the case with, for example, the popular controller PIC16F84. 51
  • 52. Development Boards  Prototyping and development boards such as the  TI Beagleboard,  NXP mbed,  Arduino  provide the designer with an even higher level of abstraction and make USB interfacing almost trivial to hobbyists and designers who may not be extremely proficient at writing complicated code.  These development boards also come with higher quality components (the BeagleBoard has an ARM core processor) which may be used for high speed USB connections as well. 52
  • 53. Device Drivers  The host is what initiates the USB traffic. When the device is plugged in, the host detects and connects to the peripheral hardware.  The descriptor is what informs the host of the device specifications such as the vendor ID and product ID (VID/PID).  The USB devices can identify themselves as specific classes and subclasses of devices to use the framework and drivers which already available by the USB Implementers Forum (see more at www.usb.org) which have been implemented across many operating systems.  This prevents the designer from going through the sizable and needless effort of writing his/her own device driver to interface with the host.  USB devices that comply with a specific USB class enable cross-vendor and cross- platform compatible USB devices.  The USB specification specifies hundreds of device classes that enable the generic implementation of, for example, Ethernet dongles, mixing desks, or flash disks and enable operating systems to provide generic drivers for these classes. 53
  • 54. Device Drivers  There are cases where the USB device does not have any OS support and it should interact with a user program directly. In that case, a generic driver such as the open- source libusb driver that allows an application program to communicate with any USB device can be used.  The device will be advertised as vendor-specific. Through the libusb interface the user program can detect a device with a VID and PID that it wants to interact with, claim an interface, open an endpoint, and send IN and OUT requests to that endpoint.  For connection of USB between a device and a computer, the operating system dependent drivers are usually available. For instance, Microsoft Corporation has a database of information pertaining to USB connection between many different types of devices and their Windows operating system, which can be used for assistance in the project.  An excellent collection of info, sample source code, and interfacing using a PIC microcontroller and generic PC USB drivers can be found their website. 54
  • 55. Work Cited  Stevens, Tim. USB 3.0 SuperSpeed... Engadget. [Online] January 10, 2010. http://www.engadget.com/2010/01/09/usb-3-0-superspeed-gone-wild-at-ces-2010- trumps-even-your-new-s/.  Melissa J. Perenson. SuperSpeed USB 3.0: More Details Emerge. PCWorld. [Online] January 6, 2009. http://www.pcworld.com/article/156494/superspeed_usb.html.  Cohen, Peter. USB 3.1 vs Thunderbolt - the battle is on! iMore. [Online] August Thursday, 2013. http://www.imore.com/usb-31-spec-finalized-will-match-thunderbolt-1-speeds.  EE Herald. Online course on Embedded Systems. EE Herald. [Online] http://www.eeherald.com/section/design-guide/esmod14.html.  Peacock, Craig. USB In A Nutshell. BeyondLogic. [Online] September Friday, 2010. http://www.beyondlogic.org/usbnutshell/usb1.shtml.  FTDI Chip. USB Data Packet Structure Version 1.0. FTDI Chip. [Online] http://www.ftdichip.com/Support/Documents/TechnicalNotes/TN_116_USB%20Data%20 Structure.pdf. 55
  • 56. Work Cited  Universal Serial Bus. Wikipedia. [Online] http://en.wikipedia.org/wiki/USB.  USB Background. Total Phase. [Online] [Cited: February 16, 2014.] http://www.totalphase.com/support/articles/200349256/.  Muller, Henk. How To Create And Program USB Devices. Electronic Design. [Online] July 27, 2012. http://electronicdesign.com/boards/how-create- and-program-usb-devices.  Microsoft Corporation. USB Host Drivers (Compact 2013). Microsoft Developer Network. [Online] http://msdn.microsoft.com/en- us/library/gg156249.aspx.  picusb. Google Code . [Online] http://code.google.com/p/picusb/. 56
  • 57. 57