Simplified Description of USB Device Enumeration



Similar documents
Determining USB Peripheral Device Class

Application Note. AN_136_Hi-Speed Mini Module EEPROM Disaster Recovery

Application Note AN_149. Upgrading a passive DB9 RS232 Interface to an active USB Interface using an FTDI DB9-USB-RS232 Module

Future Technology Devices International Ltd. USB-Key. Datasheet

Technical Note TN_152. USB 3.0 Compatibility Issues Explained

White Paper WP_001. Connecting Peripherals to an Android Platform

Future Technology Devices International Ltd. USB NMC-2.5m. USB to USB Null Modem Cable. Datasheet

TTL-232R-PCB. TTL to USB Serial Converter PCB. Datasheet

Application Note AN_385. FTDI D3XX Driver Installation Guide

Technical Note. TN_134 FTDI Android D2XX Driver

Future Technology Devices International Ltd. FTDI Drivers Installation guide for Windows XP

Future Technology Devices International Ltd. AN232R-02 FTDIChip-ID for the FT232R and FT245R

Future Technology Devices International Ltd. Technical Note TN_101

Application Note AN_243. FT312D USB Host to UART Cable Application

Future Technology Devices International Ltd. FTDI Drivers Installation guide for. Windows VISTA

Future Technology Devices International Ltd. FTDI Drivers Installation guide for. Windows 7

Future Technology Devices International Ltd

Future Technology Devices International Ltd USB TO RS422 UART SERIAL CONVERTER PCB. Datasheet. Document Reference No.: FT_000119

Application Note AN_101. Submitting Modified FTDI Drivers for Windows Hardware Certification

FT2232H Mini Module. USB Hi-Speed FT2232H Evaluation Module. Datasheet

FT4232H Mini Module. USB Hi-Speed FT4232H Evaluation Module. Datasheet

Future Technology Devices International Ltd. USB to RS232 UART Serial Converter PCB. Datasheet

Future Technology Devices International Ltd

VDIP1. Vinculum VNC1L Module. Datasheet

Future Technology Devices International Ltd. Application Note AN_234. FTDI Drivers Installation guide for. Windows 8

Future Technology Devices International Ltd. Windows XP Installation Guide

Command Processor for MPSSE and MCU Host Bus Emulation Modes

UMFT4222PROG FT4222 Programmer Module

Application Note AN_185. Vinculum-II UART to USB HID Class Host Bridge

Application Note AN_242

Future Technology Devices International Ltd. FTDI Drivers Installation guide for Windows XP

Application Note AN_209. AN_209 PDIUSBD12 to FT120 Migration Guide

AN295 USB AUDIO CLASS TUTORIAL. 1. Introduction. 2. USB, Isochronous Transfers, and the Audio Class Overview USB Operational Overview

Application Note AN_241. FTDI_AOA_HyperTerm_User_Manual

Technical Note TN_158. What is the Camera Parallel Interface?

USB Hi-Speed Serial/Hub Module. Datasheet

Technical Note. TN_132 Adding FTDI Devices VCP Driver Support to Android

TTL-232R. TTL to USB Serial Converter Range of Cables. Datasheet

Future Technology Devices International Ltd. USB to RS232 Serial Converter Range of Cables. Datasheet

VF2F. USB Flash Disk File-to-file Transfer Vinculum Evaluation Kit. Future Technology Devices International Ltd. Preliminary - Subject to Change

AN249 HUMAN INTERFACE DEVICE TUTORIAL. Relevant Devices This application note applies to all Silicon Labs USB MCUs. 1.

Technical Note TN_146. Creating Android Images for Application Development

Application Note AN_299. FT800_FT801_Internal_Clock _Trimming

Bypassing Endpoint Security for $20 or Less. Philip A. Polstra, ppolstra.blogspot.com

AN1164. USB CDC Class on an Embedded Device INTRODUCTION ASSUMPTIONS FEATURES LIMITATIONS

Technical Note TN_105

Application Note AN_276. FT800 Audio File Conversion

C232HD. USB 2.0 Hi-Speed to UART Cable. Datasheet

USB-COM422-PLUS1. Datasheet

TTL-232R-3V3 USB to TTL Serial Converter Cable

Future Technology Devices International Ltd. VF2F2. USB Flash Disk File-to-file Transfer Vinculum Evaluation Kit.

