[ieee 2010 international conference on machine vision and human-machine interface - kaifeng, china...

4
A High-speed Data Acquisition Card Based on USB Bus TAN Baohua 1,2 1 School of Science, Hubei University of Technology 2 School of Automobile Engineering, Wuhan University of Technology Wuhan, Hubei, China [email protected] QUAN Shuhai School of Automobile Engineering Wuhan University of Technology Wuhan, Hubei, China [email protected] Abstract—On the basis of analyzing USB interface chip PDIUSBD12, enlarging USB interface in the Embedded System is discussed, that is in the core of ARM7 TDMI. A high- speed data acquisition card based on USB bus is introduced in this paper. It introduces the key chips, and also describes the configuration and principle of the card in the hardware design. In the software design, the application program that developed by Lab Windows CVI version 7.0, and USB device driver is programmed in Visual C++ version 6.0. The data acquisition firmware design whose central part is data acquisition interruption routine is been emphasis express. Finally, the writer tests all kinds of parameters of the card, and analyses the results in principle. This system is safer than the traditional data acquisition system, and has a good real-time performance. Meanwhile, the volume of the hardware is smaller, the power consumption is lower, and the expansibility is stronger Keywords-USB; Data Acquisition Card; Micro Control Unit; Firmware I. INTRODUCTION As a kind of specification of communication interface, General serial bus (USB) has been applied extensively in PC peripheral and portable system because of its high-speed transmission, good reliability and flexibility, low expense and limited power consumption. This data acquisition card has adopted 3 key chips: PDIUSBD12, MAX1247 and the LPC2210 chip .The card is the key part of the data acquisition system which based on ARM7TDMI-S CPU, and it has high reliability (the data would hardly be lost in the transmission) and totally interference free, besides that it makes data easy to be transmitted and be processed. So it has an extensive application prospect in the real time signal collections of transient state such as in the field of the signal test collection system. II. HARDWARE DESIGN USB system is formed mainly by hardware system and software system. The former is always divided into 3 parts: USB host, USB device, and USB hub [1] ; while there are 4 parts constitute the latter, such as: customer application program, micro-controller driver program, device driver program and device firmware program. Now, the most of USB systems pick PC as USB HOST, therefore this paper introduces the aspect of USB device emphatically. The main part of circuit in this data acquisition card adopts LPC2210 chip from PHILIPS Company, as the host controller. This chip is based on a micro-processor with a 16/32-bit ARM7TDMI-S embedded, which supports real- time emulation, and is embedded by a high speed Flash memory, which has a 128-bit interface. Its appropriate bandwidth and the unique acceleration architecture make 32- bit codes smooth run under the biggest clock frequency, additionally this chip could be compatible with 16-bit Thumb mode, which fully satisfies those needs of the system, such as code scale must be strictly limited, at the meantime, energy wastage is limited as well. Fig.1 The hardware connection between PDIUSBDI2 and LPC2210 PDIUSBD12 is selected as the USB interface chip; this chip has being used most popular by PHILIPS Company in many device ports that follow USB 1.1 protocol. Not only carrying parallel bus,PDIUSBD12 also has combined many apparatuses such as voltage adjuster, high-performance USB interface device, serial interface engine ( SIE ), FIFO memory and transceiver, so this chip could be communicated with external micro-controller / micro-processor with a high speed ( 2 MB/S ) through parallel interface, besides that it supports 3 ports to carry out two-way data transmission [2] . The circuit connection between PDIUSBD12 and micro- controller LPC2210 shows as Figure 1, and Table 1 draws the connection of foots between the two chips. 2010 International Conference on Machine Vision and Human-machine Interface 978-0-7695-4009-2/10 $26.00 © 2010 IEEE DOI 10.1109/MVHI.2010.179 357

Upload: shuhai

Post on 22-Mar-2017

216 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: [IEEE 2010 International Conference on Machine Vision and Human-machine Interface - Kaifeng, China (2010.04.24-2010.04.25)] 2010 International Conference on Machine Vision and Human-machine

A High-speed Data Acquisition Card Based on USB Bus

TAN Baohua1,2

1 School of Science, Hubei University of Technology

2 School of Automobile Engineering, Wuhan University of Technology

Wuhan, Hubei, China

[email protected]

QUAN Shuhai

School of Automobile Engineering

Wuhan University of Technology

Wuhan, Hubei, China

[email protected]

Abstract—On the basis of analyzing USB interface chip

PDIUSBD12, enlarging USB interface in the Embedded

System is discussed, that is in the core of ARM7 TDMI. A high-

speed data acquisition card based on USB bus is introduced in

this paper. It introduces the key chips, and also describes the

configuration and principle of the card in the hardware design.

In the software design, the application program that developed

by Lab Windows CVI version 7.0, and USB device driver is

programmed in Visual C++ version 6.0. The data acquisition

firmware design whose central part is data acquisition

interruption routine is been emphasis express. Finally, the

writer tests all kinds of parameters of the card, and analyses

the results in principle. This system is safer than the traditional

data acquisition system, and has a good real-time performance.

Meanwhile, the volume of the hardware is smaller, the power

consumption is lower, and the expansibility is stronger.... Keywords-USB; Data Acquisition Card; Micro Control Unit;

Firmware

I. INTRODUCTION

As a kind of specification of communication interface, General serial bus (USB) has been applied extensively in PC peripheral and portable system because of its high-speed transmission, good reliability and flexibility, low expense and limited power consumption.

This data acquisition card has adopted 3 key chips: PDIUSBD12, MAX1247 and the LPC2210 chip .The card is the key part of the data acquisition system which based on ARM7TDMI-S CPU, and it has high reliability (the data would hardly be lost in the transmission) and totally interference free, besides that it makes data easy to be transmitted and be processed. So it has an extensive application prospect in the real time signal collections of transient state such as in the field of the signal test collection system.

II. HARDWARE DESIGN

USB system is formed mainly by hardware system and software system. The former is always divided into 3 parts: USB host, USB device, and USB hub

[1]; while there are 4

parts constitute the latter, such as: customer application program, micro-controller driver program, device driver program and device firmware program. Now, the most of USB systems pick PC as USB HOST, therefore this paper introduces the aspect of USB device emphatically.

The main part of circuit in this data acquisition card adopts LPC2210 chip from PHILIPS Company, as the host controller. This chip is based on a micro-processor with a 16/32-bit ARM7TDMI-S embedded, which supports real-time emulation, and is embedded by a high speed Flash memory, which has a 128-bit interface. Its appropriate bandwidth and the unique acceleration architecture make 32-bit codes smooth run under the biggest clock frequency, additionally this chip could be compatible with 16-bit Thumb mode, which fully satisfies those needs of the system, such as code scale must be strictly limited, at the meantime, energy wastage is limited as well.

Fig.1 The hardware connection between PDIUSBDI2

and LPC2210 PDIUSBD12 is selected as the USB interface chip; this

chip has being used most popular by PHILIPS Company in many device ports that follow USB 1.1 protocol. Not only carrying parallel bus,PDIUSBD12 also has combined many apparatuses such as voltage adjuster, high-performance USB interface device, serial interface engine ( SIE ), FIFO memory and transceiver, so this chip could be communicated with external micro-controller / micro-processor with a high speed ( 2 MB/S ) through parallel interface, besides that it supports 3 ports to carry out two-way data transmission

[2].

The circuit connection between PDIUSBD12 and micro-controller LPC2210 shows as Figure 1, and Table 1 draws the connection of foots between the two chips.

2010 International Conference on Machine Vision and Human-machine Interface

978-0-7695-4009-2/10 $26.00 © 2010 IEEE

DOI 10.1109/MVHI.2010.179

357

Page 2: [IEEE 2010 International Conference on Machine Vision and Human-machine Interface - Kaifeng, China (2010.04.24-2010.04.25)] 2010 International Conference on Machine Vision and Human-machine

Table 1 The connection between LPC2210 and PDIUSBD12

MAX1247, which is made by MAXIM Company, is used

as an analog-to-digital converter this chips supports 12-bit and 4-channel, it suits for the system of high accuracy and high speed. It is also provides high conversion speed (7.5µs) with low electricity consumption , the voltage that power source provides when chip normally runs is from 5.25 V to 2.7 V, the related software is programmed to control the whole process and make sure the analog signal input correctly.

From the relation between the two chips shown in the picture, PDIUSBD12 uses the bank 2 part of LPC2210, which is controlled by the external memory. Its data address and order address are respectively:

Data address 0x82000000 (the address of even number) Order address 0x82000001 ( the address of odd number ) The Figure 2 shows the connection relation of several

key hardware chips. For both MAX1247 and the micro-controller support SPI serial interface, the SPI serial transmission is applied in the data communication.

Fig.2 The connection relation of the key chips

III. SOFTWARE DESIGN

In USB data acquisition system, software design includes mainly: Customer application programming (Lab Windows CVI), USB host controller driver programming, USB device driver programming, USB firmware programming.

A. Customer application programming

Application program adopts Lab Windows CVI 7.0, which is a virtual development environment, launched by the company of National Instruments; it fully supports C language developing, and has a rich function data library. The virtual oscillograph that this data acquisition card used is

developed under Lab Windows CVI. The works of the application program are as follow: sample data preserving, waveform analyzing in frequency domain and the time domain, sample frequency controlling, as well as the related parameters calculating.

B. USB device driver programming

Device driver is the bridge among application program, hardware and operating system. Device driver turns read / write order into standard USB request pack and transmits the pack to next driver program. Device driver need to analysis various descriptor of the device, and grasp function and the nature of the device, then work out an adaptive algorithm and the whole software architecture.

The USB driver program of this card is developed in Visual C + + 6.0 environment with Microsoft DDK kit, finally the program is packaged into the form of DLL and then be debugged in Lab Windows CVI. The major function of this driver is doing the read/write operation of the USB ports.

IV. USB FIRMWARE PROGRAM DESIGN

Firmware is a critical part of device programming in the whole USB data acquisition system; it directly affects the speed of data transmission between USB devices. The goal of firmware design is making PDIUSBD12 transmit fastest on USB. The firmware of PDIUSBD12 could be designed as a kind of interruption program. When CPU handling foreground task (data collection), the data transmission of USB can be finished at backstage. The mechanism ensures the best speed and the best software architecture

[3]. In the

course of USB interface designing and developing, software programming could be divided into four facts mainly as follow:

A. USB device controller driver

The USB device controller driver is concerning the CPU chip that has chosen specifically includes initializing the disposition of PDIUSBD12 and LPC2210 connection, establishing communication function between LPC2210 and PDIUSBD12. Those functions are used to make CPU write order and data to PDIUSBD12 or make CPU read order and data from PDIUSBD12.

B. USB interface controller driver

USB interface controller driver makes the various specific functions of PDIUSBD12 effective, but those functions are up to the order interface itself, and that is nothing to do with CPU that actually controls PDIUSBD12, the agreement layer and application layer always use the control functions.

C. USB agreement layer

USB agreement layer is responsible to handle standard requests that come from devices, from those requests the host can get the information of related USB devices, then enumerates every device and make data be received and dispatched correctly from or to port 1 and port 2.

PDIUSBD12 FUNCTION LPC2210 D0-D7 PDIUSBD12 data line D0-D7 A0 PDIUSBD12 address line A0

nCS PDIUSBD12 chip choose

signal(active-low) nCS

nWR PDIUSBD12 write enable

(active-low) nWE

nRD PDIUSBD12 read enable

(active-low) nCE

nINT PDIUSBD12 interrupt out

(active-low) nINT2

nRESET PDIUSBD12 reset in

(active-low) VCC

SUSPEND PDIUSBD12 suspend

(active-high) GND

358

Page 3: [IEEE 2010 International Conference on Machine Vision and Human-machine Interface - Kaifeng, China (2010.04.24-2010.04.25)] 2010 International Conference on Machine Vision and Human-machine

D. USB application layer

USB application layer could realize all the functions of PDIUSBD12, and the 3 above-mentioned parts are all in the control of application layer. Application layer is the core of the whole software system. Therefore software program should take the realization of the function of application layer as the criterion, which can be summarized as that: the sequence of programming should be from top to bottom, from entirety to specificity. The function of application layer includes:

1) Initialization PDIUSBD12. It includes initializing the hardware that connects

