copyright 2003 ryan rangel. all rights reserved. got usb? the questions to ask when adding usb host...

42
Copyright 2003 Ryan Rangel. All ri ghts reserved. Got USB? Got USB? The questions to ask when The questions to ask when adding USB Host to your adding USB Host to your Embedded System. Embedded System. By Ryan Rangel [email protected]

Upload: sophie-wheeler

Post on 25-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Got USB?Got USB?The questions to ask when adding The questions to ask when adding

USB Host to your Embedded USB Host to your Embedded System.System.

By

Ryan Rangel

[email protected]

Page 2: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

IntroductionIntroduction

What do you need to add USB Host to your Embedded system?

Quick USB Overview USB Host Issues Even Quicker USB On-The-Go Overview

When listing products offered by various manufactures, the lists are not meant to be complete. Also, I’m neither endorsing or discouraging the use of these products. Additional research will need to be done to find the best solution for you.

Page 3: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Intended to fix PC problems.Intended to fix PC problems.

One Universal connector for all devices.Devices may be hot plugged.Supply power to device.127 devices per bus. 1 interrupt per bus.Different speeds.Self-identifying devices.

Page 4: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Bus ArchitectureBus Architecture

Master

Slave

Peer Peer

Broadcast (Ethernet)

Peer to Peer (IEEE1394, RS232)

Master – Slave (USB)

Slave

Page 5: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Transport Types:Transport Types:

Control – get/set device state Bulk – reliable transport / unknown latency Interrupt – Poll for device event Isochronous – unknown transport / reliable

latency

Page 6: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Endpoints and PipesEndpoints and Pipes

