While USB has many advantages in the plug’n’play and ease of use arena, it could never be a direct replacement for many RS-232 systems until now. One of the biggest problems with USB is that its host controlled. Unlike its firewire equivalent, if you switch off a USB host, nothing else works. USB does not support peer to peer comunication. One device on the bus must be a host.
This is fine in the general computing environment, but will cause problems in industrial applications and mobile computing enviroments. For example, a RS-232 modem was a DCE device. Simply inserting a null modem would allow it to talk to other DCE devices, so you could connect a modem up to your datalogger, PLC, printer or other RS-232 device. These devices could either talk together or to a computer. However with todays USB modems you can connect it up to your computer(host) and well, that’s about it.
Many USB digital cameras can download data to a PC, but you are unable to connect them directly to your USB printer to print the pictures out or to a CD Burner to permamently store your holiday snaps, something which is possible with other communication mediums. PDA’s can download and upload data from the PC over it's USB link, but the user can’t connect a printer, mobile phone (modem) or camera to it. This turns out to be quite a restriction to USB’s so called ease of use and simplicity . . .
So to combat these problems, a tack on standard was created to USB 2.0. This is called the On-The-Go Supplement or OTG for short. The OTG specification details the "dual role device". This is a device which can function as both a device controller (DC) and/or a host controller (HC). Aimed at embedded applications the specification doesn’t require a fully blown, resource hungry host capability.
The OTG host can have a targeted peripheral list. This means the embedded device does not need to have a list of every product and vendor ID or class driver. It can target only one type of periheral if needed. This could for example be a modem complying to the Communication Device Class Specification.
The spec also details a Session Request Protocol (SRP) which allows a B-device (Peripheral) to nudge an A-device to turn on the USB's Vbus so it can communicate with each other. A Host Negotiation Protocol (HNP) is also added to allow either end to swap between a host or slave. As power may be a problem with battery operated hosts, the spec allows for a relaxed power source. A dual-role device needs only source a minimum of 8 mA on Vbus.
As a device can be either a host (A-device) or peripheral (B-device) and that the USB specification calls for different types of connectors for upstream and downstream ports, the OTG spec introduced two additional connectors. One such connector is a mini A/B connector allowing a mini A or mini B connector to plug into the one recepticle. A dual-role device is required to be able to detect whether a Mini-A or Mini-B plug is inserted by determining if the ID pin (an extra pin introduced by OTG) is connected to ground.And where would OTG be without it’s own descriptor? Any dual role host can request an OTG descriptor from a B-device describing wheather or not it can handle SRP and/or HNP. Any B-device that supports either HNP or SRP must respond to this request.
The On-The-Go specification is in its last stages of revision. Revision 0.9 released on September the 5th, 2001 is currently avalible at http://www.usb.org/developers/onthego/
ISP1161 Full-speed Universal Serial Bus single-chip host and device controller.
Philips have released the ISP1161 - the world's first single-chip, integrated host and device controller conforming to the USB Revision 1.1. It has been used by Philips to demonstrate USB OTG functionallity, but also makes an excellent host controller for embedded systems such as Linux.
The ISP1161 has a standard CS, RD, WR, and D[15..0] bus making interfacing to most microcontrollers a piece of cake. This particular device only has two address lines hogging up a minimal 4 locations/ports in memory. The 4 addresses are the HC data port, HC command port, DC data port and DC command port making it one of these devices where you send a command first, then data to a different port. However to speed things along shared DMA functionality is added.
While the Host device is controlled using two memory locations, the register set is made compatible to the OpenHCI register set further aiding portability. This allowed the linux OHCI drivers to be ported reasonably easily.
While Philips introduced this device with their OTG promotional release, this device is not 100% OTG complaint. You have to remember that Philips first released this device in July 2001, the OTG specification revision 0.9 was released in early September 2001 and is still not fully qualified at time of writing.
As introduced earlier, the OTG Session Request Protocol (SRP) allows devices to turn on Vbus enabling USB connectivity. This must be done by the B-device using both the "data-line pulsing" and "VBUS pulsing" methods. The OTG host needs only support one of these. In data-line pulsing the B-device can turn on its D+ pull up resistor for a period of 5 to 10mS.
Vbus pulsing is slightly more complicated. If a OTG Complaint B-device is connected to a standard host such as the one in your computer, pulsing Vbus when your computer is powered off could lead to damage. This is overcome by the value of decoupling capacitor on the Vbus line. The USB 2.0 spec calls for a minimum of 120uF on the host's Vbus.
The OTG states that a dual role device should have between 1.0 µF and 6.5 µF. Therefore the B device can send a pulse of duration long enough that a 6.5uF capacitor on the dual role device will charge up beyond 2.1V, yet if connected to a normal host with a capacitance on Vbus of 120uF or more it will not be charged over 2.0V preventing possible damage to the host. It’s own capacitance on Vbus needs to be facted into this calulation and stricter limits are imposed by the OTG standard.
The ISP1161 does not have hardware functionailty to support SRP or HNP. Philips however informs us that they will soon offer an OTG host/device controller based on their proven ISP1161 and an OTG version of their transceiver with OTG SRP & HNP support. This will probaby come about once the OTG standard is finalised.
But while this device may not be 100% USB OTG complant it does make for a ideal Host controller for embedded systems. In the linux World Roman Weissgaerber has released an experimental version of a host controller driver for the Philips ISP1161 HC. His current patch is against Linux-2.4.8 and can be found in the linux-usb-devel development group.
While Roman has been using the ISA card for his development, others in the embedded linux community shouldn’t find it to hard to port across to uClinux or other embedded distributions. Philips have been busy writing application notes detailing how to connect the ISP1161 to varous RISC processors such as the Hitachi SH7709, Intel StrongARM SA1110, Motorola DragonBall EZ, Fujitsu SPARClite™ and NEC V832® RISC processors.