Part VPart VI
1-13 USB STACKS 1-13-1 DEVICE STACK
The USB device stack is smaller than the host stack. A typical implementation with one device function has a footprint of 5 to 10K and a RAM usage of 1 to 2K.
A device normally consists of three layers: A driver for hardware access, the core and at least a USB class driver or the bulk communication component.
1-13-2 HOST STACK
A USB host stack is more complex than a USB device stack, mainly because the host is required to manage the root hub and all bandwidth.
A typical footprint for a USB host stack is in the range of 35 to 45K of code space. For the RAM requirements is depends greatly of the USB class used. Some classes, such as HID or MSC, may require pools of memory to process large amount of data.
1-13-3 USB OTG STACK
The advent of the personal digital assistant (PDA) and the cellphone/smartphone introduced the need for equipment able to operate as either a host or a device.
Within the general USB specification, it is not possible to configure the bus in a multimaster arrangement. A supplement to USB 2.0 defines a Host Negotiation Protocol (HNP) to allow two devices to negotiate for the role of host.
USB OTG allows for devices to function as both host and peripheral. The devices connect to either a PC or other portable devices through the same smaller connectors, but with an added pin (ID). The protocol provides enhancements for dynamic switching with the definition of the Session Request Protocols (SRP).
When two dual role (OTG) devices are connected together with the special OTG cable, the cable sets a default host and default peripheral depending on which end of the cable is used. If the software application requires the roles to be reversed, this is when HNP enters into action, and reverse the roles.
The complete information on USB OTG is found on the USB-IF website's OTG Developer's page at www.usb.org/developers/onthego/.
NOTE: As seen on Figure 1-30, a USB OTG stack is the sum of a USB Device stack, a USB Host stack, a USB Device driver, a USB Host driver and some OTG software (HNP, SRP and driver switcher). This means that a USB OTG stack is more expensive then the combination of a USB Device and USB Host. When presented this way, and reviewing the product design objectives, many embedded developers will opt to implement the two stacks with two physical connectors (host and device) versus the single OTG connector. An exception would be a mobile device such as a PDA or smartphone, which have tight space requirements.
OTG was popular when introduced. Today, we see that its deployment has drastically slowed. The equipment for which OTG was designed (PDA and smartphones) are now using wireless protocols to achieve the same goals.
When a manufacturer wants to have a USB logo on its product, the product needs to be certified by the USB organization. This is why the USB organization has created a compliance program. It contains two main criteria: checklists and compliance testing. The checklists contain questions relating to a product and its behavior. The USB-IF Compliance Program is accessible for a small membership fee.