PDIUSBD12 and CPU, resetting the entire variable that is related to initialization. In the process of initialization, the peculiar technology of soft-connection of PDIUSBD12 is properly applied.

2) Programming interruption service routine of PDIUSBD12.

It includes controlling the data receiving and transmitting from or to port 0, taking the responsibility for handle USB standard device request; controlling the data receiving and transmitting from or to port 1 and port 2 to realize data exchange.

3) Reading/writing API functions in port 1 and port 2.

E. Interruption program design

USB agreement stipulates HOST initiates any data transmission, when the necessary initialization of USB device port is over; servo program enters main loop body before it waits for interruption signal. And then the host sends token pack to USB device through port 0. After receiving token pack, PDIUSBD12 sends interruption signal to microprocessor (LPC2210), microprocessor enters interruption service routine after responding interruption

signal. In the PDIUSBD12,the corresponding interruption flag is cleaned at first, then the interruption register of PDIUSBD12 is read. After the type of USB token pack gets judged, corresponding operation is carries out

[4]. Fig.3

shows corresponding interruption service routine flow chart; this picture is also the key part of the whole software process in this system.

F. Brief summary about firmware programming

When the host could enumerate USB devices, a successful transmission could be promised. As a legal

peripheral memory element,the device will carry out data interaction with the host.

