So, you think you need
USB On-The-Go?
Agenda
• Introduction
• Embedded Host terminology
• OTG
– Electrical
– Protocol
• When to use OTG
2
Typical USB Network
• Host, Function, Hub
© 2010 Renesas Electronics America
Inc. All rights reserved.
3
Embedded Host Terminology
• Embedded Host
– Not full UHCI like PC, has limited hosting capabilities
defined by its Targeted Peripheral List
– TPL = List of devices supported
• Targeted Host
– Embedded Host or an OTG with a TPL
• Dual Role Device
– MCU acts as Host and Function
• On different ports - at the same time
• On same port - at different times
4
Dual Role Device
UHCI/OHCI
Host (PC),
Embedded Host
Embedded Host
with FW/HW to
run as Function
Mouse,
Keyboard,
Flash drive,
OTG Product
Hosts
Peripherals
Dual Role Device
5
USB On-The-Go
• Retains the Host-Function USB model, BUT
– Connects Two USB devices
• Appears to add peer-to-peer,
but negotiation who will be Host
– Micro-AB receptacle with ID pin
• OTG has a low power advantage:
– Using standard USB spec could cripple battery life of a lowpowered device
• Regular USB Host must supply 100 mA
• For OTG the requirement is 8 mA
• Function may ask for more from Host
• SRP…
• OTG not used much due to increased complexity
And since it is usually not needed!
6
Connectors and Receptacles
• USB Specification
– Type A and Type-B plugs and receptacles
– Mini A and Mini-B plugs and receptacle
• OTG Additions
– Micro A and Micro B plugs
– Micro AB receptacle
• Pins:
–
–
–
–
–
VBUS
D+
Micro A/B for OTG
DVBUS
GND
ID
D+
Micro-B
plug
Micro-A
plug
DGND
ID
ID
7
Host Negotiation Protocol (HNP)
•
Method for switching Host and Function roles
without disconnecting the cable
•
•
Cable orientation to determine initial Host
Software controlled sequence
USB Function
USB Host
HNP
8
•
Session Request Protocol - Saves Power
“Regular” USB
•
– Suspend State mandatory after 3 ms
– Function can issue Remote Wakeup
– Vbus still on
In OTG with SRP:
– VBus turned off by Host when no activity on bus
– VBus turned on after Function ‘pulses’ D+ line
• Need battery!
•
Non OTG products
– Hosts, including a PC or laptop, is allowed to respond to SRP.
– Peripheral-Only B-device, may initiate SRP
9
Standard USB Circuitry
10
Pin Mode Host/Function/OTG Example
What must happen to switch between Host/Function?
1. User must pull out and reattach a cable
2. User needs to notify firmware to reinit USB (e.g. push a switch)
3. THE OUTWARD CIRCUITRY MUST CHANGE
For example the YRDK62N has dipswitches that need to be altered
when changing Host/function
11
When is OTG needed?
• You visit a customer that says“Our product needs both
Host and Function capabilities on the same port so it
needs OTG”.
– True or False?
– False. As we have seen, this is not the case, though action
must be taken to switch between the two.
12
External Circuitry for OTG with RX62N
•
•
•
15 k pulldown on D+ and D- for Host mode
2.5 k pullup on D+ for Function
Normal Function operation does not require
the external IC
•
OTG
–
IC allows VBUS to source or sink current.
– MAX3355 from Maxim
13
What is required to support an OTG
product?
• Electrical circuitry
– USB Charge pumps
– Supply min. 8mA /5V to Vbus
• USB Stack
– Function stack
– Host stack
– OTG Specific support
• Host Negotiation Protocol (HNP)
• Session Resume Protocol (SRP)
– Host/Function stack switching capability
• Target Peripheral List class drivers
– Depending on the TPL some features above may be ignored
14
Scenarios Where OTG Could be Used
1. Host - OTG acting as Function
– PDA - Mouse/Keyboard/Printer
– PC or Embedded Host – OTG B-device
– Example: Sync a PC with a PDA/Phone/MP3/Camera
2. Host - Peripheral-Only OTG
– PDA to Mouse/Keyboard/Printer
– Data to/from Camera/Mp3/Phone/PDA to Flash Drive
3. OTG - OTG
– Data between Camera-Phone-PDA-Mp3
16
•
If ‘No’ to any of these, OTG not
Does the product need
both Host and Function capabilities?
necessary
– If ‘no’ OTG not needed
• Is it necessary to use only one port?
(One for Host and the other for Function)
– No – OTG not needed
• Is it unacceptable to unplug and re-plug the product
when switching between Host and Function roles?
– No, its actually acceptable – OTG not needed
• Is the product expected to be used with another OTG
product?
– If Yes
– Is that product a ‘Peripheral-Only’
• No - OTG not needed
• Yes to ALL:
– Make an OTG stack…
17
Rule of Thumb
• OTG is a must only if that product is expected to
be used with another OTG product (which is not
‘Peripheral-Only’).
• If the customer still says OTG is necessary, ask
the questions in the previous slide.
• Usually, a Dual Role Device can do the job.
• Wait! I need the low power solution that OTG has
(SRP)!
–
According to the OTG standard:
• For non OTG products, a host, including a PC or laptop, is allowed to respond to SRP.
• A peripheral-Only B-device, may initiate SRP.
18
Summary
• Introduction
• The Embedded Host
• OTG
– Electrical Spec
– Protocol Spec
• When to use OTG?
• OTG in a product with Host and Device support, is a
must only if that product is expected to be used with
another OTG Device . In all other cases an Embedded
Host can do the job.
19