Design of wireless data acquisition system based on embedded technology and WEB technology

The hardware configuration of the embedded Web Server based on the MCF5272 chip is as follows: MCF5272 (Cold Fire series) 32-bit processor, two 4M bytes of 16×1M data width FLASH, and 16M bytes of two 16×4M data width SDRAM , Two standard RS-232 serial ports, one standard 10/100M adaptive fast Ethernet interface, one BDM interface, various status indications and power supply, etc. The MCF5272 microprocessor is the most integrated Cold Fire microprocessor released by Motorola so far.

Author: Feng Feng, Shi Yan

1 hardware design

1.1 Embedded Web Server based on MCF5272 chip

The hardware configuration of the embedded Web Server based on the MCF5272 chip is as follows: MCF5272 (Cold Fire series) 32-bit processor, two 4M bytes of 16×1M data width FLASH, and 16M bytes of two 16×4M data width SDRAM , Two standard RS-232 serial ports, one standard 10/100M adaptive fast Ethernet interface, one BDM interface, various status indications and power supply, etc. The MCF5272 microprocessor is the most integrated Cold Fire microprocessor released by Motorola so far. This highly integrated Cold Fire microprocessor combines a 10/100MB Ethernet controller with communication peripherals such as a USB module, which improves the integration level of the MCF5272 integrated communication microprocessor.

It not only provides a new set of communication peripherals, but also includes the popular universal peripherals that the previous Cold Fire standard products have.

1.2 PTR2000+ series wireless data transmission module

PTR2000+ is a wireless data transmission module produced by Paper Communication Technology. It has the advantages of integrated receiver and transmitter, small size, and few peripheral components. It can be directly connected to the MCU serial port or computer RS232 interface. The software programming is very convenient. Due to the design of low transmitting power and high receiving sensitivity, users do not need to apply for a license. Its standard DIP pin pitch is more suitable for embedded design.

PTR2000+ has good product characteristics, working frequency is 433MHz, FSK modulation, and strong anti-interference ability; adopts DDS+PLL frequency synthesis technology, and has excellent frequency stability; it has two frequency bands, suitable for multi-channels. Special occasions for work; the maximum working rate can reach 20Kbit/s, and it can also work at a lower rate (such as 9600bps).

1.3 System principle

The entire system is composed of a data acquisition transmitting terminal and a data receiving terminal.

The data acquisition transmitting terminal is mainly based on the 51 series single-chip microcomputer. The P1 port of the MCU controls the multiplexer to select 8 analog signals. The selected analog signals enter the high-speed AD converter for analog-to-digital conversion. The MCU simultaneously controls the AD sampling frequency and the initial conversion, and the conversion result is stored in the FIFO memory. According to the stipulated communication protocol, the MCU encodes the data, and finally transmits it to the remote receiving end through the data transmission module PTR2000+. In order to improve the reliability of data transmission, after the data is sent, the MCU converts the PTR2000+ to the receiving state and receives the response signal or control word from the host.

Design of wireless data acquisition system based on embedded technology and WEB technology
Figure 1 Data collection terminal structure frame

PTR2000+ sends the received data to MCF5272 embedded Web Server via RS-232. After receiving the data, MCF5272 embedded Web Server converts PTR2000+ to the transmitting state, and then performs CRC cyclic code verification on the data. If the data is correct, package the data through the UDP/IP protocol stack of the embedded operating system and save it in the writable JFFS file system of the FLASH chip. At the same time, it runs the web server and waits for the client server to access the data through the network; error, Then send a resend command to PTR2000+. The MCF5272 embedded Web Server is connected to the Internet through the Ethernet port. The user can remotely configure and manage the system (such as changing the IP, restarting the system, etc.) through the browser (for example: IE), and can call the encapsulated function API Directly read and write certain sectors of the FLASH chip, and save the configuration information and collected data on the system FLASH chip.

Design of wireless data acquisition system based on embedded technology and WEB technology
Figure 2 Data receiving end structure frame

