Abstract: The use of a Universal Serial Bus (USB) interface in a data acquisition system improves the transmission speed and enhances the system's anti-interference capability. This system utilizes the high-speed transmission capability of USB and employs the LPC2132 main control chip based on the ARM7TDMI-STM core. The modulated analog signal is converted to digital using an AD7829 converter. After data acquisition, rapid data transmission with a PC is achieved via a USB 2.0 interface chip, ISP1581, thus forming a high-performance data acquisition system.
Keywords: ARM7; USB interface; data acquisition
Design and Realization of Data Acquisition System Based on USB
YAN Shi-lei, SU Wei-jia
(College of Mechanical and Engineering, Liaoning Technical University, Fuxin 123000, China)
Abstract: Uses the Universal Serial Bus (USB) connection in the data acquisition system, enhanced the data acquisition system transmission speed, has strong anti-interference ability of the system. The system uses a Universal Serial Bus (USB) high-speed transmission, uses based on ARM7TDMI-STM the essence LPC2132 master control chip, will be modulated analog signals AD7829 analog-digital conversion, after the completion of data acquisition through the USB2.0 interface chip ISP1581 to achieve with the PC-fast data transfers, constitute a high-performance data acquisition system.
Key words: ARM7; USB Interface; Data Acquisition
Introduction
Currently, commonly used data acquisition cards in domestic and international data acquisition systems include RS-232, RS-485, PCI, and ISA cards. While each of these cards has its advantages, they also have their disadvantages. For example, RS-232 and RS-485 cards have relatively slow transmission speeds, and PCI and ISA cards require insertion into the host's PCI or ISA slots, making them inconvenient to use. Universal Serial Bus (USB) is a newer interface method with advantages such as convenient connection, hot-swapping support, no external power supply required, high transmission speed, and low power consumption. USB 2.0 has a maximum transmission rate of up to 480 Mbps. Therefore, USB-based data acquisition systems have been widely used in fields such as communication, remote sensing, intelligent instrumentation, and industrial automation.
1 System Hardware Design
The hardware of this data acquisition system mainly consists of an AD7829 A/D converter, an LPC2132 microprocessor, an ISP1581 USB 2.0 interface chip, and a PC. The hardware structure diagram of the USB data acquisition system is shown in Figure 1.
Figure 1 System hardware structure block diagram
The working principle of the data acquisition system: The signal collected by the sensor is amplified and filtered by the modulation circuit, and then enters the AD7829 controlled by the microprocessor for analog-to-digital conversion. The converted digital quantity enters the microprocessor LPC2132 and is temporarily stored therein. Then, the USB interface chip transmits the digital quantity to the PC for data processing. At the same time, the control signal sent by the client application on the PC is transmitted to the data acquisition system with LPC2132 as the core through the USB interface [1].
1.1 USB Interface Chip
The data acquisition system uses ISP1581 as the USB interface chip. ISP1581 is a high-performance USB 2.0 interface circuit launched by Philips. It supports 7 IN endpoints, 7 OUT endpoints and one fixed control IN/OUT endpoint. ISP1581 supports the self-test working mode of SUB2.0 and the return working mode of USB1.1. It can run normally under high speed or full speed conditions. It integrates a serial interface engine (SIE), PIE, 8KB FIFO memory, data transceiver, 12MHz crystal oscillator of PLL and 3.3V voltage regulator. The circuit can be directly connected to ATA/ATAPI peripherals and has a high-speed DMA interface. The transmission rate can reach up to 480Mbps/s[2].
1.2 Main control chip and A/D conversion chip
To meet the speed requirements, the main control chip is LPC2132. LPC2132 is a microcontroller based on the ARM7TDMI-STM core from Philips, with 64kB of embedded high-speed Flash memory and 16kB of on-chip static RAM. It has up to 47 5V general-purpose I/O ports, one 8-channel 10-bit A/D converter, and one 10-bit D/A converter, which can provide different analog outputs. It has multiple serial interfaces, including two 16C550 industry standard UARTs, two high-speed I2C interfaces (400kbit/s), SPITM and SSP. The CPU operating frequency of up to 60MHz can be achieved through the on-chip PLL [3].
Although the LPC2132 comes with an 8-channel A/D converter, its conversion time per channel is 2.44µs, which is insufficient for high-speed data acquisition. Therefore, the AD7829 analog-to-digital converter was chosen. The AD7829 is an 8-channel 8-bit analog-to-digital converter with a maximum conversion rate of 2Mbps, which meets the system design requirements.
1.3 Hardware Interface Circuit
The hardware connection diagram of the data acquisition system is shown in Figure 2.
Figure 2 Hardware connection diagram
The analog signal is converted into a digital value by the AD7829. The data is first stored in the register of the LPC2132, and then the LPC2132 transmits the data to the ISP1581. Here, the buffer of the ISP1581 is defined as 8, and 8 channels of converted data are written to it respectively. The PC is connected to the ISP1581 through the USB interface. The ISP1581 is responsible for classifying and interpreting the signals sent by the PC. The specific operation process is as follows: the data sent by the PC to the USB device is written into the buffer of the ISP1581 in the form of packets. When the buffer is full or the data is sent, the ISP1581 sends an interrupt signal to the LPC2132. The LPC2132 responds to the interrupt signal and enters the interrupt service routine to execute the corresponding packet processing. The USB device cannot actively send data to the host. Only when the PC requests the USB device to send data will the LPC2132 write the data required by the host into the buffer of the corresponding endpoint of the ISP1581[4].
2 System Software Design
The software portion of this data acquisition system mainly consists of three parts: firmware program design, application program design, and USB driver design.
2.1 Firmware Programming
In the firmware program, the conversion pulse /CONVST of AD7829 is issued by port P0.18 of LPC2132. When AD7829 finishes conversion, it outputs a valid low level. After receiving the valid level, LPC2132 sends the address of the next channel (configured by the high and low levels of A0, A1, and A2) to AD7829, and then reads the data. When the /RD and /CS signals of AD7829 are valid, the data is read into the data buffer of LPC2132, and the address of the next channel is entered at the same time. This process is repeated to acquire 8 analog inputs until the data acquisition ends.
Communication between the LPC2132 and ISP1581 is achieved by the LPC2132 sending commands and data to the ISP1581. The ISP1581's INT interrupt signal is connected to the LPC2132's EINT0 port. An interrupt is generated when data is successfully received or sent. The firmware program responds to these interrupts and completes device configuration. The device firmware program is written in Keil C and includes four parts: the main loop program, interrupt service routines, USB standard request handling, and bulk data transfer request handling, as shown in Figure 3.
Figure 3 Firmware program block diagram
2.2 Application Design
The applications include Win32 DLL programs and user applications. Win32 dynamic link libraries are binary files containing shared function libraries that can be used by multiple applications simultaneously. Client applications are the software programs that implement the data acquisition system's functions; in this system, they are written in Visual C++.
2.3 USB System Driver Design
The USB system driver adopts a layered architecture model, as shown in Figure 4. The Windows Driver Development Kit (DDK) provided by Microsoft is used.
Figure 4 USB Layered Driver Model
The application communicates with the root hub driver through a Windows-defined software interface (API) via the Win32 subsystem. The USB root hub driver communicates with the Universal Serial Bus Driver (USBD) through USBDI (Universal Serial Bus Driver Interface). Then, US2BD selects one of two host controller drivers to communicate with the host controller below it. Finally, the host controller driver directly accesses the USB physical bus. Before USB is available, it must be configured and the interface selected, and then the pipes of the selected interface are available. Programming on the basis of USBDI will greatly simplify the process. Users do not need to care about the type of IRP, but only need to construct the USB block in the corresponding dispatch routine and send it down through USBDI to control the USB device [5].
3. Conclusion
The USB data acquisition system is superior to traditional real-time data acquisition systems, offering advantages such as easy installation, plug-and-play support, easy expansion, low electromagnetic interference, and high cost-effectiveness. The system utilizes the ARM7 chip LPC2132 and the USB 2.0 interface control chip ISP1581 to implement the hardware and software design and development of the data acquisition system. In experimental testing, a signal generator was used to generate eight analog signals, which were then connected to the input terminals of the data acquisition system. The corresponding waveforms of the eight analog signals could be displayed on the PC, with a single-channel sampling rate of 150 kSPS, meeting the system design requirements and demonstrating the correctness and practicality of the design.
References
[1] Wang Liping, Wu Liming. Design and development of an embedded USB data acquisition system [J]. Electronic Measurement Technology, 2007, 30(9): 24-26.
[2] ISP1581 Users Manual [Z]. Philips Corp
[3] Zhou Ligong, Zhang Hua. ARM7 Explained in Simple Terms [M]. Beijing: Beijing University of Aeronautics and Astronautics Press, 2005. 52-53.
[4] Zhang Guangli, Yan Youyun. Design of USB data acquisition system based on AT89S52 [J]. Instrument and Meter User, 2008, 03: 33~35.
[5] Zhou Chong, Liu Zhen. Design of USB data acquisition system based on AT89S52 [J]. Science Technology and Engineering, 2007, 7(22): 5935~5938.
About the author:
Yan Shilei, male, born in 1982, from Chifeng, Inner Mongolia, holds a master's degree. His main research areas are nondestructive testing and fault diagnosis.
Contact information:
Contact Person: Yan Shilei
Mobile phone: 15041811291 Email: [email protected]
Address: P.O. Box 139, Liaoning University of Engineering and Technology (Zhonghua Road), Fuxin City, Liaoning Province
Postal code: 123000