Você está na página 1de 8

DESIGN OF USB DEVICE DRIVER FOR BULK DATA TRANSFER

ABSTRACT USB has become a popular interface for exchanging data between PCs and peripherals. An increasing number of portable peripherals are using the USB interface to communicate with the PC. The design and implementation of a synthesizable model of the USB 1.1 protocol engine is presented in this report The PHY is compatible with the USB 1.1 transceiver macrocell interface (UTMI) specification and the simulation test confirmed the successful operation of circuits for both full speed (12 Mbps) and low speed (1.5 Mbps) data transmission. The model is written completely in behavioral HDL with a top down approach and the model was verified and validated.This thesis describes the protocol used in USB 1.1 systems low-level interface. It also describes the type of transactions and errors in USB transactions. The goal is to Designing of Protocol Engine for the USB device. The design of SIE (Serial Interface Engine) is implemented in a Verilog Hardware Description Language. INTRODUCTION Universal Serial Bus (USB) has emerged as a result of the difficulties associated with thecost, configuration, and attachment of the peripheral devices in the personal computer environment. In short, USB creates a method of attaching, and accessing peripheraldevices that reduce overall cost, simplifies the attachment and configuration from theenduser perspective, and attempt to solve several technical issues associated with the old style peripherals. The motivation for the Universal Serial Bus (USB) comes from two interrelated considerations: Ease of use: The lack of flexibility in reconfiguring the PC has been acknowledged as the Achillesheel to its further deployment. The combination of user-friendly graphical interfaces and the hardware and software mechanisms associated with new generation bus architectures have made computers less confrontational and easier to reconfigure. However, from the end users point of view, the I/O interfaces of PCs, such as serial/parallel ports, keyboard/mouse/joystick interfaces, etc., do not have the attributes of plug-and-play. Other once is Port Expansion: The addition of external peripherals continues to be constrained by port availability. The lack of a bi-directional, low-cost, low-to-mid speed peripheral bus has held back the creative proliferation of peripherals such as telephone/fax/modem adapters, answering

machines, scanners, PDAs, keyboards, mice, etc. Existing interconnects are optimized to connect products for one or two ports. As each new function or capability is added to the PC, a new interface has been defined to address this need. The USB is the answer to connectivity for the PC architecture. It is a fast, bidirectional, isochronous, low-cost, dynamically attachable serial interface that is consistent with the requirements of the PC platform of today and tomorrow. BLOCK DIAGRAM:

A Parallel_in Tx Rx

Ack

Nack
Serial_in

Serial_out

Ack Nack

Host

Serial_in

Client

State Machine

ADVANTAGES: Used to transfer large bursty data. Error detection via CRC, with guarantee of delivery. No guarantee of bandwidth or minimum latency. Stream Pipe - Unidirectional Full & high speed modes only.

TOOLS: Language: Verilog HDL Simulation: Modelsim

USB 2.0 cables and peripherals were designed to be backward compatible with USB 1.1 devices.

Brief USB Overview and USB History


All Articles: USB Internals

USB Overview
In the past, connecting multiple peripheral devices to computer has been a real problem. There were too many different port types (serial port, parallel port, PS/2 etc.) and their use imposes limitations such as no hot-pluggability and automatic configuration. There are very limited number of ways to attach the peripheral devices in the original IBM PC implementation due to the requirements in terms of non-shareable IRQ lines and I/O address space. The main reason that Universal Serial Bus was implemented to provide a replacement for those legacy ports on a computer to make the addition of the peripheral devices quick and easy for end user.

USB is designed to allow many peripherals to be connected using a single standardized interface. It provides an expandable, fast, bi-directional, low-cost, hot-pluggable Plug and Play serial hardware interface that makes the life of the computer users easier allowing them to plug different peripheral devices into a USB port and have them automatically configured and ready to use. Using a single connector type, USB allows the user to connect a wide range of peripheral devices, such as keyboards, mice, printers, scanners, mass storage devices, telephones, modems, digital still-image cameras, video cameras, audio devices to a computer. USB devices do not directly consume system resources. They are not mapped into I/O address space, nor do they use IRQ lines or DMA channels. The only system resources required by a USB system are the memory buffers used by the USB system software. Due to its success and widespread acceptance, USB became the 'de-facto' industry standard for connecting peripheral devices to PCs and laptops. The USB has the following key features:

Single connector type: USB replaces all the different legacy connectors with one well-defined, standardized USB connector for all USB peripheral devices, eliminating the need for different cables and connectors and thus simplifying the design of the USB devices. So all USB devices can be connected directly to a standard USB port on a computer.

Hot-swappable: USB devices can be safely plugged and unplugged as needed while the computer is running. So there is no need to reboot. Plug and Play: Operating system software automatically identifies, configures, and loads the appropriate device driver when a user connects a USB device. High performance: USB offers low speed (1.5 Mbit/s), full speed (12 Mbit/s) and high speed (up to 480 Mbit/s) transfer rates that can support a variety of USB peripherals. USB 3.0 (SuperSpeed USB) achieves the throughput up to 5.0 Gbit/s.