The upper PC is connected to the BDM debugger through RS-232, and the BDM debugger is connected to the Web Server through the BDM port, which can perform initial configuration, debugging and daily maintenance of the Web Server.

2 System software implementation

The software design and realization of the system is one of the keys to the realization of this system.

2.1 System software: including embedded operating system and device drivers

Embedded operating system is operating system software that supports embedded system applications. It is a dedicated operating system with outstanding features in system real-time, hardware relevance, and software solidification. Because Cold Fire series chips are processors without MMU (Memory Management Unit), and uClinux is specially developed for those embedded processors without MMU, so this system adopts uClinux embedded operating system.

uClinux is an embedded version of Linux. It is an embedded operating system with open source code. Its kernel binary image file can be less than 512K. uClinux is designed for processors without MMU, supports multitasking, has a complete TCP/IP protocol stack and supports multiple network protocols. uClinux also supports a variety of file systems, such as ROMFS, NFS, and JFFS. In addition, uClinux is highly portable. Users can easily port it to 68K, Dragon Ball, Cold Fire, Power PC, ARM and other processor computing platforms by reconfiguring and compiling the kernel. Currently uClinux provides two kernel versions, 2.0 and 2.4.

This system adopts uClinux embedded operating system to solve the following three problems:

First, the real-time issue. uClinux itself does not pay attention to real-time issues, it is not proposed for the real-time nature of Linux. The data collection function in this system has certain requirements for the real-time nature of the operating system. By adding other Rt-linux real-time patches to uClinux, the real-time performance of uClinux can be enhanced to meet the real-time requirements of this system.

Second, the establishment of the JFFS file system. The uClinux system uses Romfs as the root file system, and the Romfs file system does not support dynamic erasing and saving. While the embedded Web Server in this system is running, it is required to be able to dynamically save some data, and when the system is restarted, the saved data still exists. Therefore, we need to give full play to the advantages of Flash rewritable, and dynamically wipe and write Flash to save data during system operation. By establishing a JFFS file system, Flash can be used to save data, that is, Flash can be used as the hard disk of the system. The files and data on the Flash chip can be manipulated as files on the hard disk. The parameters of the system operation can be saved in the Flash chip in real time, and the data is still stored in the Flash chip after the system is powered off. In order to implement the JFFS file system on Flash, we need to add support for the JFFS file system and Flash device to the kernel, modify the device driver for the specific Flash chip, generate device nodes and attach the JFFS file system to the Flash device .

Third, write drivers for each device. It mainly includes serial port driver, Ethernet interface driver, BDM debugging interface driver and FLASH chip driver.

2.2 Implementation of Embedded Web Server Software System

The software system of the embedded Web Server includes five parts: ①HTTP engine; ②Virtual file system; ③Configuration module; ④Security module; ⑤Application program interface module.

Design of wireless data acquisition system based on embedded technology and WEB technology
Figure 3 Schematic diagram of embedded Web Server software system

The HTTP engine is responsible for responding to user requests, accessing static data information through the virtual file system, and obtaining dynamic data information through an application program interface.

The virtual file system provides virtual file services for the embedded Web Server. The virtual file system uses a data structure to store file size, modification time and other information. For the dynamic information needed to store the HTML file, a data structure is established to save the pointer of the script and the name of the function called by the script. The virtual file system compiles Java, GIF, PDF, HTML, and text file formats into code recognized by the Web server, independent of the specific file system.

The configuration module allows system administrators to set embedded Web Server parameters from any standard Web browser. The configuration environment variables defined during system startup include the number of concurrent connections, Socket port, host name, root file path, and default Initial file and inactivity timeout and time zone etc.

The opening of the configuration module to standard browsers makes security issues more important, especially the configuration of network devices and access to control information have become the focus of security protection. The security module realizes the protection of sensitive information by defining the security domain on the server and the user name and password defined for each security domain. It is also possible to take encryption measures for the requested data to realize the security protection function.