Besides that the communication between microprocessor and PDIUSBD12 (USB interface controller driver) is controlled by the order and data that come from microprocessor. There are 3 kinds of basic order from PDIUSBD12: Initialization order, data stream order and general order

[5]. The problems in the programming are

summarized as follow: PDIUSBD12 makes microprocessor trigger interruption

service by forcing its interruption pin sends out low-level signal. Therefore in the firmware programming, we must make sure the transmission status register is read before next

transmission. And in order to clean the interruption flag in the register, the interruption signal must be pulled high.

2) After reading/writing the data of port buffer, we must use order F2H to release buffer, and make sure new information pack can be taken over.

3) After writing data to input port buffer, we must use order FAH to show clearly that the data in buffer is effective and set full sign in the buffer to make sure data can be dispatched to host.

4) After controller input port receives SETUP pack, we must use D8H order to enable port 0 again.

V. TEST AND CONCLUSION

According to Shannon sampling theorem that signal will be restored without distortion when the sampling frequency is at least 2 larger than the original signal. The waveform of this data acquisition system could be restored in the virtual oscillograph (programmed by Lab Windows CVI) by recording the collected data. Figure 4 and Figure 5 are the waveforms that be restored and is produced by function signal generator.

Fig. 4 Sampling frequency (6K) signal frequency (1K)

