FPGA Implementation of Embedded Web Server in Remote Measurement and Control

Publisher:HeavenlySunsetLatest update time:2011-11-16 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

0. Introduction

Embedded system refers to a hardware and software system with a microprocessor or microcontroller as the core that is embedded in various products or engineering applications. The embedded Internet technology formed by the combination of embedded system and Internet technology is an emerging technology that has developed in recent years with the popularization of computer network technology. Engineering technicians, managers or debugging personnel can obtain remote data through the Web without going to the site in person, and control and calibrate the measurement and control instruments. Here we introduce the use of embedded soft-core processor Nios II and widely used embedded operating system uClinux to realize the function of remote measurement and control server of power grid parameters.

1. Function and architecture

Figure 1 is the system structure, in which the embedded Web server and the monitoring terminal are located on site, and the connection between them can be realized by serial port, parallel port, USB, etc. The on-site monitoring terminal completes the detection of the power grid parameters (voltage, current, harmonics and other data) in the target area, and transmits the detection results to the web interface in real time, so that no matter where the monitoring personnel are, as long as they are connected to the Internet network, they can observe the power grid parameters in the target area in real time. The implementation process is as follows: the three-phase voltage and current are transformed by the voltage transformer and the current transformer respectively, and then sent to the AID for conversion after circuit conditioning. 128 points are sampled per cycle, and the DSP chip performs FIR digital filtering, FFT operation, calculation of various parameter values, storage, and display on the sampled data. The communication between the measurement circuit and Nios is transmitted through the serial port. According to the pre-agreed communication protocol (based on the Modbus protocol), the measured data can be easily sent to the embedded server with the Nios II processor as the core. Through CGI technology, the command transmission of the remote monitoring end is completed and the measured data is transmitted to the remote monitoring end in real time.

System structure diagram
Figure 1 System structure diagram

2. Hardware Structure

The hardware structure of the system is shown in Figure 2. The core of the hardware system is the Nios II embedded soft-core processor built in the Ahera Cyclone FPGA. The Nios II series embedded processor is a general-purpose RISC structure CPU, which is positioned in a wide range of embedded applications. The Nios II processor series includes three cores: fast (Nios II/f), economical (Nios II/e) and standard (Nios II/s) cores, each optimized for different performance ranges and costs. All three cores use a common 32-bit instruction set architecture (ISA) and are compatible with binary code.

Hardware system diagram
Figure 2 Hardware system diagram

The configuration of Nios II is completed in SOPC Builder. By configuring the required external/internal components, SOPC Builder will automatically generate a CPU suitable for the selected components to meet the system requirements. The 16M CF card is used as the system's external memory to store measurement data, web page files and applications. The Ethernet interface chip uses SMSC's Lan91cl11 chip, which is a single-chip network controller without PCI interface. It has an 8k FIFO and can implement 8-bit, 16-bit, and 32-bit CPU interfaces. It is widely used in embedded system design.

3. Software Structure

The system software structure is shown in Figure 3. uClinux is a project and fully developed code that fully complies with the GNU/GPL (General Public License) convention. It is a branch of standard Linux and is now supported and maintained by Lineo. It is specifically designed for CPUs without MMU and has done a lot of miniaturization work for embedded systems. uClinux For Nios is a uClinux operating system customized by Microtronics for Nios CPU. It is easy to use, does not require a complicated transplantation process, and is automatically integrated into the Nios/Nios II development environment (IDE). As long as you configure the kernel and file system according to your own needs, the WEB server, TCP/IP protocol stack and underlying interface driver are integrated into uClinux. In addition, you can write CGI scripts to realize the function of dynamic web pages. CGI (Common Gate Interface) dynamic gateway interface is a standard interface for external extension applications to interact with WWW servers. External extension applications written according to CGI standards can process collaborative work data input by the client (usually WWW browser) and complete the interactive operation between the client and the server. You can write CGI external extension programs to access external data systems, and client users can query data through it and WWW servers. CGI can be written in PERL, C and most scripting languages. However, since it is a program used in embedded systems and the scripting language requires an interpreter, it is more appropriate to choose C language to write CGI scripts, which can also save a lot of system resources.

