Tutorials to .com

Tutorials to .com » Mechine » Embed » Embedded systems USB-HOST protocol stack design

Embedded systems USB-HOST protocol stack design

Print View , by: iSee ,Total views: 23 ,Word Count: 2055 ,Date: Mon, 10 Aug 2009 Time: 4:04 AM

1 Introduction

To develop on mobile devices today, mobile devices to exchange data among a large number of greatly stimulated the demand for embedded USB host system, this must be an essential requirement for embedded systems to provide USB host driver. And in the traditional sense of the development of LISB drivers are USB peripheral driver development, host controller driver to provide most of the operating system, developers need to do is call the operating system driver provided by the interface. Two main operating system, Windows is not open source and Linux code is not easily transplanted. Currently used for μCOS, VxWorks and QNX embedded systems such as OS, and some non-OS, single-chip systems, establishment of a good set of easy transplantation of USB host drivers will have greater significance.

2 Hardware Platform

mcu hardware platform of choice is the TMS320 DM642, he is TIC6000 of a product line, based on the C64x core, operating frequency is 600 MHz, compatible with the code C6000 platform. He has three pairs of channels of video I can support up to 6 video input and output. DM64.2,DM6424MPEG2。

USB host controller uses Cypress's a master / slave controller SL811HS, it can work in the host (Host) model can work in the slave (Slave) mode, with full-speed (Full-Speed) and low ( Low-Speed) communications peripherals. SL811HS with the microprocessor, microcontroller and dsp seamlessly and directly to, such as ISA, PCMCIA bus, such as, Figure 1 is a block diagram of SL811HS. SL811HS to provide a length of 256 B internal RAM space, the space allocated to the former 16 B control register used as the data behind the buffer zone (maximum 240 B).

Embedded systems USB-HOST protocol stack design

3 USB protocol stack of the basic knowledge

3.1 USB device topology

USB topology as the pyramid, located in the root hub spire (Root Hub), the system root hub is the starting point of all the USB ports, root hub to provide a certain number of USB ports, USB devices and additional The hub can be connected there.

3.2 USB host driver framework

Between host and peripheral connection between information flow and as shown in Figure 2, host and equipment have been divided into different levels. Black is the host of the arrow is the actual data flow, the corresponding interface device is based on the different achievable. In the host and all communications between devices are ultimately carried out through the USB cable, however, the level of the upper layer is a logical relationship, the ultimate communications also must be marked through and the direction of the arrow is. The structure and TCP / IP protocol stack similar to the structure and, therefore, USB protocol stack can be used to describe the image of the USB host driver.

Embedded systems USB-HOST protocol stack design

4 USB protocol stack to achieve

4.1 Protocol Stack compatibility

Protocol stack in order to facilitate the transplantation, the whole process to prepare the use of c language will be such as mutually exclusive processes and operations and the definition of data formats, such as operating systems and hardware platforms with the relevant parts of the protocol stack from the core of the separation. Ported to other operating systems in as much as possible to maintain the protocol stack at the core of the fixed or minor changes, only the relevant procedures with the operating system to add the relevant code.

4.2 USB-HOST protocol stack framework

Based on Figure 2-level map of the USB communication to mass storage devices for the support as an example, USB-HOST protocol stack design shown in figure 3.

Embedded systems USB-HOST protocol stack design

File system layer provides the interaction with the user interface. The paper layer to provide some basic operations, such as creating documents, delete files, common operations such as reading and writing documents. Compatible with Windows, you can layer in the FAT32, FATl6, NTFS file system and so on.

HDM for each device to establish a unified data structure and interface to the file system to read and write sectors on the hard disk operation. In view of the system can be static at the same time the existence of IDE hard drive, HDM unified the two types of hard disk management, file system to cover up the details of the hard disk, making the file system in operation on the two hard drives are no different.

USB device driver layer is only a large-capacity equipment drive for the other types of equipment such as audio equipment, communications equipment, display equipment, man-machine interface device class driver to add this layer of the type of mass storage devices, USB specification for selection of different equipment and different protocols such as: RBC, SCSH-2, UFI, SFF-8020i, QIC-157 and so on, for the USB hard drive, use the SCSI protocol. Equipment powered from the USB protocol layer will be hard to read and write operations translated into SCSI commands, and the transport layer will be decomposed into a command USB Affairs sent to the USB bus driver layer.