Expandability: Up to 127 different peripheral devices may theoretically be connected to a single bus at one time. Power supplied from the bus: USB distributes the power to all connected devices eliminating the need for external power source for low-power devices. High-power devices can still require their own local power supply. USB also supports power saving suspend/resume modes.

Easy to use for end user : A single standard connector type for all USB devices simplifies the end user's task at figuring out which plugs go into which sockets. The operating system automatically recognizes the USB device attachment and loads appropriate device drivers.

Low-cost implementation: Most of the complexity of the USB protocol is handled by the host, which along with low-cost connection for peripherals makes the design simple and low cost.

A Brief USB History


The USB was developed and standardized by a group of leading companies from the computer and electronics industries in 1995. The Universal Serial Bus specification, which defines all aspects of the USB system from the physical layer (mechanical and electrical) all the way up to the software layer, was developed by Compaq, Digital Equipment Corporation (DEC), IBM, Intel, Microsoft and NEC, joined later by Hewlett-Packard, Lucent and Philips. Compaq, which merged with Hewlett Packard, bought DEC and Lucent merged with Alcatel to form Alcatel-Lucent. These companies also formed the USB Implementers Forum, Inc. (USB-IF) as a non-profit corporation to publish the specifications and provide a support organization and forum for the advancement and adoption of USB technology.

USB Specification
The design of USB is standardized in Universal Serial Bus Specification that provides the technical details to understand USB requirements. The specification describes the bus attributes, the protocol definition, types of transactions, bus management, and the programming interface required to design USB compatible

peripherals and software. USB Specifications and all related documents are freely downloadable from USB Implementers Forum web site. Versions of USB specification:

Revision 1.0 released on January 15, 1996, introduced a low-speed transfer rate of 1.5 Mbit/s and a full-speed transfer rate of 12 Mbit/s. Revision 1.1 released on September 23, 1998, introduced the improved specification and was the first widely used version of USB. Revision 2.0 released on April 27, 2000. The major feature of revision 2.0 was the addition of a high-speed transfer rate of 480 Mbit/s. Revision 3.0 released on November 17, 2008, brings significant performance enhancements to the USB standard while offering backward compatibility with the peripheral devices currently in use. Legacy USB 1.1/2.0 devices continue to work while plugged into new USB 3.0 host and new USB 3.0 devices work at USB 2.0 speed while plugged into USB 2.0 host. Delivering data transfer rates up to ten times faster (the raw throughput is up to 5.0 Gbit/s) than Hi-Speed USB (USB 2.0), SuperSpeed USB is the next step in the continued evolution of USB technology. Data Transfer Rate Comparison USB Revision Media (Data Size) Song / Pic (4 MB) 256 Flash (256 MB) USB Flash (1 GB) SD-Movie (6 GB) USB Flash (16 GB) HD-Movie (25GB) 5.3 sec 5.7 min 22 min 2.2 hr 5.9 hr 9.3 hr USB1.0 USB2.0 Transfer Time 0.1 sec 8.5 sec 33 sec 3.3 min 8.9 min 13.9 min 0.01 sec 0.8 sec 3.3 sec 20 sec 53.3 sec 70 sec USB3.0

Note, however, that all above mentioned are theoretical maximum data transfer rates that do not take into consideration some USB protocol overhead and bus utilization, which makes a difference in actual maximum throughput. The actual maximum throughput may vary depending on the transfer type, maximum packet size, time reserved for control transfers, the overhead due to signaling imposed bit stuffing etc. Each iteration of the specification is backward compatible with previous revisions. Since all USB devices use the same cables, connectors and software interfaces, there is no change in the usage model for the end user. USB 1.0, USB 1.1 and USB 2.0 compliant peripheral devices can operate on a computer at the same time. It is possible for a high-speed USB 2.0 device to plug into a USB1.1 port and operate at the appropriate transfer rate.

Using USBlyzer - Viewing the USB Specification Version


You can view USB Specification revision number for USB devices and external hubs. To view USB Specification revision number a USB device compliant with 1. Open USBlyzer.

2. 3.
Offset 0 1 2 4 5 6 7 8 10 12 14 15 16 17

In the USB Device Tree panel select the device for which you want to see USB Specification revision number. In the USB Properties panel see the bcdUSB field value of the Device Descriptor.
Field Size Value Description 1 12h bLength 1 01h Device bDescriptorType 2 0101h Fails WHQL testing. Should be 0110h bcdUSB 1 00h Class information in the Interface Descriptors bDeviceClass 1 00h bDeviceSubClass 1 00h bDeviceProtocol 1 40h 64 bytes bMaxPacketSize0 2 6993h Freshtel idVendor 2 B001h idProduct 2 0000h 0.00 bcdDevice 1 01h "Yealink Network Technology Ltd." iManufacturer 1 02h "VOIP USB Phone" iProduct 1 00h iSerialNumber 1 01h bNumConfigurations

Device Descriptor VOIP USB Phone