Software structure diagram
Figure 3 Software structure diagram

3.1 uClinux operating system kernel and file system configuration

(1) uClinux kernel configuration. The kernel is the core of an operating system. It is responsible for managing the system's processes, memory, device drivers, files, and network systems, and determines the system's performance and stability. Embedded uClinux has a highly flexible and customizable kernel, which maintains the characteristics of Linux source code being open, stable, and resizable. Here, we use the uClinux 1.3 version ported by Microtronix specifically for Nios/Nios II, and reconfigure it as needed: In the "Developing Board" option, you need to select the development board you are using, add a CF card as the system's hard disk, etc.

(2) File system configuration. The file system is an important part of the operating system. For users, the file system is also the most directly visible part of the operating system. It is responsible for managing files on the external memory and providing file access, sharing, and protection functions for the operating system and users. Here, in the file system configuration, select Install Minimal, and then add options such as agetty, boa, dhcpcd, ftpd, inetd, init, ping, route, and telnetd.

3.2 Web server configuration

WEB server workflow
Figure 4 WEB server workflow

The Web Server used in this article is Boa, which is a single-task http server with open source code, high performance and fast speed. Its workflow is shown in Figure 4. At present, the source code of Boa is already included in the code of uClinux. To implement Boa under uClinux, some configuration and modification of Boa are required. Configuring Boa includes the following steps:

(1) Open the "boa.conf' file in the "/target/etc/config" folder in the established file system.

(2) Change "ChRoot" to "/mnt/ide0/www". The purpose is to use the "www" folder on the CF card as the main folder of the Web Server. When the system IP is entered, the server automatically resolves to find a web page named "index.htm" in this directory, which is the homepage of this design.

(3) Add the command "ScriptAlias/mnt/ide0/www/cgi-bin//cgi-bin/" in the "SeriptAlias" option. The purpose is to map the address of the previous folder with a full path to the latter folder. First, it can save a lot of time entering the address in the address bar, which is convenient for users to operate; second, it increases the confidentiality and security of the system. For other options, you can choose the default options.

(4) Save the configured files. After downloading the file system, create a "csi-bin" directory in the "/mnt/ide0/www" file to store CGI script files.

3.3 CGI Program Design

The CGI program is written in C language and embedded with HTML scripts. Therefore, when CGI is executed, it can complete the operation of the specific port and display the returned results on the web page for monitoring personnel to view. The specific operation is: First, the CGI script uses the GET method to receive the "QUERY_STRTING" transmitted from the web page parsed by the Web Server, which represents the user's monitoring command. After receiving the command, the CGI program decodes the command and transmits it to the serial port, sends the acquisition command to the field monitoring module, and receives the acquisition results sent back by it, and quickly transmits it to the Web interface browsed by the monitoring user. It should be noted that after the CGI program is written and successfully compiled, it should be moved to the relevant directory of the CF card, that is, the "www/csi-bin" set by the Boa Web Server introduced above, and its suffix is ​​changed to ".cgi", and the attribute is changed to "executable", so that the Web Server can correctly identify and execute this CGI program.

Web page showing real-time measurement results
Figure 5 Web page showing real-time measurement results

4. Conclusion

This paper combines embedded systems with Internet technology, develops an embedded WEB server on FPGA, and combines it with power grid parameter measurement instruments to form a remote power grid parameter measurement system, which provides technical support for the network management of power grid systems and has good application prospects.

Reference address:FPGA Implementation of Embedded Web Server in Remote Measurement and Control

Previous article:Interesting low-power data acquisition system based on M-BUS
Next article:Overview of Automotive Electronics Measurement System Solutions

Latest Test Measurement Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号