USB bus driver bus protocol layer, the management of USB devices and USB affairs management, and bus enumeration. Bus driver layer to initialize all of the main controller, when the successful detection and initialization of a host controller and the controller to set up a virtual root hub. After the host controller initialization, support for all registered drivers. If there is to support the insertion of the device, it can automatically find the drivers work.

Hardware Abstraction Layer on top to cover up the details of hardware, in order to increase software portability, and USB controller chip on the relevant part of the HCD part of the layer, in the transplanted to other platforms, the platform used for the controller chip changes HCD can be related to the content. In addition, the data transmission will eventually be completed here.

4.3 virtual root hub VRH (Virtual Root Hub)

Some USB host controller will be integrated a number of root hub, but did not SI811HS functional integration hub, in order to tie in with the USB system topology, with a root hub simulation software, known as the virtual root hub, the There is only one hub port. Virtual hub and hub are not a substitute for all the features, he is merely to satisfy the USB topology, at the same time, root hub provides the interface to facilitate the driver to be ported to other root hub functionality of embedded systems go.

4.4 USB bandwidth

USB is based on 1 ms time slice of data transmission, in this time of 1 ms to transfer the film is the length of the data bandwidth of USB, how to ensure that the time for a maximum on-chip data transmission, it is decided to USB transfer rate key. As a result of a variety of USB devices may be shared, so chip in time there may be multiple types of USB transfer, interrupt transfer and synchronization of real-time high, so the distribution of bandwidth they have priority, followed by the transmission control , BULK lowest priority, using the remaining bandwidth. The SOF interrupt SI811HS marks the beginning of a time slice. In the large-capacity device driver, the main transmission and the control block (bulk) transmission, SOF interrupt after the data transfer arrangements. In addition, block transfer, the data integrity is relatively more important, therefore, the driver must provide a comprehensive error detection and retransmission mechanisms. For large-capacity equipment, the transmission data rate, transmission speed is also a very important indicator, USB 1.1 support is the biggest transfer rate 1.5 MB / s, but because the cost of the agreement, the data transmission rate is often less than the peak rate. In addition to the optimized code, the full use of bandwidth would be an effective way to raise the rate.

4.5 The key to the process of protocol stack

4.5.1 Main process

The main process is the USB-HOST protocol stack the beginning of a process, in addition to initialization, the main task of his monitoring equipment. The deadlock in the peace process, and when activated to detect the state of virtual port hub. Insertion equipment, the interrupt handling function to change the port status and start the main process, the main port on the process of enumeration of the equipment and its distribution of resources. In contrast, when the extraction equipment, the main process equipment will be associated with the release of resources.

4.5.2 interrupt handling function

Interrupt handler can also be seen as a process of highest priority, SL811HS the interruption of a few important are: insertion / removal interrupt (Insered / Removed) detected from the device insertion and removal operations, SOF timer interrupt (SOF Timer) time to start a film, complete interruption of transmission (USB Done Interrupt) marks the completion of a transfer, interrupt handling function of the process shown in Figure 4.

Embedded systems USB-HOST protocol stack design

4.5.3 software, the process of the dog

When there are two interrupts at the same time arrived, the processor may be interrupted not lose a deal with a dog can set a software process, from time to time the implementation of interrupt handling function. When there is disruption of loss, the software interrupt handling this dog will be out.

5 Conclusion

This article focused on embedded systems USB-HOST protocol stack design, DSPBIOS based on the entire software system in the CCS compiler debugging environment through, tested and stable operation. Software used to prepare a good C++ portability language and platform-related part of the core source code and software separately so as to increase portability. Moreover, in order to upgrade the software interface is also set aside.

Today, mobile electronic products with the appearance of large numbers of direct communication between devices is also growing demand, USB accounted for embedded devices and other equipment for communication between the main players. Roles have been undergoing great changes in the transmission may be the host, the next transmission is likely to play the role of slave, OTG specification was born in such demand, in line with the USB OTG devices, either as Host, also can be used as peripheral equipment with another OTG device directly to the communications equipment. The foreseeable future, embedded USB system will be the development trend of USB OTG.

Embedded Systems Articles

Can't Find What You're Looking For?

Rating: Not yet rated


No comments posted.