FTDI Chip. VM800P Datasheet Embedded Video Engine Plus Module. VM800P Embedded Video Engine Plus Module Datasheet Version 1.0

TTL-232R. TTL to USB Serial Converter Range of Cables. Datasheet

PL2571 (Chip Rev B) Hi-Speed USB to SATA Bridge Controller Product Datasheet

Technical Note. TN_147 Java D2xx for Android

Universal Serial Bus Device Class Definition for Printing Devices

DB9-USB-RS232 Module. Male & Female. Datasheet

C232HM. USB 2.0 Hi-Speed to MPSSE Cable. Datasheet

Future Technology Devices International Ltd

AVR32807: Getting Started with the AVR UC3 Software Framework USB Classes. 32-bit Microcontrollers. Application Note. Features.

PL-2303HX Edition (Chip Rev A) USB to Serial Bridge Controller Product Datasheet

USB-COM232-PLUS4. Datasheet

SMART Modular Small Form Factor USB Key

Application Note AN_146. USB Hardware Design Guidelines for FTDI ICs

USB-COM422-PLUS2. Datasheet

USB Overview. This course serves as an introduction to USB.

Universal Serial Bus Mass Storage Class. Bulk-Only Transport

The DB9-USB Family of. UART Converter Modules. Datasheet

Vinco Development Module. Datasheet

FTDI Ltd DS_US232R-10(R-100/500) USB to RS232 Adapter cable. Data Sheet

Application Note AN_254. FT800 Designs With Visual TFT

Nitrogen D2 16-Bit Stereo USB Audio Controller. Datasheet Version 1.02

A Development Platform for Microcontroller STM32F103

Future Technology Devices International Ltd. UM245R USB - Parallel FIFO. Development Module. Datasheet

Application Note AN_250. Configuring FT313H Driver for Embedded Linux

Application Note AN_208. FT311D and FT312D Demo_APK_User_GuideFT311D and FT312D Demo_APK_User_Guide

CM108 High Integrated USB Audio I/O Controller. DataSheet 1.6

Application Note. 8-bit Microcontrollers. AVR276: USB Software Library for AT90USBxxx Microcontrollers

NOW LEAD-FREE! VCCIO VCCIO RXLED TXLED DTR# 10K FTDI FT232R

Exploiting USB Devices with Arduino. Greg Ose Black Hat USA 2011

USB / Data-Acquisition Module NOW LEAD-FREE

Application Note AN_100. Using the FT232R/FT245R with an External Crystal or Oscillator

USB HID Drivers on OpenSolaris and Linux By Example. Copyright 2009: Max Bruning Kernel Conference Australia, July, 2009

Future Technology Devices International Ltd. FT311D

Application Note AN_252. FT800 Audio Primer

TB055. PS/2 to USB Mouse Translator IMPLEMENTATION OVERVIEW. Hardware FIGURE 1: PS/2 TO USB MOUSE TRANSLATOR HARDWARE DIAGRAM (1)

Application Note AN_113. Interfacing FT2232H Hi-Speed Devices To I2C Bus

AVR069: AVRISP mkii Communication Protocol. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

UM245R USB-Parallel FIFO Development Module

USB ENGINEERING CHANGE NOTICE

UC232R ChiPi Minimum Component FT232RL USB to RS232 Converter Cable

DK40 Datasheet & Hardware manual Version 2

UM PN533 User Manual. Document information. Keywords NFC, PN533, V2.7. This document describes the firmware V2.7 embedded in the PN533.

An Analysis of Wireless Device Implementations on Universal Serial Bus

AN1163. USB HID Class on an Embedded Device FEATURES INTRODUCTION LIMITATIONS ASSUMPTIONS SYSTEM HARDWARE. Microchip Technology Inc.

DLP-USB232M USB SERIAL UART Interface Module

Transcription:

Future Technology Devices International Ltd. Technical Note TN_113 Simplified Description of USB Device Enumeration Document Reference No.: FT_000180 Issue Date: 2009-10-28 USB Enumeration is the process of detecting, identifying and loading drivers for a USB device. The purpose of this document is to provide an overview of the mechanics of the process. Future Technology Devices International Limited (FTDI) Unit1, 2 Seaward Place, Centurion Business Park, Glasgow G41 1HH United Kingdom Tel.: +44 (0) 141 429 2777 Fax: + 44 (0) 141 429 2758 E-Mail (Support): support1@ftdichip.com Web: http://www.ftdichip.com Copyright 2009 Future Technology Devices International Limited

