Difference between revisions of "USB"

From Ilianko
()
Line 626: Line 626:
 
== ==
 
== ==
 
USB1, USB2, USB3, USB On-The-Go, Wireless USB
 
USB1, USB2, USB3, USB On-The-Go, Wireless USB
 +
 +
 +
USB 3.0 is a major update to the USB specification. This section is for those
 +
who are familiar with USB 2.0 and want to know what’s new.
 +
(GCVWTGU
 +
USB 3.0 incorporates many new features while continuing to support USB 2.0.
 +
 +
 +
Does USB 3.0 replace USB 2.0?
 +
No. USB 3.0 defines a new SuperSpeed bus that operates parallel to the USB
 +
2.0 bus. Devices that don’t support SuperSpeed should continue to comply
 +
with USB 2.0. SuperSpeed devices comply with USB 3.0 when operating at
 +
SuperSpeed and comply with USB 2.0 when operating at a lower speed. USB
 +
3.0 also relies on USB 2.0 to define many aspects of the interface that apply to
 +
all speeds, including transfer types, descriptors, and bus topology.
 +
The introduction of USB 3.0 thus differs from the change from USB 1.1 to
 +
USB 2.0. When USB 2.0 was released, USB 1.1 became obsolete, and USB 2.0
 +
became the current specification for low, full, and high-speed devices. In con-
 +
trast, USB 3.0 supplements, but doesn’t replace, USB 2.0.
 +
 +
 +
*What devices will benefit from USB 3.0?
 +
 +
The first devices will likely be mass storage. A USB-IF device working group is
 +
developing a Mass Storage USB Attached SCSI Protocol (UASP) for efficient
 +
transfers at SuperSpeed (and improved efficiency at other speeds). Video and
 +
power-sensitive applications will also benefit from USB 3.0.
 +
*How fast is USB 3.0?
 +
The SuperSpeed bus has a signaling rate (the speed of the bits on the wires) of 5
 +
Gb/s, which is over 10× faster than high-speed USB. Unlike USB 2.0, Super-
 +
Speed has a pair of wires for each direction, so data can travel in both directions
 +
at the same time. After encoding and other overhead, the bus can carry around
 +
400 MB/s of application data in each direction.
 +
Other features that can increase data throughput include these:
 +
• Endpoints can asynchronously (without waiting for the host to request the
 +
information) notify the host when they have data to send. The host thus
 +
doesn’t have to use up bandwidth polling endpoints that have nothing to
 +
send.
 +
• Bulk transfers can use a streaming protocol for improved performance.
 +
www.zshareall.com
 +
27Chapter 1
 +
*What stays the same?
 +
These features remain essentially unchanged in USB 3.0:
 +
• Tiered star topology.
 +
• Four transfer types (control, bulk, interrupt, isochronous).
 +
• Use of descriptors to provide device information. (USB 3.0 adds new
 +
descriptors and adds new information in some fields in descriptors defined
 +
in USB 2.0.)
 +
• Device classes and many class drivers.
 +
• Low, full, and high-speed protocols and cabling for these speeds.
 +
*What changes besides the new bus speed?
 +
Besides the 5-Gbps bus speed, other changes with USB 3.0 include these:
 +
• Direct routing. Hubs route downstream traffic only to the receiving device
 +
rather than to every SuperSpeed-capable port.
 +
• No polling. When a host requests data from a SuperSpeed, non-isochro-
 +
nous endpoint that is busy or has no data, the endpoint returns Not Ready
 +
(NRDY). The host can then leave the endpoint alone until the device sends
 +
an Endpoint Ready (ERDY) notification indicating that the endpoint has
 +
data to send.
 +
• New, aggressive power-saving modes and protocols.
 +
• More bus current available to devices.
 +
• Support for bursts, where a host or device sends multiple data packets with-
 +
out waiting for each previous packet’s acknowledgement.
 +
• Streaming on bulk endpoints. Multiple, independent data streams can use
 +
the same endpoint with a dedicated buffer for each stream.
 +
 +
*USB 3.0 is backwards compatible with USB 2.0.
 +
Will USB 1.x and USB 2.0 devices work with USB 3.0 hosts?
 +
Yes. A USB 3.0 host has a USB 2.0 bus in parallel with a SuperSpeed bus.
 +
Will USB 3.0 devices work with USB 2.0 or 1.x hosts?
 +
Sometimes. Every SuperSpeed device must also support a USB 2.0 speed but
 +
doesn’t have to fully function at that speed. A device that can’t perform its func-
 +
tion at the lower speed informs the host that the device requires USB 3.0 to
 +
function. A USB 3.0 device that supports only SuperSpeed and high speed
 +
won’t work with a USB 1.x host or a USB 1.x upstream hub.
 +
 +
*What will change in host software?
 +
The operating system must provide a driver for the USB 3.0 host controller.
 +
Class and device drivers that support isochronous transfers are likely to require
 +
changes to support SuperSpeed.
 +
*What changes do I need to make to a USB 2.0 device to comply with USB
 +
3.0?
 +
The USB 3.0 specification doesn’t apply to USB 2.0 devices. Devices that don’t
 +
support SuperSpeed should continue to comply with USB 2.0.
 +
Can a low-, full-, or high-speed device use USB 3.0’s higher bus currents?
 +
No. SuperSpeed devices should comply with USB 3.0 when operating at Super-
 +
Speed and comply with USB 2.0 when operating at a lower speed. A
 +
high-power device that can operate at both SuperSpeed and high speed can
 +
draw 900 mA at SuperSpeed but only 500 mA at high speed.
 +
*Must USB 3.0 hubs support all speeds?
 +
Yes. A USB 3.0 hub contains a SuperSpeed hub and a USB 2.0 hub that share
 +
power and ground lines and logic to control power to the bus. The hub enu-
 +
merates as two devices, a SuperSpeed hub on the SuperSpeed bus and a USB
 +
2.0 hub on the USB 2.0 bus.
 +
*Can a USB 3.0 device communicate at multiple speeds at the same time?
 +
No, except for hubs, each USB 3.0 device communicates at the highest speed
 +
supported by the device, the host, and the hubs between them.
 +
*USB 3.0 defines new cables and connectors.
 +
*Can I use USB 2.0 cables with a SuperSpeed host or device?
 +
Yes, for traffic at USB 2.0 speeds. USB 2.0 cables fit USB 3.0 receptacles but
 +
don’t have wires to carry SuperSpeed traffic.
 +
Can I use a USB 3.0 cable with a USB 2.0 host?
 +
Yes. The USB 3.0 Standard-A plug fits the USB 2.0 Standard-A receptacle, so
 +
you can use a USB 3.0 cable to attach a USB 3.0 device to a USB 2.0 host. The
 +
device will communicate at a USB 2.0 speed.
 +
*Can I use USB 3.0 cable with a USB 2.0 device?
 +
No. A USB 3.0 cable has a USB 3.0 Standard-B or USB 3.0 Micro-B plug, and
 +
these plugs don’t fit USB 2.0 receptacles.
 +
*What is the maximum cable length?
 +
The USB 3.0 specification defines performance requirements but not maxi-
 +
mum cable length. In practical terms the limit is 3 m using 26 AWG wires for
 +
data and 22 AWG wires for power.
 +
*Can two SuperSpeed hosts connect directly to each other?
 +
USB 3.0 defines a new cable with a USB 3.0 Standard-A plug on each end. The
 +
cable is intended for debugging and other host-to-host applications with driver
 +
support. The SuperSpeed wires cross-connect, routing each output to its corre-
 +
sponding input. The cable doesn’t contain wires for V BUS , D+, or D-. The
 +
cable won’t hurt USB 2.0 hosts because the only line that connects on these
 +
hosts is GND.
 +
USB 3.0 provides both more power and more power-saving options to devices.
 +
*How much bus power can devices draw?
 +
A USB 3.0 host or hub can provide up to 900 mA to high-power SuperSpeed
 +
devices and up to 150 mA to low-power SuperSpeed devices. When operating
 +
at low, full, or high speed, USB 2.0’s limits apply: high power devices can draw
 +
up to 500 mA, and low power devices can draw up to 100 mA.
 +
*What other new power capabilities does USB 3.0 define?
 +
A USB 3.0 device can have a Powered-B receptacle with two extra contacts that
 +
enable the device to provide up to 5V at 1A to a device such as a Wireless USB
 +
adapter. The adapter thus doesn’t need its own power supply. In a wired con-
 +
nection to a host or hub, the extra contacts are unused.
  
 
== Литература ==
 
== Литература ==

Revision as of 20:46, 8 March 2015

Предназначение

Проектира се с цел да замени различни бавни интерфейси за предаване на данни, като паралелен, сериен, PS/2 с обща шина, към която могат да се включват всички тези устройства ползващи споменатите интерфейси.

USB интерфейсът има за цел и да улесни разработката на драйвери за нови периферни устройства.

Основни предимства:

  • Автоматичнo конфигуриране (Plug and Play);
  • Динамична инициализация (hot plug);
  • Поддръжка на различни скорости и типове данни.
  • 127 адреса за устройства.

No power supply required (sometimes). The USB interface includes power-supply and ground lines that provide a nominal +5V from the PC or a hub. A device that requires up to 500 mA (USB 2.0) or 900 mA (USB 3.0) can draw all of its power from the bus instead of using a dedicated power supply. In contrast, devices that use other interfaces may have to provide a power supply inside the device or an external supply.

4GNKCDNG USB’s reliability is due to both the hardware and the protocols. The hardware specifications for USB drivers, receivers, and cables ensure an electrically quiet interface that eliminates most noise that could cause data errors. The USB pro- tocols enable detecting errors in received data and notifying the sender so it can retransmit. Hardware performs the detecting, notifying, and retransmitting without software or user support

At the most basic level, an operating system that supports USB must do three things: • Detect when devices are attached to and removed from the system. • Communicate with newly attached devices to find out how to exchange data with them. • Provide a mechanism that enables software drivers to pass communications between the USB hardware and applications that want to access USB peripherals.

Limits of USB include distance constraints, no support for peer-to-peer com- munications or broadcasting, and lack of support in older hardware and operat- ing systems. www.zshareall.com 7Chapter 1 Distance. USB was designed as a desktop-expansion bus where devices are rela- tively close at hand. Other interfaces, including RS-232, RS-485, IEEE-1394b, and Ethernet, allow much longer cables. To extend the distance between a device and its host computer, an option is to use USB to connect to a nearby device that functions as a bridge to a long-distance interface to the end circuits. Peer-to-Peer Communications. Every USB communication is between a host computer and a device (except for one option introduced with USB 3.0). The host is a PC or other computer with host-controller hardware. The device con- tains device-controller hardware. Hosts can’t talk to each other directly, and devices can’t talk to each other directly. Other interfaces, such as IEEE-1394, allow direct device-to-device communication. USB provides a partial solution with the USB On-The-Go option. An On-The-Go device can function as both a device and a limited-capability host that communicates with other devices. Two USB hosts can communicate with each other via a bridge cable that con- tains two USB devices with a shared buffer. USB 3.0 defines a new host-to-host cable for SuperSpeed. With driver support, this cable can support host-to-host communications. Broadcasting. USB doesn’t support sending data simultaneously to multiple devices (except for USB 3.0 timestamp packets). The host must send the data to each device individually. If you need broadcasting ability, use IEEE-1394 or Ethernet. Legacy Hardware. Older “legacy” computers and peripherals don’t have USB ports. The issue of supporting legacy equipment has faded, however, as older systems are retired. If you need to connect a legacy peripheral to a USB port, a solution is an intel- ligent adapter that converts between USB and the older interface. Several sources have adapters for use with peripherals with RS-232, RS-485, and paral- lel ports. An adapter is useful only for devices that use protocols supported by the adapter’s device driver. For example, most parallel-port adapters support communications only with printers, not with other parallel-port peripherals. RS-232 adapters work with most RS-232 devices. usb1

The Universal Serial Bus Specification Revision 1.0 was released in January 1996. USB capability first became available on PCs with the release of Windows 95’s OEM Service Release 2, available only to vendors installing Windows 95 on PCs they sold. The USB support in these versions was limited and buggy, and there weren’t many USB peripherals available, so use of USB was limited in this era. The situation improved with the release of Windows 98 in June 1998. By this time, many more vendors had USB peripherals available, and USB began to take hold as a popular interface. Windows 98 Second Edition (SE) fixed bugs and further enhanced the USB support. The original edition of Windows 98 is called Windows 98 Gold to distinguish it from Windows 98 SE. This book concentrates on PCs running Windows XP and later. Much of the information also applies to Windows 98, Windows 2000, and Windows Me. Windows NT never supported USB except via third-party software. However, all of the editions mentioned above except Windows 95/98/Me are considered NT-based Windows editions because they build on the Windows NT kernel. In this book, the term PC encompasses all of the various computers that share the common ancestor of the original IBM PC. A host computer is any com- puter that can communicate with USB devices.

usb1.1

The Universal Serial Bus Specification Revision 1.1 (September 1998) added one new transfer type (interrupt OUT). In this book, USB 1.x refers to USB 1.0 and 1.1.

usb2.0

As USB gained in popularity and PCs became more powerful, demand grew for a faster bus speed. Investigation showed that a bus speed 40× faster than full speed could remain backwards-compatible with the low- and full-speed inter- faces. April 2000 saw the release of the Universal Serial Bus Specification Revision 2.0, which added high speed at 480 Mbps. High speed made USB more attrac- tive for peripherals such as printers, disk drives, and video cameras. Windows added support for USB 2.0 in Windows XP SP2. The USB 2.0 specification replaced USB 1.1. Except for hubs, a USB 2.0 device can support low speed, full speed, or high speed, and a high-speed-capable device can support full speed when connected to a USB 1.x bus. A USB 2.0 hub must support all three USB 2.0 speeds. The ability to communicate at any speed increases the complexity of the hubs but conserves bus bandwidth and eliminates a need to use different hubs for differ- ent speeds. USB 2.0 is backwards compatible with USB 1.x. In other words, USB 2.0 devices can use the same connectors and cables as 1.x devices, and a USB 2.0 device works when connected to a PC that supports USB 1.x or USB 2.0, except for a few devices that function only at high speed and thus require USB 2.0 support.

When USB 2.0 devices first became available, there was confusion among users about whether all USB 2.0 devices supported high speed. To reduce confusion, the USB-IF released naming and packaging recommendations that emphasize speed and compatibility rather than USB version numbers. A product that sup- ports high speed should be labeled “Hi-Speed USB,” and messages on the pack- aging might include Fully compatible with Original USB and Compatible with the USB 2.0 Specification. For products that support low or full speed only, the recommended messages on packaging are Compatible with the USB 2.0 Specifi- cation and Works with USB and Hi-Speed USB systems, peripherals and cables. The recommendations advise avoiding references to low or full speed on con- sumer packaging. To use high speed, a high-speed-capable device must connect to a USB 2.0 or USB 3.0 host computer with only USB 2.0 or USB 3.0 hubs between the host and device. USB 2.0 and USB 3.0 hosts and hubs can also communicate with USB 1.x devices. The USB-IF releases revisions and additions to the USB specification via Engi- neering Change Notices (ECNs). Table 1-2 lists ECNs to the USB 2.0 specifi- cation.

usb3

The Universal Serial Bus 3.0 Specification Revision 1.0 was released in November 2008, with the first USB 3.0 device-controller hardware expected to follow about a year later. Windows will likely support USB 3.0 sometime after the release of Windows 7, the successor to Windows Vista. USB 3.0 defines a new dual-bus architecture with two physical buses that oper- ate in parallel. USB 3.0 provides a pair of wires for USB 2.0 traffic and addi- tional wires to support the new SuperSpeed bus at 5 Gbps. SuperSpeed offers a more than 10× increase over USB 2.0’s high speed. Plus, unlike USB 2.0, SuperSpeed has a pair of wires for each direction and can transfer data in both directions at the same time. USB 3.0 also increases the amount of bus current devices can draw and defines protocols for more aggressive power saving and more efficient transfers. USB 3.0 is backwards compatible with USB 2.0. USB 3.0 hosts and hubs sup- port all four speeds. USB 2.0 cables fit USB 3.0 receptacles. USB 3.0 supplements, but doesn’t replace, USB 2.0. Low, full, and high-speed devices continue to comply with USB 2.0 and can’t take advantage of USB 3.0’s features such as higher bus-current limits and larger data packets.


OTG on-the-go

As USB became the interface of choice for all kinds of peripherals, developers began to ask for a way for USB peripherals to access other USB devices. For example, a user might want to attach a printer to a camera or a keyboard to a PDA. The On-The-Go (OTG) Supplement to the USB 2.0 Specification defines a limited-capability host function th

USB архитектура

Дизайнът на USB архитектурата е асиметричен с топология тип звезда с максимум 7 нива. Топологията е изградена от три елемента: един хост, връзки, устройства (host, interconnects, devices).

От своя страна устройствата са хъбове и функции (функционалности)(hubs and functions).

Схема на свързване

Управление

  • Управлението на USB системата се извършва единствено от хоста, към който е включен root hub-a (основният хъб). Посредством маркери (token) USB хоста оведомява кога някое устройство може да предава данни.
  • Данните се предават на пакети разположени в логически канали (pipes), между хост и крайна точка (endpoint).
  • Нула, една и повече крайни точки се обединяват в логически интерфейс на едно устройство. Операционната система комуникира с това логическо устройство.
фиг. 2. Логически канали

Адресиране:

  • Формат - [Адрес на устройството][Адрес на крайна точка (endpoint)][Посока].
  • Възможните адреси са от 0 - 127. Адрес 0 се използва за конфигуриране при начално включване на устройството
  • Възможните крайни точки са от 0 - 15. Крайна точка 0 се използва за управление.
  • Възможните посоки са IN и OUT. IN - от устройството към хоста, OUT - от хост към устройството.
  • Едно физическо устройство може е много функционално (принтер+скенер, камера+микрофон, безжична мишка и клавиатура). Има два вида свързване на многофункионалните устройства:
    1. Устройството има вграден хъб и всяка функция се адресира поотделно. (compound device)
    2. Едно устройство има няколко логически интерфейса, с различни крайни точки. (composite device)


Задача.

  • Използвайте командата lsusb за да видите всички включени USB устройства.
  • Разгледайте опциите на lsusb. Иползвайте man lsusb и lsusb -h, тествайте всички опции на командата.
  • Разгледайте подробно само едно устройство и определете неговия адрес и крайните му точки.

Устройствата не комуникират директно чрез прекъсвания с компютъра. Операционната система избира с кой да комуникира посредством хост контролер. Хост контролерът използва хардуерни прекъсвания. Хост контролерът периодично запитва всяко устройство и проверява дали то иска да комуникира с компютъра. Запитването може да е веднъж на всеки (микро) интервал или за HID устройства би могло да е на всеки 10 интервала (100Hz). Обикновено пакета за запитване е с размер 20 бита (4 PacketID + 7 device address + 4 end point address + 5 bit CRC). USB устройство не може да започне предаване на данни без да е запитано от хост контролера. Пакети предназначени и изпратени за устройство съдържат адрес на устройството и краен адрес (endpoint, pipe). 126 са възможните адреси, които могат да бъдат дадени от един хост контролер

Конфигурация, интерфейси и крайни точки

Всяко устройство може да има различни конфигурации. В момента на включване се определя каква конфигурация ще се ползва.

  • Две различни конфигурации: устройството ползва ток от системната шина, същото устройство може да ползва външно захранване.
  • Само една конфигурация може да е активна в даден момент

Всяка конфигурация има крайна точка за управление и един или повече интерфейси

  • Всеки интерфейс има една или повече крайни точки за вход (OUT) и/или изход (IN).
  • Интерфейсите работят последователно в споделена среда.

USB Скорости

Максимална скорост

USB устройствата могат да поддържат следните скорости на шината.

  • High speed 480Mb/s v2
  • Full speed 12Mb/s v1
  • Low speed 1.5Mb/s v1
  • Super Speed 5Gb/s v3

Usb3 logo.png


Реалната максимална скорост на предаване данни е между 10 и 20% по-ниска, поради резервираност на ресурсите и трафик за управление.

Съвместимост на скорости, при наличие на устройства поддържащи различни скорости

Логически канали

Логическите канали могат да ползват четири видa трансфер.

  • Контролен (control) - За управление
  • Постоянен (isochronous) - канал с гарантирана скорост за предаване в реално време (видео, звук). Възможна загуба на данни, защото няма проверки за грешки. Поради гарантираната скорост се резервира честотна лента и броят на тези канали е ограничен от капацитета на usb контролера.
  • Прекъсваем (interrupt) - канал гарантиращ малко времезакъснение на устройства с малък трафик (мишки, клавиатури).
  • Обемен (bulk) - Канал за предаване на голям обем от данни (файлове), използващ всичкия останал капацитет на USB връзката, без загуби на данни (но няма гарантирана скорост).


Вид връзка Control Bulk Interrupt Isochronouse
Употреба идентификация и конфигуриране Принтер, скенер, памет Мишка, клавиатура Видео, аудио стрийминг
Подръжка задължителна не задължителна не задължителна не задължителна
Корекция грешки да да да не
Гарантирана скорост не не не да
Гарантирано време закъснение не не да да

Класове устройства

Според своето предназначение устройсвата се разделята на следните класове:

  • HID: Human Interface Device
    • мишка, клавиатура, джойстик ...
  • CDC: Communication Device Class
    • модеми Ethernet, ISDN ...
  • MSC: Mass storege class
    • флаш памети, твърди дискове ...

Устройствата попадащи в точно определен клас, могат да се управляват от операционната система без да има нужда от допълнително инсталиране на драйвер


Class Usage Description Examples, or exception
00h Device Unspecified Device class is unspecified, interface descriptors are used to determine needed drivers
01h Interface Audio Speaker, microphone, sound card, MIDI
02h Both Communications and CDC Control Modem, Ethernet adapter, Wi-Fi adapter
03h Interface Human interface device (HID) Keyboard, mouse, joystick
05h Interface Physical Interface Device (PID) Force feedback joystick
06h Interface Image Webcam, scanner
07 Interface Printer Laser printer, inkjet printer, CNC machine
08h Interface Mass storage USB flash drive, memory card reader, digital audio player, digital camera, external drive
09h Device USB hub Full bandwidth hub
0Ah Interface CDC-Data Used together with class 02h: communications and CDC control
0Bh Interface Smart Card USB smart card reader
0Dh Interface Content security Fingerprint reader
0Eh Interface Video Webcam
0Fh Interface Personal Healthcare Pulse monitor (watch)
DCh Both Diagnostic Device USB compliance testing device
E0h Interface Wireless Controller Bluetooth adapter, Microsoft RNDIS
EFh Both Miscellaneous ActiveSync device
FEh Interface Application-specific IrDA Bridge, Test & Measurement Class (USBTMC), USB DFU (Direct Firmware update)
FFh Both Vendor-specific Indicates that a device needs vendor specific drivers

USB устройствата се програмират, така че да отговарят на един от класовете


Формат на данните

Текущата информация, която иска да изпрати определено устройство се нарича трансфер (transfer). Данните от един трансфер се разпределят в транзакции (фиг. ). Транзакциите се групират във фреймове(фиг. ), като транзакции от различни трансфери могат да се изпращат в различни фреймове(фиг.6). Един фрейм е с дължина 1ms. При High speed, всеки фрейм се разделя на 8 микрофрейма (по 125us). Всяка транзакция се състои от няколко пакета. Пакет (packet) най-малката информационна единица е пакет.

Основни понятия:

Всеки пакет съдържа:

  • (задължително) описание на типа на пакета (PID - packet identification)
  • (почти винаги) проверка за грешки (CRC)
  • за token пакет - адрес и крайна точка
  • за payload (data) пакет - данни


Transfer Type
Max Packet Size
LS
FS
HS
Control
8
8, 16, 32, 64
64
Bulk
-
8, 16, 32, 64
512
Interrupt
up to 8
up to 64
up to 1024
Isochronous
-
up to 1023
up to1024

Най-често транзакцията включва:

  • Token пакета изпратен от хоста.
  • Устройството, което е описано в token пакета трябва веднага след получаването да изпрати своите данни.
  • Потвърждение за получените данни.
  • В началото на всеки фрейм се изпраща SOF транзакция, която служи за синхронизация. Транзакцията може да се състои от един (само при SOF start of Frame), два или три пакета се (фиг 4).
  • Пакетите могат да бъдат с различна дължина в зависимост скоростта, вида на логическия канал и избраната конфигурацията (Т.3)
USB Трансфер
Разпределение на транзакции в фреймове
Разпределение на трансфера в различни фреймове

Сигнализация

USB2 системата използва четири проводника. Два от тях се използват за обмен на данни с диференциални сигнали. Другите два USB кабела включват напрежение с номинална стойност Ucc = 5V и маса, което позволява да се захранват външни устройства. Двете информационни жила са усукана двойка, а захранващите може и да са от друг тип.

Всеки проводник в USB кабела има специфичен цвят. Сигналите за данни формират усукана двойка от бял (-Data) и зелен (+Data) цвят. За захранващото 5V напрежение се използва червен цвят. Общият сигнал (Ground) е черен (табл. 2.14).

Сигнал Цвят
+Data зелен
-Data бял
+Ucc червен
Ground черен
NCK пакет изпратен при full speed

USB 3

USB 3 надгражда USB стандарта. Добавят се две нови двойки физически линии за всяка посока, като А куплунга остава с непроменена форма, за да има обратна съвместимост с USB2. USB 3 позволява по голяма консумация на USB3 устройствата и може да сам да поеме инициатива за предаване на данни.

Usb3 cable.png

Usb3 connector.png

Задача


Bus 006 Device 009: ID 046d:c018 Logitech, Inc. Optical Wheel Mouse
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x046d Logitech, Inc.
  idProduct          0xc018 Optical Wheel Mouse
  bcdDevice           43.01
  iManufacturer           1 Logitech
  iProduct                2 USB Optical Mouse
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           34
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      2 Mouse
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      52
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0005  1x 5 bytes
        bInterval              10
Device Status:     0x0000
  (Bus Powered)

Проводници и захранване на USB

USB <= 2

  • 4 проводника
  • Два проводника за захранване +/- 5V
    • Няма проводник за тактова честота
    • Предаването е асинхронно
  • Останалите два проводника са за предаване на данни
    • Обикновено се използва диференциално предаване
  • Възможно захранване до 100mA
  • При конфигуриране до 500mA

File:UsbConnectors.jpg

USB <= 3

Стъпки на свързване

  • Attached
...
  • Powered - подаване на захранване към устройството
  • Default - Устройството се захранва и се достъпва на адрес 0, след като отговори му се изпраща адрес
  • Address - Устройството е получило адрес от хост контролера по стандартния конфигурационен канал (Zero endpoint), който винаги е достъпен, независимо дали има конфигуриран адрес или не.
  • Configured - Хост контролера е получил възможните конфигурации на устройството и е избрал една.
  • Suspended - Ако няма трафик на данни за повече от 1 милисекунда. Режим на ниска консумация. Устройството излиза от този режим след наличие на активност по шината за данни.

USB1, USB2, USB3, USB On-The-Go, Wireless USB


USB 3.0 is a major update to the USB specification. This section is for those who are familiar with USB 2.0 and want to know what’s new. (GCVWTGU USB 3.0 incorporates many new features while continuing to support USB 2.0.


Does USB 3.0 replace USB 2.0? No. USB 3.0 defines a new SuperSpeed bus that operates parallel to the USB 2.0 bus. Devices that don’t support SuperSpeed should continue to comply with USB 2.0. SuperSpeed devices comply with USB 3.0 when operating at SuperSpeed and comply with USB 2.0 when operating at a lower speed. USB 3.0 also relies on USB 2.0 to define many aspects of the interface that apply to all speeds, including transfer types, descriptors, and bus topology. The introduction of USB 3.0 thus differs from the change from USB 1.1 to USB 2.0. When USB 2.0 was released, USB 1.1 became obsolete, and USB 2.0 became the current specification for low, full, and high-speed devices. In con- trast, USB 3.0 supplements, but doesn’t replace, USB 2.0.


  • What devices will benefit from USB 3.0?

The first devices will likely be mass storage. A USB-IF device working group is developing a Mass Storage USB Attached SCSI Protocol (UASP) for efficient transfers at SuperSpeed (and improved efficiency at other speeds). Video and power-sensitive applications will also benefit from USB 3.0.

  • How fast is USB 3.0?

The SuperSpeed bus has a signaling rate (the speed of the bits on the wires) of 5 Gb/s, which is over 10× faster than high-speed USB. Unlike USB 2.0, Super- Speed has a pair of wires for each direction, so data can travel in both directions at the same time. After encoding and other overhead, the bus can carry around 400 MB/s of application data in each direction. Other features that can increase data throughput include these: • Endpoints can asynchronously (without waiting for the host to request the information) notify the host when they have data to send. The host thus doesn’t have to use up bandwidth polling endpoints that have nothing to send. • Bulk transfers can use a streaming protocol for improved performance. www.zshareall.com 27Chapter 1

  • What stays the same?

These features remain essentially unchanged in USB 3.0: • Tiered star topology. • Four transfer types (control, bulk, interrupt, isochronous). • Use of descriptors to provide device information. (USB 3.0 adds new descriptors and adds new information in some fields in descriptors defined in USB 2.0.) • Device classes and many class drivers. • Low, full, and high-speed protocols and cabling for these speeds.

  • What changes besides the new bus speed?

Besides the 5-Gbps bus speed, other changes with USB 3.0 include these: • Direct routing. Hubs route downstream traffic only to the receiving device rather than to every SuperSpeed-capable port. • No polling. When a host requests data from a SuperSpeed, non-isochro- nous endpoint that is busy or has no data, the endpoint returns Not Ready (NRDY). The host can then leave the endpoint alone until the device sends an Endpoint Ready (ERDY) notification indicating that the endpoint has data to send. • New, aggressive power-saving modes and protocols. • More bus current available to devices. • Support for bursts, where a host or device sends multiple data packets with- out waiting for each previous packet’s acknowledgement. • Streaming on bulk endpoints. Multiple, independent data streams can use the same endpoint with a dedicated buffer for each stream.

  • USB 3.0 is backwards compatible with USB 2.0.

Will USB 1.x and USB 2.0 devices work with USB 3.0 hosts? Yes. A USB 3.0 host has a USB 2.0 bus in parallel with a SuperSpeed bus. Will USB 3.0 devices work with USB 2.0 or 1.x hosts? Sometimes. Every SuperSpeed device must also support a USB 2.0 speed but doesn’t have to fully function at that speed. A device that can’t perform its func- tion at the lower speed informs the host that the device requires USB 3.0 to function. A USB 3.0 device that supports only SuperSpeed and high speed won’t work with a USB 1.x host or a USB 1.x upstream hub.

  • What will change in host software?

The operating system must provide a driver for the USB 3.0 host controller. Class and device drivers that support isochronous transfers are likely to require changes to support SuperSpeed.

  • What changes do I need to make to a USB 2.0 device to comply with USB

3.0? The USB 3.0 specification doesn’t apply to USB 2.0 devices. Devices that don’t support SuperSpeed should continue to comply with USB 2.0. Can a low-, full-, or high-speed device use USB 3.0’s higher bus currents? No. SuperSpeed devices should comply with USB 3.0 when operating at Super- Speed and comply with USB 2.0 when operating at a lower speed. A high-power device that can operate at both SuperSpeed and high speed can draw 900 mA at SuperSpeed but only 500 mA at high speed.

  • Must USB 3.0 hubs support all speeds?

Yes. A USB 3.0 hub contains a SuperSpeed hub and a USB 2.0 hub that share power and ground lines and logic to control power to the bus. The hub enu- merates as two devices, a SuperSpeed hub on the SuperSpeed bus and a USB 2.0 hub on the USB 2.0 bus.

  • Can a USB 3.0 device communicate at multiple speeds at the same time?

No, except for hubs, each USB 3.0 device communicates at the highest speed supported by the device, the host, and the hubs between them.

  • USB 3.0 defines new cables and connectors.
  • Can I use USB 2.0 cables with a SuperSpeed host or device?

Yes, for traffic at USB 2.0 speeds. USB 2.0 cables fit USB 3.0 receptacles but don’t have wires to carry SuperSpeed traffic. Can I use a USB 3.0 cable with a USB 2.0 host? Yes. The USB 3.0 Standard-A plug fits the USB 2.0 Standard-A receptacle, so you can use a USB 3.0 cable to attach a USB 3.0 device to a USB 2.0 host. The device will communicate at a USB 2.0 speed.

  • Can I use USB 3.0 cable with a USB 2.0 device?

No. A USB 3.0 cable has a USB 3.0 Standard-B or USB 3.0 Micro-B plug, and these plugs don’t fit USB 2.0 receptacles.

  • What is the maximum cable length?

The USB 3.0 specification defines performance requirements but not maxi- mum cable length. In practical terms the limit is 3 m using 26 AWG wires for data and 22 AWG wires for power.

  • Can two SuperSpeed hosts connect directly to each other?

USB 3.0 defines a new cable with a USB 3.0 Standard-A plug on each end. The cable is intended for debugging and other host-to-host applications with driver support. The SuperSpeed wires cross-connect, routing each output to its corre- sponding input. The cable doesn’t contain wires for V BUS , D+, or D-. The cable won’t hurt USB 2.0 hosts because the only line that connects on these hosts is GND. USB 3.0 provides both more power and more power-saving options to devices.

  • How much bus power can devices draw?

A USB 3.0 host or hub can provide up to 900 mA to high-power SuperSpeed devices and up to 150 mA to low-power SuperSpeed devices. When operating at low, full, or high speed, USB 2.0’s limits apply: high power devices can draw up to 500 mA, and low power devices can draw up to 100 mA.

  • What other new power capabilities does USB 3.0 define?

A USB 3.0 device can have a Powered-B receptacle with two extra contacts that enable the device to provide up to 5V at 1A to a device such as a Wireless USB adapter. The adapter thus doesn’t need its own power supply. In a wired con- nection to a host or hub, the extra contacts are unused.

Литература

Официална документация:

  • Jan Alexon, USB Complete, The Developer's Guide, 4th Edition, 2009


Хост контролер спецификация:

Направи си сам Интерактивен манипулатор (USB HID device)

http://www.usbmadesimple.co.uk/index.html


http://habrahabr.ru/post/92628/ http://www.jungo.com/st/support/documentation/windriver/10.2.1/wdusb_manual.mhtml/index.html http://msdn.microsoft.com/en-us/library/windows/hardware/ff538930(v=vs.85).aspx

Linux & USB

{{#example:}}