Fig. 5 Sampling frequency (6K) signal frequency (0.5K)

After test anglicizing, the collected signal frequency

would better not beyond 4 KHz, the signal waveform whose frequency below 1.5 KHz can be restored clearly in oscillograph. The reason is the detection result is limited strictly by the highest frequency (13 KHz) that system can support. But when sampling frequency and signal frequency satisfy Shannon sampling theorem only, the waveform that shows is not smooth. It means that in each period of signal

359

Page 4: [IEEE 2010 International Conference on Machine Vision and Human-machine Interface - Kaifeng, China (2010.04.24-2010.04.25)] 2010 International Conference on Machine Vision and Human-machine

frequency, it is impossible to completely restore a waveform in virtual oscillograph by collecting only 2-4 points, especially when sine wave comes.

This data acquisition card can realize the purpose of high speed collection by using LPC2210 chip, the card’s ability of sampling satisfies the accurate measure requirement of real-time completely. Besides that the card’s is portable, and easy to use, supports OTG (on-the-go), and do not need the power supply outside.

ACKNOWLEDGMENT

Thanks a lot to Wang Kun , Xiong Jianmin ,Liu Yaohe, Song Tingxin, Chen Rui, Zhou Jun, Hu Changhui, He Zhengxing and Yang Yang for the hard work in this paper.

REFERENCES

[1] Ma wei. The principle of USB system in computer and the design of its HOST and SLAVE [M]. Beijing: University of aviation and aerospace press.2004.1.(in Chinese)

[2] Zhou ligong. PDIUSBD12 USB firmware programming and driver developing [M]. Beijing: university of aviation and aerospace press.2003.2.(in Chinese)

[3] Zhou ligong. USB interface chip with parallel bus [M] . Beijing: University of aviation and aerospace press.2004. (in Chinese)

[4] Jan Axelson[USA].Complete works of USB [M]. Beijing: chinese eletricity press,2001.

[5] Xiao juxiong,Weng tiecheng.USB technolog and its application design[M]. Beijing: Tsinghua University press,2003.(in Chinese)

360