In 1994, Intel, Compaq and other seven world-famous software and hardware enterprises set up USB implementers Forum (USB if) to break through the limitation of serial port and parallel port transmission speed of PC at that time, and put forward USB version 0.7 in November 1994. In 1998, devices supporting USB 1.1 began to appear, Its high speed (USB1.1 supports 1.5 MB / s and 12 MB / s) and ease of use make it a favorite of PC peripherals. In order to counter the advantage of 1394 speed (1394 can reach 400 MB / s), the idea of USB2.0 specification was put forward in 1999, and USB if launched USB 2.0 in April 2000. USB 2.0 is downward compatible with 1.1, providing three speeds, up to 480 MB / s.

Both USB 1.1 and 2.0 must rely on PC. in order to get rid of the complete dependence on PC to a certain extent and have a certain degree of host function, OTG 1.0 was launched in December 2001. After six modifications, USB OTG 1.0A was launched in June 2003, which formally became a practical specification in the market.

In this paper, the working principle of OTG is analyzed and discussed, and in view of the problems existing in the current digital camera companion, the author puts forward his own solution.

1. Working principle of USB OTG

The most important extension of OTG supplementary specification to USB 2.0 is its more energy-saving power management and allowing devices to work in both host and peripheral forms. There are two types of OTG devices: dual role device and peripheral only OTG device. Dual purpose OTG devices fully comply with USB 2.0 specification. At the same time, it also provides limited host capacity and a miniab socket, supports host negotiation n protocol (HNP), and supports session request protocol (SRP) just like peripheral OTG devices. When working as a host, the dual-purpose OTG equipment can provide 8 ma current on the bus, while the standard host needs to provide 100-500 ma current in the past.

When two dual-purpose OTG devices are connected together, they can work in the mode of host and slave alternately. This feature is compatible with the existing USB specification host / peripheral structure model. OTG host is responsible for initializing data communication tasks, such as bus reset, obtaining USB descriptors and configuring devices. After these configurations are completed, the two OTG devices can transmit information in host and slave mode respectively, and the master-slave role exchange process of the two devices is defined by host transport protocol (HNP).

The working principle of OTG is explained from five aspects.

1.1 initial functions of adevice and bdevice

The initial function of the device is realized by defining the connector. OTG defines a pocket Jack called miniab, which can be directly connected to the minia or minib socket. Miniab has an ID pin pulled up to the power supply end, and the minia plug has an ID (r < 10) connected to the ground ω), Mini = “B plug has an open ID pin connected to ground (r = > 100 K) Ω)。 When two OTG devices are connected together, the ID pin on the side of minia plug will inject a “0” state, the ID pin on the side of minib plug is “1”, the OTG device with ID 0 is adevice by default, and the OTG device with ID 1 is B device by default. Figure 1 illustrates the above.

Working principle analysis of USB OTG

1.2 session request protocol (SRP)

This protocol allows adevice (which can be battery powered) to cut off the VBUS when the bus is not in use to save power consumption. It also provides a way for bdevice to start bus activities. Any adevice, including PC or portable computer, can respond to SRP; Any bdevice, including a standard USB peripheral, can start SRP; A dual function device is required to start and respond to SRP.

1.3 host negotiation protocol

HNP is a protocol used to realize the host / slave conversion between adevice and bdevice (actually the reverse of the cable). The results of master / slave function exchange are shown in the following processes:

(1) The pull-up resistor is used to send the signal to the slave.

(2) Adevice can set “HNP enable” feature on bdevice.

(3) Bdevice disconnect pull-up.

(4) Adevice is connected to the pull-up resistor, indicating that adevice is subordinate to the slave.

(5) Adevice supplies power to VBUS.

(6) Bdevice detects the pull-up of adevice.

(7) Reset / enumerate / use adevice.

1.4 driver

Different from PC host, portable devices have no convenient way and enough space to load new drivers. Therefore, the OTG specification requires each dual-purpose OTG device to have a list of supported peripheral OTG target devices, including the type and manufacturer of the device.

Different from PC, the driver stack of OTG dual-purpose device is composed of USB host stack and USB device stack to meet the needs of two working modes. OTG driver decides whether to use USB host stack or USB device stack by different connectors or whether there is NHP switching device.

When OTG dual-purpose device works in host mode, USB host stack works. The host controller driver is responsible for the data exchange between the USB host stack and the hardware endpoint, the USB driver enumerates and saves the device information, and the target peripheral host class driver supports the devices in the target device list. Host class drivers are provided by chip manufacturers, and OTG provides general host class drivers (which can be modified for non general devices).

When OTG dual-purpose device works in slave mode, USB device stack works. The device controller driver is responsible for the data exchange between the USB device stack and the hardware endpoint, and the USB protocol layer is responsible for handling the USB protocol specification. The function of the device driver depends on the function of the dual-purpose device (such as digital camera, storage device, printer, etc.).

The OTG driver is responsible for the operation mode conversion of dual-purpose OTG devices. At the same time, it can return its results (such as whether the device supports HNP) and handle bus errors. Application layer program starts or ends a transfer transaction through OTG driver, and exchanges data with hardware layer through USB host stack or device stack.

1.5 data flow model

OTG host and device are divided into three different layers: function layer, USB device layer and USB interface layer, as shown in Figure 2.