TABLE OF CONTENTS 1 Introduction... 2 2 Detecting a Device has been Connected... 3 3 Determining the Device Speed... 4 4 Determining What Device is Attached (Device Descriptor)... 5 4.1 blength.... 5 4.2 bcdusb.... 5 4.3 bdeviceclass, bdevicesubclass and bprotocol... 5 4.4 bmaxpacketsize... 6 4.5 idvendor and idproduct... 6 4.6 imanufacturer, iproduct and iserialnumber... 6 5 Determining the Device Configuration (Configuration Descriptor)... 7 5.1 wtotalength... 7 5.2 bnuminterfaces... 7 5.3 bconfigurationvalue... 7 5.4 iconfiguration... 7 5.5 bmattributes... 7 5.6 bmaxpower... 7 6 Determining the Device Interface (Interface Descriptor)... 8 6.1 binterfacenumber... 8 6.2 balternatesetting... 8 6.3 bnumendpoints... 8 6.4 binterfaceclass, binterfacesubclass and binterfaceprotocol... 8 6.5 iinterface... 8 7 Loading the Driver... 9 8 Summary... 10 9 Contact Information... 11 Appendix A Terminology... 13 Appendix B Enumeration Flow... 14 Appendix C Device Classes... 15 Appendix D Standard Descriptor Types... 16 Appendix E References... 17 Appendix F Revision History... 18 Copyright 2009 Future Technology Devices International Limited 1

1 Introduction USB Enumeration is the process of detecting, identifying and loading drivers for a USB device. This involves a mixture of hardware techniques for detecting something is present and software to identify what has been connected. The purpose of this document is to provide an overview of the mechanics of the process. Copyright 2009 Future Technology Devices International Limited 2

2 Detecting a Device has been Connected A USB interface consists of 4 wires. Power, Ground, Data Plus (USBDP) and Data Minus (USBDM). A USB host port with no devices connected uses 15kohm resistors to connect both USB DP and USB DM to GND. When a USB device (sometimes referred to as a slave) is plugged into a USB host there is a change on these USB data lines. It is this change that the USB host uses to detect a device has been connected. This change is also used to identify the speed of device attached. Copyright 2009 Future Technology Devices International Limited 3

3 Determining the Device Speed A low speed USB device (1.5Mbps) uses a 1k5 pull-up resistor to VCC on the USB DM signal line. A full speed USB device (12Mbps) uses a 1k5 pull-up resistor to VCC on the USB DP signal line. A high speed USB device (480Mbps) will initially appear as a full speed device to the host. The first thing the USB host does is to attempt to send /receive packets at high speed to the USB device. This is known as J and K chirp and if communication is successful it will be assumed that the USB device is a high speed device. If this initial communication fails then the USB host assumes that the device is a full speed device. This means a high speed device has a 1k5 pull up resistor on USB DP that can be switched in / out of circuit. A J state is defined as a differential signal on USBDP and USB DM >= +300mV. A K state is defined as a differential signal on USBDP and USB DM >= -300mV. Figure 1: Connection of low / full speed devices. Copyright 2009 Future Technology Devices International Limited 4

4 Determining What Device is Attached (Device Descriptor) Devices are identified by descriptors. Once the USB host has established a USB device is connected, and at what speed it should communicate, then the host will reset the USB device and attempt to read the descriptors to identify the USB device using a default address. This basically follows a question and answer process. The USB host will send a Get_Device_Descriptor command and then receive a packet of bytes with the descriptor length and the actual descriptor. At the completion of this stage the device is reset and given a unique address before getting the configuration and interface descriptors. blength = 18 bdescriptortype = 1 bcdusb bdeviceclass bdevicesubclass bdeviceprotocol bmaxpacketsize idvendor idproduct bcddevice imanufacturer iproduct iserialnumber bnumconfigurations 4.1 blength. All USB devices have descriptors and the first key one is the Device Descriptor. The length is 18 bytes and it is bddescriptortype is type 1. 4.2 bcdusb. This is used to identify the device as a USB 1.0, USB 1.1 or USB 2.0 compliant device. 4.3 bdeviceclass, bdevicesubclass and bprotocol The bdeviceclass of device defines the device type e.g. a USB Mouse is a Human Interface Device (HID) class device. This is given a hex value of 0x03. More complex devices such as Communication Device Class (CDC) may also use a sub class to break down the device type into a smaller group. bprotocol is used to qualify the sub class. For a full list of defined device classes see Appendix B. Copyright 2009 Future Technology Devices International Limited 5