The application program interface module realizes the data exchange with the embedded application system. In the embedded Web Server, the application program interface communicates with the embedded operating system to realize the configuration, monitoring and control of the embedded system, which is the core of the embedded Web Server software system. The common application program interface modules include CGI (Common Gateway Interface), SSI (Server Side Include) and HCPA (HTML-to-C Preprocessor Approach).

The application program interface module of this system adopts CGI form. CGI provides an embedded Web Server a channel to execute external programs. CGI programs are compiled into executable files and run on the server side. The embedded Web Server calls the corresponding CGI program according to the user’s request. And the dynamic information obtained by the CGI program is encapsulated in the page by the embedded Web Server and sent to the user’s browser.

3 Wireless data transmission

3.1 Communication principle

In this system, based on wireless data transmission, it has a relatively high unreliability. For reliable communication, the corresponding communication protocol is designed during programming, and the data frame number and CRC check are used to check the data. wrong.

The data transmission between the Web Server and the data collection terminal adopts a half-duplex mode. Based on the idea of ​​stop and wait, the data frames to be transmitted are appended with frame numbers in order to ensure the normal transmission of data. The data collection terminal is first in the receiving state. After the Web Server sends the control word (A/D sampling frequency, sampling mode) to the data collection terminal, the Web Server switches to the receiving mode and waits for the terminal to send the confirmation frame. The data acquisition terminal receives the control word and performs CRC data verification. If the data is correct, it sends an acknowledgement frame to the Web Server, the data frame frame number is cleared, and data acquisition and data transmission are started. Otherwise, it sends a retransmission request to Web ServerR.

The data starts to be transmitted. The data collection terminal sends the Nth frame of data. After the transmission is completed, it switches to the receiving state and waits for the Web Server to send the confirmation frame; Web Server receives the data, performs CRC check, compares the frame number with its own frame number, and the data is correct , Add 1 to its own frame counter, and notify the data collection terminal to send the N+1th frame of data.

3.2 Communication protocol

When PTR2000+ has no signal, the serial port outputs random data. In order to ensure the reliability of wireless communication, a simple communication protocol must be defined to package the data for transmission. The data frame format is shown in Figure 4.

Design of wireless data acquisition system based on embedded technology and WEB technology
Figure 4 Data frame format

Taking into account the delay effect in the wireless communication and the transmission and reception conversion time of the digital transmission MODEM, in order to establish the correct synchronization for the reception, it is necessary to add a 5byte padding bit and a synchronization code to the header of the data frame. In the entire data communication, three types of data frames are required, namely the control frame sent by the server, the data frame sent by the data terminal, and the confirmation frame sent by them. The length includes the type code and the sum of the number of bytes of the data frame. Data verification Adopt 16-bit CRC cyclic check code.

The data frame sent by the data terminal is designed to be 48 bytes. When a 12-bit A/D conversion device, such as AD1674, is used, each channel occupies 16 bits, and a cycle of 8 channels of analog signals takes up 16 bytes, so 48 bytes of data The frame can store the data collected in 3 cycles. The purpose of this design is to increase the data transmission rate. When the transmission rate of PRT2000+ is 19.3Kbit/s, this communication protocol is used to collect single-channel signals, and the rate can reach 4Kbit/s. This system can be used in low-speed data acquisition systems.

4 Conclusion

The application range of remote wireless data collection and transmission is very wide, involving industries such as electric power, water conservancy, public security, transportation, petroleum, security and finance. The above design realizes wireless data collection based on embedded Web Server, which is mainly used in low-speed remote data collection systems such as vehicle telemetry, remote wireless meter reading, industrial data collection systems, non-contact RF smart cards, and biological signal collection. The main feature of this system is that the design of its server is based on embedded technology and WEB technology, and the data collection part adopts wireless transmission technology.

The Links:   EL640400-C3 1DI200K-055