Note, that in the above example the U.S. Robotics USB Phone 9600 incorrectly reports its compliance with the USB Specification 1.1 as 0101h. bcdUSB field in the standard USB Device Descriptor may have the following values:

0100h - USB Specification 1.0 0110h - USB Specification 1.1 0200h - USB Specification 2.0

Since some devices incorrectly expose bcdUSB field as 0101h instead of 0110h, the operating system accepts both as valid revision number. But failure to correctly report this value can prevent the driver from passing the Windows Hardware Quality Labs (WHQL) testing and may also cause a device to fail tests in the USB test tools.

USB Logo
To complement the USB specification in real products, the USB-IF maintains a Compliance Program that provides reasonable measures of acceptability. Products that pass compliance testing have the right to license the USB-IF certified USB Logo. Products that operate at either low-speed or full-speed can use only the Basic-Speed version of the logo. Only products that support high-speed can use the Hi-Speed version of the logo.

Certified Logo for USB Devices

USB Extensions

There are also the extensions to the original USB design. These are USB On-The-Go (OTG) and Certified Wireless USB. USB On-The-Go allows connecting portable peripheral devices to each other directly without having to connect to a PC. Certified Wireless USB is a wireless radio communication protocol that combines the ease-of-use of USB with the convenience of wireless technology. Like standard USB, the USB-IF also maintains the Compliance Program for OTG and Wireless USB devices.

Certified Logo for USB OTG and Wireless USB Devices USB On-The-Go and Certified Wireless USB technologies are beyond the scope of this article series, the details and specifications can be found on the USB-IF website. Next Article: Basic Components of a USB System Architecture

The device (digital camera, card reader, scanner, hard drive, cable modem, etc.) will work with the USB 2.0 ports even if the device only has a USB 1.0 or 1.1 connection. The physical connectors are exactly the same for USB 1.1 and USB 2.0. However, the device will only work at USB 1.1 speeds (12 Mbps) and not USB 2.0 speeds (480 Mbps). Conversely, if your computer only has USB 1.0 or 1.1 ports and you would like to use a USB 2.0 device with it, the device will probably work. Again, you will only be able to transfer data at the slower USB 1.1 transfer rate. Most USB 2.0 devices are backwards compatible with USB 1.1, but for data-intensive devices (like a hard drive or iPod), the data transfer is so slow with USB 1.1, it may not even be worth using it.

Connecting f lash memory cards, p en-like memory devices, d igital camera, p rinter, m ouse-device, P ocketPC, v ideo games, S canner A crc field in a data packet permits error detection

USB Specification 1.1 was designed for low to medium speed applications running at less then 12 Mbits/sec. As such it is not suited for high-end data transfer such as high-speed back-ups to hard disks or CDs , high resolution color printing and interactive gaming

BUS COMPARISON
Type of Bus Bus Clock Signal 8 MHz Bus Width Theoretical Maximum Transfer Rate 8 Mbytes/sec (64 Mbits/sec) 40 Mbytes/sec (240 Mbits/sec) Advantages Disadvantages

ISA

16-bit

low cost, compatibility, widely used higher speed than ISA very high speed, Plug & Play, dominant board-level bus designed for industrial use, hot swapping/Plug & Play, ideal for embedded systems Ideal for portable systems, hot swappable, Plug & Play low cost, ideal for portable systems, hot swapping/plug & play, up to 127 devices via 1 port All the advantages of USB plus significantly higher speeds making it compatible with highspeed peripherals such as data drives and video cameras. Enables multiple PCs to remotely share information and peripheral devices, provides error checking lacking in standard serial communication All advantages of 10BaseT, with significant speed improvement. Backward compatible with 10Base T installations.

low speed, Jumpers & DIP switches. becoming obsolete obsolete

Microchannel

10 MHz

32-bit

PCI

133 MHz

64-bit

1 Gbytes/sec (8 Gbits/sec)

incompatible with older systems, can cost more

CompactPCI

33 MHz

64-bit

132 Mbytes/sec (1 Gbit/sec)

lower speed than PCI, need adapter for PC use, incompatible with older systems

PCMCIA

10 MHz

16-bit

20 Mbytes/sec (160 Mbits/sec)

lower speed , needs special drive for use in desktop PCs

USB 1.1

n/a

n/a

1.5 Mbytes/sec (12 Mbits/sec)

slower than PCI and other plug-in busses (such as Firewire), not compatible with older peripherals

USB 2.0

n/a

n/a

60 Mbytes/sec (480 Mbits/sec)

Not compatible with older peripherals, still slower than PCI

Ethernet 10 Base T

n/a

n/a

1.25 Mbyte/sec (10 Mbits/sec)

Most peripheral devices cannot be connected directly to ethernet, adapter is required. Slow data communication by current standards Possible security issues.

Ethernet 100 Base T (Fast Ethernet)

n/a

n/a

12.5 MBytes/sec (100 Mbits/sec)

Most peripheral devices cannot be connected directly to ethernet, adapter is required. Possible security issues.

Você também pode gostar