4.4 bmaxpacketsize This defines the maximum number of bytes in a packet from an endpoint 4.5 idvendor and idproduct The idvendor (VID) is assigned to a company by the USB Implementers Forum. An idproduct (PID) is used with this value to help associate a device with a manufacturer and product. It is also used to help link the hardware with a specific driver. (see AN_107 Advanced Driver Options for more information on driver inf files). 4.6 imanufacturer, iproduct and iserialnumber These values are indexes to the Manufacturer string, the Product name string, and the Serial Number strings. These descriptors help make the identifiers more human readable and can be of variable length. Copyright 2009 Future Technology Devices International Limited 6

5 Determining the Device Configuration (Configuration Descriptor) The Configuration Descriptor is of a fixed length 9 bytes and is defined as type 2. This provides device specific information such as the number of interfaces supported by the device and maximum power the device is expected to consume. blength = 9 bdescriptortype = 2 wtotallength bnuminterfaces bconfigurationvalue iconfiguration bmattributes bmaxpower 5.1 wtotalength This parameter defines the total length of the descriptor. 5.2 bnuminterfaces This parameter defines the number of interfaces supported 5.3 bconfigurationvalue Value to use as an argument to the SetConfiguration() request to select this configuration 5.4 iconfiguration This parameter gives the index of the strings to describe the configuration. 5.5 bmattributes This parameter defines specific configuration attributes e.g. support for remote wake or whether the device is bus [powered or self powered. 5.6 bmaxpower This parameter defines the maximum power the device is expected to consume. Copyright 2009 Future Technology Devices International Limited 7

6 Determining the Device Interface (Interface Descriptor) The Interface Descriptor is of a fixed length 9 bytes and is defined as type 4. This provides information such as the number of endpoints to be used e.g. FTDI devices use one IN and one OUT for each interface. blength = 9 bdescriptortype = 4 binterfacenumber balternatesetting bnumendpoints binterfaceclass binterfacesubclass binterfaceprotocol iinterface 6.1 binterfacenumber This parameter defines the number of the interface being described. 6.2 balternatesetting This parameter is used to select this alternate setting for the interface selected by binterfacenumber. 6.3 bnumendpoints This parameter defines the number of endpoints used by this interface. 6.4 binterfaceclass, binterfacesubclass and binterfaceprotocol These parameters define the class of the interface similar to the classes defined in the device descriptor. 6.5 iinterface This parameter provides the index for the string descriptor used to describe this interface. Copyright 2009 Future Technology Devices International Limited 8

7 Loading the Driver When the USB device has been fully identified by the USB host, then the host PC needs a driver to control the USB device. Matching the USB device to the driver is usually done by matching up the VID and PID. With an FTDI USB device, the VID/PID are stored in the driver.inf files (Windows OS). If the VID/PID match, the host PC will know which driver to install for the specific device. (see AN_107 Advanced Driver Options for more information on driver inf files). After the initial installation the settings are saved in the PC registry so that on subsequent plug-ins of the USB device, the driver is automatically loaded. When the driver has been loaded, then the USB device is available for applications to access. Copyright 2009 Future Technology Devices International Limited 9

8 Summary Enumeration of a device is not a trivial matter. The enumeration processes described in this FTDI technical note are provided as background reading for engineers looking for a little bit extra understanding of the USB protocol. When using an FTDI device, the enumeration process is hidden from the end user by FTDI silicon and free FTDI drivers. This simplifies USB interface design, when compared to a software solution, by removing a large part of the complexity of USB design and allows designers to focus on the interface and application design beyond the USB port. Copyright 2009 Future Technology Devices International Limited 10

9 Contact Information Head Office Glasgow, UK Future Technology Devices International Limited Unit 1, 2 Seaward Place, Centurion Business Park Glasgow G41 1HH United Kingdom Tel: +44 (0) 141 429 2777 Fax: +44 (0) 141 429 2758 E-mail (Sales) sales1@ftdichip.com E-mail (Support) support1@ftdichip.com E-mail (General Enquiries) admin1@ftdichip.com Web Site URL http://www.ftdichip.com Web Shop URL http://www.ftdichip.com Branch Office Taipei, Taiwan Future Technology Devices International Limited (Taiwan) 2F, No 516, Sec. 1 NeiHu Road Taipei 114 Taiwan, R.O.C. Tel: +886 (0) 2 8797 1330 Fax: +886 (0) 2 8751 9737 E-mail (Sales) tw.sales1@ftdichip.com E-mail (Support) tw.support1@ftdichip.com E-mail (General Enquiries) tw.admin1@ftdichip.com Web Site URL http://www.ftdichip.com Branch Office Hillsboro, Oregon, USA Future Technology Devices International Limited (USA) 7235 NW Evergreen Parkway, Suite 600 Hillsboro, OR 97123-5803 USA Tel: +1 (503) 547 0988 Fax: +1 (503) 547 0987 E-Mail (Sales) us.sales@ftdichip.com E-Mail (Support) us.admin@ftdichip.com Web Site URL http://www.ftdichip.com Branch Office Shanghai, China Future Technology Devices International Limited (China) Room 408, 317 Xianxia Road, ChangNing District, ShangHai, China Tel: +86 (21) 62351596 Fax: +86(21) 62351595 E-Mail (Sales): cn.sales@ftdichip.com E-Mail (Support): cn.support@ftdichip.com E-Mail (General Enquiries): cn.admin1@ftdichip.com Web Site URL: http://www.ftdichip.com Copyright 2009 Future Technology Devices International Limited 11

Distributor and Sales Representatives Please visit the Sales Network page of the FTDI Web site for the contact details of our distributor(s) and sales representative(s) in your country. Neither the whole nor any part of the information contained in, or the product described in this manual, may be adapted or reproduced in any material or electronic form without the prior written consent of the copyright holder. This product and its documentation are supplied on an as-is basis and no warranty as to their suitability for any particular purpose is either made or implied. Future Technology Devices International Ltd will not accept any claim for damages howsoever arising as a result of use or failure of this product. Your statutory rights are not affected. This product or any variant of it is not intended for use in any medical appliance, device or system in which the failure of the product might reasonably be expected to result in personal injury. This document provides preliminary information that may be subject to change without notice. No freedom to use patents or other intellectual property rights is implied by the publication of this document. Future Technology Devices International Ltd, Unit 1, 2 Seaward Place, Centurion Business Park, Glasgow G41 1HH United Kingdom. Scotland Registered Number: SC136640 Copyright 2009 Future Technology Devices International Limited 12

Appendix A Terminology FTDI USB USBDP USBDM USB Host USB Device VID PID Future Technology Devices International Universal Serial Bus USB Data line plus USB Data line minus The port that controls the USB interface the master. The peripheral that connects to the USB host port the slave. idvendor idproduct Copyright 2009 Future Technology Devices International Limited 13

Appendix B Enumeration Flow Copyright 2009 Future Technology Devices International Limited 14

Appendix C Device Classes Class (hex value) Definition 00 USE Class information in the Interface Descriptors 01 Audio 02 Communications and CDC Control 03 HID 05 Physical 06 Image 07 Printer 09 Mass Storage 09 Hub 0A CDC-Data 0B Smart Card 0D Content Security 0E Video 0F Personal Healthcare DC Diagnostic Device E0 Wireless Controller EF Miscellaneous FE Application Specific FF Vendor Specific More information on device classes can be found at www.usb.org Copyright 2009 Future Technology Devices International Limited 15

Appendix D Standard Descriptor Types Descriptor Type Descriptor Name 1 Device 2 Configuration 3 String 4 Interface 5 Endpoint 6 Device Qualifier 7 Other Speed Configuration 8 Interface Power More information on device classes can be found at www.usb.org Copyright 2009 Future Technology Devices International Limited 16

Appendix E References USB Implementers Forum www.usb.org USB Specification - http://www.usb.org/developers/docs/usb_20_052709.zip AN_107 Advanced Driver options. http://www.ftdichip.com/documents/appnotes/an_107_advanceddriveroptions_an_000073.pdf Copyright 2009 Future Technology Devices International Limited 17

Appendix F Revision History First Release 28/10/2009 Copyright 2009 Future Technology Devices International Limited 18