Working principle analysis of USB OTG

USB interface layer provides physical connection for OTG host and OTG device, and USB system software uses host controller to manage data transmission between host and USB device. Compared with the host controller, the USB system software deals with the data transmission from the perspective of the customer and the interaction between the customer and the device. USB device layer provides a logical device for USB host system software. The host realizes its various functions through the client software matched with its functions.

OTG device has two channels like USB device: data stream channel and message channel. The data flow channel has no well-defined results, while the message channel has a fixed structure. However, each channel has a certain bandwidth, transmission type, transmission direction and buffer size. The self powered equipment is configured with a default control channel, which provides the configuration and status information of the equipment.

2. Problems and solutions of current digital camera partners

The main part of the working principle of USB OTG is described above, and the application of USB OTG will be discussed below.

At present, with the decline of the price of medium and high-end digital equipment, such as digital cameras, it has begun to spread to thousands of households. Statistics show that the sales volume of digital cameras in the first half of 2003 reached 385000 units, and it is expected to exceed 1 million units by the end of the year. The import volume has increased 53 times compared with the same period last year, while the pixels of digital cameras in general use now range from 2 million to 4 million, In particular, 3.2 million pixels are the hot spots in the market. If you want to take high-quality photos, each photo will be more than 1m, and even the 256M storage space will soon be consumed. However, the price of CF card and other storage media in the market has always been high, so a kind of product called digital camera companion (typical product, such as phototainer, The products of innoplus (Korea) are electronic consumer products. These products can provide the following functions:

(1) Through the card reader, the contents of various storage media (such as SD card, CF card, etc.) can be copied to the mobile hard disk, which provides great convenience for people who travel.

(2) Through the USB port, data can be copied and deleted between the computer and the digital camera.

(3) Provide a large capacity of storage space (from 10 GB to 40 Gb), travel people no longer have to worry about the capacity of the memory card, can be assured of shooting.

The author thinks that this kind of products are not good enough

(1) The way he reads the storage medium of the digital camera is realized by the card reader, that is, he must take down the storage medium of the digital camera and plug it into the socket of the digital camera companion, which is not only very inconvenient, but also doomed that the size and weight of the digital camera companion will not be very small, Due to the existence of different storage media, there must be different types of sockets (generally two kinds of sockets).

(2) In order to be compatible with a variety of storage media, it is necessary to configure the transfer device.

(3) The power consumption is also very large, generally speaking, a charge can only take 1 ~ 2 hours. 

(4) At present, many of these products also use USB 1.1 interface, the transmission speed obviously can not meet the user’s expectations.

In view of the above problems, the author considers the application of USB OTG technology to digital camera, and makes improvements from the following aspects:

(1) Philips ISP1362 chip is used to realize USB OTG function. The advantages are as follows:

① Using the dual role function of USB OTG, it can be used as a host when connecting to other portable digital products or storage media to copy data from other peripherals to the mobile hard disk; When it is connected to PC, it can be used as a common USB device controlled by PC to operate data.

② Using USB OTG, the overall structure will change dramatically, the reading data and other work will be completed by the chip, which saves a lot of relationship memory card work, so the size and weight can be very small, and it is very convenient to use, as long as the USB cable is used to connect the mobile hard disk and digital camera and other devices.

③ The excellent power management ability of USB OTG can also make the battery life more lasting.

(2) We can consider the use of high-capacity micro hard disk, on the one hand to meet the needs of high-capacity storage, on the other hand, it can greatly reduce the size of the whole digital camera.

(3) The advantage of USB 2.0 in speed has been actively supported by the market, so the USB 2.0 interface ensures the high efficiency of data transmission.

Compared with the current digital camera partners on the market, the improved digital camera partner has the following characteristics:

(1) Philips ISP1362 chip to achieve USB OTG function, without PC can copy images and other data to the hard disk.

(2) Built in 1-inch high-capacity micro hard disk to meet the requirements of massive data storage.

(3) No need to remove the memory card of digital camera and other digital devices, easy to use.

(4) Using USB 2.0 specification, the maximum speed can reach 480 MB / s. 

(5) It can be used as a portable hard disk to complete data backup and other work.

(6) Simple control, only power and copy button, can easily realize the operation of stored data.

(7) Using micro hard disk, typical products such as magicstore can be smaller, more fashionable and attractive.

(8) Use LCD to display various states.

(9) Due to the use of the special power supply mode of OTG, the power durability will have a good performance.

The digital camera partner with USB OTG function can not only act as a portable hard disk, but also provide great convenience for people who travel because of its mass storage, data access, fast access speed and excellent power management.


This paper analyzes and discusses the working principle of USB 2.0 supplementary specification OTG. Aiming at the existing problems of digital camera companion, the author puts forward an improvement scheme based on USB OTG technology. USB OTG has been widely supported by chip suppliers such as cypress, software developers and device manufacturers. The scheme is feasible in theory and practical application, and has great application value. USB OTG specification is a supplement to USB 2.0 specification, not a substitute. PC hosts and standard peripherals have not been replaced because the new OTG is only suitable for portable devices that need host functions and smaller sizes. OTG introduces point-to-point communication between these peripherals, which makes the development of portable instruments have a broader space. OTG will soon become a new generation of “mobile computing” solution.


Leave a Reply

Your email address will not be published. Required fields are marked *