+ All Categories
Home > Documents > - Madhav Singh-. This presentation describe the basics of USB device and Host side i.e....

- Madhav Singh-. This presentation describe the basics of USB device and Host side i.e....

Date post: 23-Dec-2015
Category:
Upload: luke-blankenship
View: 215 times
Download: 1 times
Share this document with a friend
Popular Tags:
41
Introduction to USB - Madhav Singh-
Transcript
  • Slide 1
  • - Madhav Singh-
  • Slide 2
  • This presentation describe the basics of USB device and Host side i.e. descriptors, endpoints, device controller, root hub etc. It covers USB architecture in Linux. It does not cover protocol level details of USB.
  • Slide 3
  • USB Introduction USB Host /Device Terminology USB Host Controller USB Topology and Root Hub USB Device Basics Endpoints Descriptors Linux USB Architecture Overview
  • Slide 4
  • USB stands for UNIVERSAL SERIAL BUS. USB is host controlled. There can only be one host per bus. Specification in itself, does not support any form of multimaster arrangement. Topologically, a USB subsystem is not laid out as a bus; it is rather a tree built out of several point-to-point links.
  • Slide 5
  • The links are four-wire cables (ground, power, and two signal wires) that connect a device and a hub. Up to 127 devices(7 bit device addressing scheme) can be connected to any one USB bus at any one given time. It was originally created to replace a wide range of slow and different busesthe parallel, serial, and keyboard connectionswith a single bus type that all devices could connect to.
  • Slide 6
  • USB Implementers Forum(USB-IF): - USB Implementers Forum, Inc. is a non-profit corporation founded by the group of companies that developed the Universal Serial Bus specification. -The USB-IF was formed to provide a support organization and forum for the advancement and adoption of Universal Serial Bus technology. (http://www.usb.org/ official site)http://www.usb.org/ The USB-IF, Inc. Board of Directors is composed of the following companies: Hewlett-Packard Company Intel Corporation LSI Corporation Microsoft Corporation Renesas Electronics ST-Ericsson
  • Slide 7
  • PinNameCable colorDescription 1VBUSRed+5 V 2DD WhiteData 3D+GreenData + 4GNDBlackGround USB 1.x/2.0 STANDARD pinning
  • Slide 8
  • PinNameCable colorDescription 1VBUSRed+5 V 2DD WhiteData 3D+GreenData + 4IDNone permits distinction of A plug from B plug * A plug: connected to Signal Ground * B plug: not connected 5GNDBlackGround USB 1.x/2.0 Mini/Micro pinning
  • Slide 9
  • Host - The host system where the USB Host Controller is installed. Controller This is the hardware entity that provides the USB interface. E.g. Host Controller, Device Controller etc. Device Connected to Host controller, communicate using USB protocol eg. memory stick, digital camera, printer etc. Dual Role Devices (OTG) Those devices which can function both as a host or as a peripheral.
  • Slide 10
  • USB Host Controller Types: OHCI (Open Host Controller Interface) Compaq's implementation adopted as a standard for USB 1.0 and 1.1 by the USB Implementers Forum (USBIF). UHCI (Universal Host Controller Interface.) Created by Intel, insisting that other implementers use it and pay royalties for it. This competition required to test devices for both host controller standards. For USB 2.0, the USBIF insisted on having only one standard.
  • Slide 11
  • EHCI Extended Host Controller Interface. For USB 2.0. The only one to support high speed transfers. Significant Contributors include Intel, Compaq, NEC, Lucent and Microsoft.
  • Slide 12
  • CPU Memory Controller Hub ( MCH ) IO Controller Hub( ICH ) USB Controller RAM Super IO COM, PS2 Keybo ard VDU North Bridge South Bridge FSBFSB HUBIFHUBIF LPC PCIPCI HOST Controller in IA
  • Slide 13
  • LowSpeed: Up to 1.5 Mbps Since USB 1.0 Ex. Mouse, Keyboard etc. FullSpeed: Up to 12 Mbps Since USB 1.1 Ex. Pen drives, Printers etc. HiSpeed: Up to 480 Mbps Since USB 2.0 Ex. HDD, Network Adapters, Web Cam etc.
  • Slide 14
  • Every Host Controller will have a Root Hub. Root hub enables connection of USB devices to the host A root-hub converts the requested Tx into low level protocols required by USB. USB Host controller Root Hub Ports through which USB devices can be connected - Other Operations: Control Power to USB devices Enable/Disable Ports Recognize Device attached to Port
  • Slide 15
  • Provides extensibility to USB network Allows more than 1 device to be connected to the host Can be self powered or Bus powered Host Root Hub Device HUB Device HUB Device Host Root Hub Device HUB Device HUB
  • Slide 16
  • Can have up to 7 tiers of devices. Maximum number of devices that can be connected is 127 Every use of a hub increases the tier of devices. Every device in the tree has a Device Address
  • Slide 17
  • Endpoint(EP) Endpoints can be described as sources or sinks of data A USB endpoint can carry data in only one direction, either from the host computer to the device (called an OUT endpoint) or from the device to the host computer (called an IN endpoint). Physical entity. Per Device max 16 EP are possible All devices must support EP0, This is the endpoint which receives all of the devices control and status requests during enumeration and throughout the duration while the device is operational on the bus.
  • Slide 18
  • USB support of 4 types of Endpoints Control Endpoint Interrupt Endpoint Bulk Endpoint Isochronous Endpoint
  • Slide 19
  • Used to configure the device, get information about it, send commands to it, retrieve status information. Simple, small data transfers. Every device has a control endpoint (endpoint 0),used to configure the device at insertion time. The USB protocol guarantees that the corresponding data transfers will always have enough (reserved) bandwidth.
  • Slide 20
  • Transfer small amounts of data at a fixed rate each time the host asks the device for data. Transfers are guaranteed by the USB protocol to always have enough reserved bandwidth For devices requiring guaranteed response time, such as USB mouse and keyboards. Generally not used to transfer large amounts of data.
  • Slide 21
  • Bulk endpoints transfer large amounts of data. No guarantee on bandwidth or latency. Guarantee that no data is lost. Typically used for printers, storage or network devices.
  • Slide 22
  • Also for large amounts of data. Guaranteed speed(often but not necessarily as fast as possible). No guarantee that all data makes it through. Used by real time data transfers (typically audio and video).
  • Slide 23
  • Slide 24
  • All USB devices have a hierarchy of descriptors, which gives information to the host, such as what the device is, who is vendor, what version of USB it supports, how many ways it can be configured, the number of endpoints and their types etc. Common USB Descriptors: Device Descriptor Configuration Descriptor Interface Descriptor Endpoint Descriptor USB Descriptors Format: All descriptors are made up of a common format. The first byte specifies the length of the descriptor
  • Slide 25
  • USB Descriptors Format: If the length of a descriptor is smaller than what the specification defines, then the host shall ignore it if the size is greater than expected the host will ignore the extra bytes and start looking for the next descriptor at the end of actual length returned.
  • Slide 26
  • The device descriptor of a USB device represents the entire device. As a result a USB device can only have one device descriptor. Device descriptor includes information USB revision the device complies to Product and Vendor IDs used to load the appropriate drivers number of possible configurations the device can have Class of device i.e. storage, network, HID etc.
  • Slide 27
  • Some important fields of device descriptor: bcdUSB field reports the highest version of USB the device supports. bDeviceClass, used by the operating system to find a class driver for your device, ex HID, Storage, Network etc idVendor and idProduct are used by the operating system to find a driver for your device. The Vendor ID is assigned by the USB-IF bNumConfigurations defines the number of configurations the device supports at its current speed.
  • Slide 28
  • The configuration descriptor specifies how the device is powered. Therefore it is possible to have two configurations, one for when the device is bus powered and another when it is mains powered. USB device can switch to different configuration for changing state of device. Each configuration descriptor consists of no(s) of Interface Descriptor.
  • Slide 29
  • Some important fields of configuartion descriptor: bNumInterfaces specifies the number of interfaces present for this configuration. bConfigurationValue is used by the SetConfiguration request to select this configuration. bmAttributes specify power parameters for the configuration, whether a device is self powered or bus powered. bMaxPower defines the maximum power the device will drain from the bus.
  • Slide 30
  • The interface descriptor could be seen as a header or grouping of the endpoints into a functional group performing a single feature of the device. Each interface encapsulates a single high level function, USB logical connection. One driver is needed for each interface. Important Fields: bInterfaceNumber indicates the index of the interface descriptor. This should be zero based, and incremented once for each new interface descriptor. bNumEndpoints indicates the number of endpoints used by the interface. bInterfaceClass can be used to specify supported classes (e.g. HID, communications, mass storage etc.)
  • Slide 31
  • Endpoint descriptors are used to describe endpoints other than endpoint zero. Endpoint zero is always assumed to be a control endpoint and is configured before any descriptors are even requested. The host will use the information returned from these descriptors to determine the bandwidth requirements of the bus. Important Fields: bmAttributes specifies the transfer type. bEndpointAddress indicates its address, its direction IN or OUT wMaxPacketSize indicates the maximum payload size for this endpoint.
  • Slide 32
  • Slide 33
  • USB device overview ConfiguratiConfiguration Active Interface Audio endpoint control endpoint input Interface Video endpoint control endpoint input Configurati Configuration Standby Interface Audio endpoint control endpoint input Interface Video endpoint control endpoint input Device USB WEB CAM
  • Slide 34
  • USB Driver Overview
  • Slide 35
  • The Linux kernel supports two main types of USB drivers: Drivers on a Device Controller Side. Drivers on Host Controller Side Drivers On Host Controller Side: The USB drivers for a host system control the USB devices that are plugged into it, from the hosts point of view. A common USB host is a desktop computer.
  • Slide 36
  • Drivers On Host Controller Side: USB core drivers Architecture independent kernel subsystem. Implements the USB bus specification. USB core provides an interface for USB drivers to use to access and control the USB hardware, without having to worry about the different types of USB hardware controllers that are present on the system. USB host drivers Different drivers for each USB control hardware. Usually available in the Board Support Package. Architecture and platform dependent.
  • Slide 37
  • Drivers On Host Controller Side USB device drivers Drivers for devices on the USB bus. Platform independent: you can use any USB device supported by Linux (cameras, keyboards, Wi-Fi dongles...). USB drivers live between the different kernel subsystems (block, net, char, etc.) and the USB hardware controllers.
  • Slide 38
  • Linux USB overview(Host Controller Side) System call interface USB host controller driver User applications USB host controller USB device USB core USB device drivers Kernel Users Hardware Kernel subsystems Other kernel subsystems LIBUSB User Application
  • Slide 39
  • Drivers On Device Controller Side: USB drivers in a device, control how that single device looks to the host computer as a USB device. As the term USB device drivers is very confusing, the USB developers have created the term USB gadget drivers to describe the drivers that control a USB device that connects to a computer Typical example: Digital cameras, Mobile You connect the device to a PC and see the camera as a USB storage device. USB device controller driver: Platform dependent. Supports the chip connecting to the USB bus.
  • Slide 40
  • Drivers On Device Controller Side : USB gadget drivers Platform independent Ethernet gadget: implements networking through USB Storage gadget: makes the host see a USB storage device Serial gadget: for terminal-type of communication
  • Slide 41
  • http://kernel.org/ http://kernel.org/ http://www.beyondlogic.org http://www.beyondlogic.org http://en.wikipedia.org/ http://en.wikipedia.org/ Linux Device Driver Book by Alessandro Rubini

Recommended