Building blocks of a USB function. Must have default control endpoint (#0) up to 15 input and 15 output endpoints. Each endpoint may be any transport type

Pipe – Logical channel representing an association between a function endpoint and host software.

Page 7: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

I want USB?I want USB?

USB

Page 8: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

What is you application? What is you application? Do you need Host, Slave or both????Do you need Host, Slave or both????

USB Host USB Function

Page 9: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

USB HostUSB Host

What is my application? What are my requirements?

What host controller best fits my system? What devices will be connected to my

system? What other software support do I need? What solutions are available?

Page 10: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Some questions for choosing Some questions for choosing a USB host Controller.a USB host Controller.

Standard vs. Proprietary Register Interface.System Bus, DMA vs. non-DMASoftware vs. Hardware SchedulingInterrupts

Project hardware cost requirements are your problem……

Page 11: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Standard vs. Proprietary Standard vs. Proprietary Register InterfaceRegister Interface

Standard register interface have public specifications.

Wider Operating System and USB Host stack support.

Proprietary register interface has non-public specification.

Must get Host Controller driver from HC vendor. Sometime must purchase.

Page 12: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Standard Register InterfacesStandard Register Interfaces

UHCI – USB 1.1. Intel originally developed. On every motherboard.

OHCI – USB 1.1. Developed by Compaq, Microsoft, National Semi.

EHCI – USB 2.0. NEC, Microsoft, Comaq, Lucent, Intel.

Page 13: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Some Proprietary InterfacesSome Proprietary Interfaces

TransDimension UHC124, OTG243 Phillips ISP1161, ISP1362 ScanLogic / Cypress SL811HS New controllers coming out! New IP for

SOC and OTG.

Page 14: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

DMA vs. Non-DMADMA vs. Non-DMA Host Controllers. Host Controllers.

All standard controllers use DMA. Standard HCI need PCI or onboard SOC. Proprietary controllers usually have no or

limited DMA capabilityProprietary controllers do not require PCI!

If your I/O bus is slow, DMA won’t help!

Page 15: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Buffer ManagementBuffer Management

Standard HCI – If your system has memory cache then having DMA controller requires management of cached and non-cached memory buffers.

Proprietary HCI – Buffers to be transferred must be copied to chip memory. Chip buffer management can be difficult due to limited space.

Page 16: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

SchedulingScheduling

Standard HCI - all transfer scheduling done by HC silicon

Proprietary HCI - all or part of transfer scheduling done by software.– Transfer Scheduling– Batch Scheduling– Transaction Based

Page 17: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Standard HCI SchedulingStandard HCI SchedulingCPU Memory HC

ED ED EDED

TD

TD

TD

Page 18: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Proprietary HCI SchedulingProprietary HCI Scheduling

CPU Memory HC

ED ED EDED

TD

TD

TD TransferBuffer

Page 19: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

InterruptsInterrupts

Standard HCI – Only interrupts IF event has occurred that requires software processing.

Transfer Based HCI – One interrupt per USB transfer!

Batch Based HCI – One interrupt per frame.Transaction HCI – Same as Standard HCI

but number of outstanding transactions is limited.

Page 20: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

OHCI EHCI

So, what host controller best So, what host controller best fits my system????fits my system????

USB Host

Page 21: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Some questions for choosing Some questions for choosing USB host device support.USB host device support.

What class of devices do you need to support?

Standard vs. Non-Standard devices What other software support will I need? Issues with classes after device ships.

Don’t forget your application requirements. It will take an infinite amount of time to add infinite amount of functionality.

Page 22: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

What is a class driver?What is a class driver?

A combination of pipes, with different transport types.

Data Interpretation. Application or driver subsystem interface.

A compound device exports multiple classes.

Page 23: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Standard vs. Proprietary Standard vs. Proprietary classesclasses

Standard class specifications are public. Standard class software support is common

in most protocol stacks available. Proprietary class specifications must be

gotten from the device vendor. Proprietary class software support is

commonly non-existent.

Page 24: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Available Standard ClassesAvailable Standard Classes Audio Communications Humand Interface

Device (HID) Still Image Capture,

PIMA 15740, PTP Mass Storage Printer Hub Bluetooth

Smart Card (CCID) Firmware Upgrade Content Security IrDA Physical

Page 25: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Some Available Proprietary Some Available Proprietary ClassesClasses

USB to Ethernet USB to Serial MP3 Players Video Cameras Wireless (802.11, etc.) Random-Wildcard

Vendor Device!!!

Scanners Host to Host Cable

Storage Devices Digital Cameras

Page 26: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Other needed software….Other needed software….

HID = event/messaging subsystemMass Storage = File System, Storage

protocol stackUSB to Ethernet = TCP/IP stackPrinters = What printer control languageBluetooth = Bluetooth protocol stack

Does your operating system have all the needed support?

Page 27: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Typical issues.Typical issues.Do you have enough ROM space for all

class drivers and protocol subsystems?How do I add a class driver after ship?What happens after ship if my class driver

has a bug or was not fully implemented?What if a new device comes out that needs

a different protocol subsystem?How will I handle users plugging random

devices into my system?

Page 28: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

UHCI

So, what devices will be So, what devices will be connected to my system? connected to my system?

OHCI EHCI

USB Protocol

HIDMass

StoragePrinter

Page 29: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

How will my applications interface How will my applications interface with the class driver?with the class driver?

Character Block (file system?) Socket (networking stack) Other

In theory, USB just the transport and applications should not be USB specific in any way.

Page 30: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Sometimes you will be able to interface Sometimes you will be able to interface directly with the class driver….directly with the class driver….

USB Protocol

Host to Host

StillImage

MP3Player

OS Character API

Page 31: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Interfacing with USB Keyboard, Interfacing with USB Keyboard, Mice and other HID.Mice and other HID.

HID is a standard class.

You will most likely send events to a user input subsystem.

Will you have support for all HID devices?

Do you only want to support Boot HID? USB Protocol

HID

UserInput

system

Page 32: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Interfacing with USB Mass Interfacing with USB Mass Storage.Storage.

Mass Storage is a standard class. Which only helps if the device is compliant.

What files systems do you have support for (FAT, NTFS, EXT2, ISO9660, other)?

Does your file system support removable media or removable devices?

When a device is plugged into your system, what file system was it formatted with?

Page 33: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Some available file systems.Some available file systems.

Each PC OS has one (Windows, Mac).Most embedded OS has one (VxWorks,

Nucleus, ThreadX, Linux).There are third party solutions (EBS).Some devices format media for you (digital

cameras).

Page 34: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Mass Storage Solution. Mass Storage Solution.

USB Protocol

Bulk Only CB/I

SCSI ATA

FAT ISO 9660

Proprietary

EXT3

OS Block API

Page 35: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Interfacing with USB to Ethernet.Interfacing with USB to Ethernet.

Most USB to Ethernet chips have proprietary protocols.

The standard communications class has Ethernet Networking control model (ENCM).

USB Protocol

Proprietary ENCM

IP

TCP UDP

FTP HTTP

Page 36: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Interfacing with USB printer.Interfacing with USB printer. Printer is a standard

class. Only the transport of

raw data is defined. You will need a

printer control stack from each printer manufacturer. Some are easier to get than others.

USB Protocol

Printer Class Driver

HP Canon Epson

Page 37: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Interfacing with the BluetoothInterfacing with the Bluetooth class.class.

Bluetooth is a standard class but you can only get the protocol from the Bluetooth spec.

USB Protocol

Bluetooth class driver

Bluetooth Stack

Page 38: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Some available solutions to Some available solutions to get your research started…get your research started…

Protocol Analyzers: CATC, Catalyst, Ellisys…

OS with USB Host stack: VxWorks, QNX, Linux, BSD…

Third party USB Host stacks: SoftConnex, Intoto, Grape…

Chip HCD: See vendor…IP HCD: See Vendor…

Page 39: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

OHCI UHCI EHCI SL811H UHC124 ISP1362 ISP1161

USB Protocol

Printer

Canon HP

Proprietary ENCM

IP

TCP

FTP

UDP

HTTP

Proprietary

FAT

Bulk Only

ATA

ISO 9660

CB/I

SCSI

EXT3

OS Block API

What have we learned about What have we learned about USB Host software….USB Host software….

Page 40: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

USB Host ConclusionUSB Host Conclusion

What is your application? What are my requirements?

What host controller fits your system?What devices do you need to support?What other software support do I need?What solutions are available?

Page 41: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

USB On-The-Go (OTG)USB On-The-Go (OTG)The future of embedded USB Host?The future of embedded USB Host?

Do you need the power savings?– Are you running off a battery?

Do you need the physical space savings of having only one mini connector?– Do you have the form factor of a cell phone or PDA?

Bleeding edge technology.– Were you originally a slave device that does

not want to depend on a PC?

Page 42: Copyright 2003 Ryan Rangel. All rights reserved. Got USB? The questions to ask when adding USB Host to your Embedded System. By Ryan Rangel ryan@rrrangel.com

Copyright 2003 Ryan Rangel. All rights reserved.

Thank You!Thank You!

Standard USB specifications at: www.usb.org.

See vendors for all other specifications.If you have any questions, feel free to email

me at: [email protected]