没有合适的资源?快使用搜索试试~ 我知道了~
usb-in-a-nutshell 英文版(加书签)
需积分: 36 21 下载量 97 浏览量
2020-02-12
13:28:23
上传
评论
收藏 187KB PDF 举报
温馨提示
usb-in-a-nutshell 英文版 USB协议太厚了,这个英文版资料对USB协议做了简单梳理。只做USB设备开发,可以直接先看这个。 (1) most of us are here to develop USB peripherals and (2) it's common to read a standard and still have no idea how to implement a device. So in the next 7 chapters we focus on the relevant parts needed to develop a USB device. This allows you to grab a grasp of USB and its issues allowing you to further research the issues specific to your application.
资源推荐
资源详情
资源评论
USB in a Nutshell.
Making Sense of the USB Standard.
USB in a Nutshell Page 2 www.beyondlogic.org
Starting out new with USB can be quite daunting. With the USB 2.0 specification at 650 pages one could easily be
put off just by the sheer size of the standard. This is only the beginning of a long list of associated standards for
USB. There are USB Class Standards such as the HID Class Specification which details the common operation of
devices (keyboards, mice etc) falling under the HID (Human Interface Devices) Class - only another 97 pages. If
you are designing a USB Host, then you have three Host Controller Interface Standards to choose from. None of
these are detailed in the USB 2.0 Spec.
The good news is you don’t even need to bother reading the entire USB standard. Some chapters were churned
out by marketing, others aimed at the lower link layer normally taken care off by your USB controller IC and a
couple aimed at host and hub developers. Lets take a little journey through the various chapters of the USB 2.0
specification and briefly introduce the key points.
Chapter Name Description Pages
1 Introduction Includes the motivation and scope for USB. The most important piece
of information in this chapter is to make reference to the Universal
Serial Bus Device Class Specifications. No need reading this chapter.
2
2 Terms and
Abbreviations
This chapter is self-explanatory and a necessary evil to any standard. 8
3 Background Specifies the goals of USB which are Plug’n’Play and simplicity to the
end user (not developer). Introduces Low, Full and High Speed ranges
with a feature list straight from marketing. No need reading this chapter
either.
4
4 Architectural
Overview
This is where you can start reading. This chapter provides a basic
overview of a USB system including topology, data rates, data flow
types, basic electrical specs etc.
10
5USB Data Flow
Model
This chapter starts to talk about how data flows on a Universal Serial
Bus. It introduces terms such as endpoints and pipes then spends
most of the chapter on each of the data flow types (Control, Interrupt,
Isochronous and Bulk). While it’s important to know each transfer type
and its properties it is a little heavy on for a first reader.
60
6 Mechanical
This chapter details the USB’s two standard connectors. The important
information here is that a type A connector is oriented facing
downstream and a type B connector upstream. Therefore it should be
impossible to plug a cable into two upstream ports. All detachable
cables must be full/high speed, while any low speed cable must be
hardwired to the appliance. Other than a quick look at the connectors,
you can skip this chapter unless you intend to manufacture USB
connectors and/or cables. PCB designers can find standard footprints
in this chapter.
33
7 Electrical This chapter looks at low level electrical signalling including line
impedance, rise/fall times, driver/receiver specifications and bit level
encoding, bit stuffing etc. The more important parts of this chapter are
the device speed identification by using a resistor to bias either data
line and bus powered devices vs self powered devices. Unless you are
designing USB transceivers at a silicon level you can flip through this
chapter. Good USB device datasheets will detail what value bus
termination resistors you will need for bus impedance matching.
75
8 Protocol Layer Now we start to get into the protocol layers. This chapter describes the
USB packets at a byte level including the sync, pid, address, endpoint,
CRC fields. Once this has been grasped it moves on to the next
protocol layer, USB packets. Most developers still don’t see these
lower protocol layers as their USB device IC’s take care of this.
However an understanding of the status reporting and handshaking is
worthwhile.
45
9USB Device
Frame Work
This is the most frequently used chapter in the entire specification and
the only one I ever bothered printing and binding. This details the bus
enumeration and request codes (set address, get descriptor etc) which
make up the most common protocol layer USB programmers and
designers will ever see. This chapter is a must read in detail.
36
USB in a Nutshell Page 3 www.beyondlogic.org
10 USB Host
Hardware and
Software
This chapter covers issues relating to the host. This includes frame and
microframe generation, host controller requirements, software
mechanisms and the universal serial bus driver model. Unless you are
designing Hosts, you can skip this chapter.
23
11 Hub Specification
Details the workings of USB hubs including hub configuration, split
transactions, standard descriptors for hub class etc. Unless you are
designing Hubs, you can skip this chapter.
143
So now we can begin to read the parts of the standard relevant to our needs. If you develop drivers (Software)
for USB peripherals then you may only need to read chapters,
• 4 - Architectural Overview
• 5 - USB Data Flow Model
• 9 - USB Device Frame Work, and
• 10 - USB Host Hardware and Software.
Peripheral hardware (Electronics) designers on the other hand may only need to read chapters,
• 4 - Architectural Overview
• 5 - USB Data Flow Model
• 6 - Mechanical, and
• 7 - Electrical.
USB in a NutShell for Peripheral Designers
Now lets face it, (1) most of us are here to develop USB peripherals and (2) it's common to read a standard
and still have no idea how to implement a device. So in the next 7 chapters we focus on the relevant parts
needed to develop a USB device. This allows you to grab a grasp of USB and its issues allowing you to further
research the issues specific to your application.
The USB 1.1 standard was complex enough before High Speed was thrown into USB 2.0. In order to help
understand the fundamental principals behind USB, we omit many areas specific to High Speed USB 2.0
devices. Once a grasp of USB 1.1 is obtained, these additional 2.0 details should be easy to pick up.
Introducing the Universal Serial Bus
USB version 1.1 supported two speeds, a full speed mode of 12Mbits/s and a low speed mode of 1.5Mbits/s.
The 1.5Mbits/s mode is slower and less susceptible to EMI, thus reducing the cost of ferrite beads and quality
components. For example, crystals can be replaced by cheaper resonators. USB 2.0 which is still yet to see
day light on mainstream desktop computers has upped the stakes to 480Mbits/s. The 480Mbits/s is known as
High Speed mode and was a tack on to compete with the Firewire Serial Bus.
USB Speeds
• High Speed - 480Mbits/s
• Full Speed - 12Mbits/s
• Low Speed - 1.5Mbits/s
The Universal Serial Bus is host controlled. There can only be one host per bus. The specification in itself,
does not support any form of multimaster arrangement. However the On-The-Go specification which is a tack
on standard to USB 2.0 has introduced a Host Negotiation Protocol which allows two devices negotiate for the
role of host. This is aimed at and limited to single point to point connections such as a mobile phone and
personal organiser and not multiple hub, multiple device desktop configurations. The USB host is responsible
for undertaking all transactions and scheduling bandwidth. Data can be sent by various transaction methods
using a token-based protocol.
In my view the bus topology of USB is somewhat limiting. One of the original intentions of USB was to reduce
the amount of cabling at the back of your PC. Apple people will say the idea came from the Apple Desktop Bus,
where both the keyboard, mouse and some other peripherals could be connected together (daisy chained)
using the one cable.
However USB uses a tiered star topology, simular to that of 10BaseT Ethernet. This imposes the use of a hub
somewhere, which adds to greater expense, more boxes on your desktop and more cables. However it is not
as bad as it may seem. Many devices have USB hubs integrated into them. For example, your keyboard may
contain a hub which is connected to your computer. Your mouse and other devices such as your digital camera
USB in a Nutshell Page 4 www.beyondlogic.org
can be plugged easily into the back of your keyboard. Monitors are just another peripheral on a long list which
commonly have in-built hubs.
This tiered star topology, rather than simply daisy chaining devices together has some benefits. Firstly power to
each device can be monitored and even switched off if an overcurrent condition occurs without disrupting other
USB devices. Both high, full and low speed devices can be supported, with the hub filtering out high speed and
full speed transactions so lower speed devices do not receive them.
Up to 127 devices can be connected to any one USB bus at any one given time. Need more devices? - Simply
add another port/host. While earlier USB hosts had two ports, most manufacturers have seen this as limiting
and are starting to introduce 4 and 5 port host cards with an internal port for hard disks etc. The early hosts had
one USB controller and thus both ports shared the same available USB bandwidth. As bandwidth requirements
grew, we are starting to see multi-port cards with two or more controllers allowing individual channels.
The USB host controllers have their own specifications. With USB 1.1, there were two Host Controller Interface
Specifications, UHCI (Universal Host Controller Interface) developed by Intel which puts more of the burden on
software (Microsoft) and allowing for cheaper hardware and the OHCI (Open Host Controller Interface)
developed by Compaq, Microsoft and National Semiconductor which places more of the burden on
hardware(Intel) and makes for simpler software. Typical hardware / software engineer relationship. . .
With the introduction of USB 2.0 a new Host Controller Interface Specification was needed to describe the
register level details specific to USB 2.0. The EHCI (Enhanced Host Controller Interface) was born. Significant
Contributors include Intel, Compaq, NEC, Lucent and Microsoft so it would hopefully seem they have pooled
together to provide us one interface standard and thus only one new driver to implement in our operating
systems. Its about time.
USB as its name would suggest is a serial bus. It uses 4 shielded wires of which two are power (+5v & GND).
The remaining two are twisted pair differential data signals. It uses a NRZI (Non Return to Zero Invert)
encoding scheme to send data with a sync field to synchronise the host and receiver clocks.
USB supports plug’n’plug with dynamically loadable and unloadable drivers. The user simply plugs the device
into the bus. The host will detect this addition, interrogate the newly inserted device and load the appropriate
driver all in the time it takes the hourglass to blink on your screen provided a driver is installed for your device.
The end user needs not worry about terminations, terms such as IRQs and port addresses, or rebooting the
computer. Once the user is finished, they can simply lug the cable out, the host will detect its absence and
automatically unload the driver.
The loading of the appropriate driver is done using a PID/VID (Product ID/Vendor ID) combination. The VID is
supplied by the USB Implementor's forum at a cost and this is seen as another sticking point for USB. The
latest info on fees can be found on the USB Implementor’s Website
Other standards organisations provide an extra VID for non-commercial activities such as teaching, research or
fiddling (The Hobbyist). The USB Implementors forum has yet to provide this service. In these cases you may
wish to use one assigned to your development system's manufacturer. For example most chip manufacturers
will have a VID/PID combination you can use for your chips which is known not to exist as a commercial
device. Other chip manufacturers can even sell you a PID to use with their VID for your commercial device.
Another more notable feature of USB, is its transfer modes. USB supports Control, Interrupt, Bulk and
Isochronous transfers. While we will look at the other transfer modes later, Isochronous allows a device to
reserve a defined about of bandwidth with guaranteed latency. This is ideal in Audio or Video applications
where congestion may cause loss of data or frames to drop. Each transfer mode provides the designer trade-
offs in areas such as error detection and recovery, guaranteed latency and bandwidth.
Connectors
All devices have an upstream connection to the host and all hosts have a downstream connection to the
device. Upstream and downstream connectors are not mechanically interchangeable, thus eliminating illegal
loopback connections at hubs such as a downstream port connected to a downstream port. There are
commonly two types of connectors, called type A and type B which are shown below.
USB in a Nutshell Page 5 www.beyondlogic.org
Figure 1 : USB Connectors
Type A plugs always face upstream. Type A sockets will typically find themselves on hosts and hubs. For
example type A sockets are common on computer main boards and hubs. Type B plugs are always connected
downstream and consequently type B sockets are found on devices.
It is interesting to find type A to type A cables wired straight through and an array of USB gender changers in
some computer stores. This is in contradiction of the USB specification. The only type A plug to type A plug
devices are bridges which are used to connect two computers together. Other prohibited cables are USB
extensions which has a plug on one end (either type A or type B) and a socket on the other. These cables
violate the cable length requirements of USB.
USB 2.0 included errata which introduces mini-USB B connectors. The details on these connectors can be
found in Mini-B Connector Engineering Change Notice. The reasoning behind the mini connectors came from
the range of miniature electronic devices such as mobile phones and organisers. The current type B connector
is too large to be easily integrated into these devices.
Just recently released has been the On-The-Go specification which adds peer-to-peer functionality to USB.
This introduces USB hosts into mobile phone and electronic organisers, and thus has included a specification
for mini-A plugs, mini-A receptacles, and mini-AB receptacles. I guess we should be inundated with mini USB
cables soon and a range of mini to standard converter cables.
Pin Number Cable Colour Function
1RedV
BUS
(5 volts)
2WhiteD-
3 Green D+
4 Black Ground
Table 1 : USB Pin Functions
Standard internal wire colours are used in USB cables, making it easier to identify wires from manufacturer to
manufacturer. The standard specifies various electrical parameters for the cables. It is interesting to read the
detail the original USB 1.0 spec included. You would understand it specifying electrical attributes, but
paragraph 6.3.1.2 suggested the recommended colour for overmolds on USB cables should be frost white -
how boring! USB 1.1 and USB 2.0 was relaxed to recommend Black, Grey or Natural.
PCB designers will want to reference chapter 6 for standard foot prints and pinouts.
Electrical
Unless you are designing the silicon for a USB device/transceiver or USB host/hub, there is not all that much
you need to know about the electrical specifications in chapter 7. We briefly address the essential points here.
As we have discussed, USB uses a differential transmission pair for data. This is encoded using NRZI and is
bit stuffed to ensure adequate transitions in the data stream. On low and full speed devices, a differential ‘1’ is
transmitted by pulling D+ over 2.8V with a 15K ohm resistor pulled to ground and D- under 0.3V with a 1.5K
ohm resistor pulled to 3.6V. A differential ‘0’ on the other hand is a D- greater than 2.8V and a D+ less than
0.3V with the same appropriate pull down/up resistors.
The receiver defines a differential ‘1’ as D+ 200mV greater than D- and a differential ‘0’ as D+ 200mV less than
D-. The polarity of the signal is inverted depending on the speed of the bus. Therefore the terms ‘J’ and ‘K’
states are used in signifying the logic levels. In low speed a ‘J’ state is a differential 0. In high speed a ‘J’ state
is a differential 1.
USB transceivers will have both differential and single ended outputs. Certain bus states are indicated by
single ended signals on D+, D- or both. For example a single ended zero or SE0 can be used to signify a
1234
Receptacle Type A
Receptical Type B
12
34
剩余29页未读,继续阅读
资源评论
一念而行
- 粉丝: 0
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于python和flask的学生管理系统源码+数据库(高分项目)
- harden_iL_prod_release_v4_11_0_263_11302134_signed.apk
- 基于SSM实现的酒店管理系统【附源码和数据库】(高分毕设)
- 基于QT的智能家居系统设计与实现源码(C++实现高分毕设项目)
- C++实现基于Qt的智能家居管理系统源码(高分毕业设计项目)
- 基于Qt的智能家居管理系统源码(高分优秀C++实现毕业设计)
- 技术资料分享SD卡资料很好的技术资料.zip
- 技术资料分享SD卡-中文学习笔记很好的技术资料.zip
- 技术资料分享SD卡中文数据手册很好的技术资料.zip
- 技术资料分享SD卡要点说明很好的技术资料.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功