Application of Embedded linux in Industrial Control

Source: Internet
Author: User
Tags network function

1 Preface

With the rapid development of the Internet, the network is more and more widely used, and the network function requirements for various industrial control devices are also increasing. The current requirement is to allow industrial control devices to support TCP/IP and other Internet protocols, so that they can view the device status and set device parameters in a browser that users are familiar, or transmit the data collected by the device to a database on a Windows or Unix/Linux server over the network. This requires the industrial control system to have two functions: first, to complete complex measurement and control tasks on site, because some tasks usually have certain real-time requirements; second, the measurement and control system is required to be connected to a certain type of control network for remote monitoring. In most measurement and control systems currently used, the hardware of the embedded system uses a 8/16-bit single chip microcomputer. The software mostly uses assembly language programming, because these programs only contain some simple cyclic processing control procedures. Therefore, communication between a single-chip microcomputer and a single-chip microcomputer or a host computer is usually established through RS232 or RS485. These networks have problems such as slow communication speed, poor networking functions, and difficult development. Industrial Ethernet has been gradually improved and more applications are available in the industrial control field. Industrial Ethernet uses TCP/IP protocol, which facilitates networking and has the advantages of high-speed control network.

Now, the cost of 32-bit embedded CPU is reduced and performance indicators are improved, which makes it possible for a wide range of embedded systems. The bottleneck restricting the development of embedded systems is highlighted in the software field. Although some embedded operating systems (Vxwork, pSOS, Neculeus, and Windows CE) have emerged since the end of the 1980s s, these dedicated operating systems are commercially available, the high prices of these products are prohibitive for many small companies that produce low-end products. The closed source code also greatly limits developers' enthusiasm. Embedded systems require a highly concise, user-friendly, reliable, widely used, easy to develop, multi-task, and inexpensive operating system. Now, the industry has reached a consensus that embedded linux is the trend of the times. The embedded Linux operating system is widely used because of its low price, powerful functions, and ease of transplantation. It has become a new force.

2. Embedded linux technology

Embedded Linux is a small operating system designed according to the requirements of the embedded operating system. It consists of a Kernel and some customized system modules. Generally, the Kernel is about several hundred kB. Even if other required modules and applications are added, the storage space required is small. It has the characteristics of multi-task and multi-process systems, and some have real-time performance. A small embedded Linux system only needs three basic elements: boot program, Linux microkernel, and initialization process. The CPU used to run embedded Linux can be x86, Alpha, iSCSI, MIPS, PPC, etc. The motherboard used with these chips is very small, usually only one PCI Card, and some are even smaller. The memory required for Embedded Linux is not the well-known general memory, such as hard disk, hard disk, zipdisk, CD-ROM, and DVD, it mainly uses Rom, CompactFlash, DiskOnChip of M-Systems, MemoryStick of Sony, and MicroDrive of IBM (similar to the BIOS size on the motherboard ), memory with a low storage capacity. Its memory can use normal memory or dedicated RAM.

Compared with other embedded operating systems, Linux's source code is open and black box technology does not exist. Linux, as a software platform system that can be tailored, is likely to develop into an excellent resource for embedded device products in the future. The inherent excellent network lineage of Linux paves the way for future development. Therefore, while keeping the Linux kernel system smaller, more stable, and more competitive, the system kernel is optimized in real time to better adapt to the high real-time requirements in the industrial control field. This is precisely the development of the embedded linux operating system in the embedded industrial control system. It also makes Linux a new expensive embedded operating system.

Standard linux kernels usually reside in the memory, and every application is executed from the disk to the memory. When the program ends, the memory occupied by it is released and the program is downloaded. In an embedded system, there may be no disks. There are two ways to eliminate disk dependencies. First, in a simple system, after the system is started, the kernel and all applications are stored in the memory. This is the operating mode of most traditional embedded systems, such as Linux. The second is the special functions of Linux, because Linux has the ability to "LOAD" and "Uninstall" programs, so an embedded system can use it to save memory. A typical system has about 8 MB to 16 MB flash and 8 mb ram, while flash can be used as a file system. Using a flash drive as the interface from flash memory to the file system is an option. Of course, you can also use a flash disk. Flash memory is used to get rid of the system's demand for a disk (dependency). It has the diskonchip technology and cmopactflash card.

Programs used to connect flash memory and the file system are stored in Flash files in the form of files, and can be loaded into the memory when necessary, this dynamic and loaded capability is an important feature that supports a series of other functions. It allows the initialization code to be released after system boot. In fact, Linux also has many utilities running outside the kernel. These utilities are usually run once during initialization and will not run any more. In addition, these utilities can run sequentially in a way they share each other. In this way, the same memory space can be repeatedly used to "call" every program, just like system boot. This saves memory, especially those network stacks that will not be changed once. If you include the functions of Linux loaded modules in the kernel, both drivers and applications can be loaded. Because it can check the hardware environment and install the corresponding software for the hardware, it eliminates the complexity of using a program to occupy a lot of flash memory to handle a variety of hardware. In addition, the software upgrade is more modular. You can upgrade the application and load the driver on flash during system running. The configuration information and running time parameters can be stored as data files in flash.

3 Implementation Scheme of embedded Industrial Control Network

The Industrial Control System Based on Embedded linux runs the embedded Linux operating system with the embedded microprocessor as the core. Applications can be updated through the network, and man-machine interaction can be performed through the keyboard. data can be displayed on the LCD, and important data can be stored in Flash memory and other Flash memory in the form of files; data and alarm information can be transmitted to the upper computer through the serial port, or can be released to industrial Ethernet or Inernet through Ethernet. Users can also achieve remote monitoring and remote maintenance through the network. More importantly, you can make full use of existing software and protocols on the Internet (such as ftp, http, ApachePHPMySQL, and other applications) to quickly build a front-end data collection system, to achieve communication between the measurement and control system and the background management system. Figure 1 shows the system diagram of this implementation scheme. Advantages of this method include:

(1) data can be transmitted to any location using the ready-made INTER-NET network without a dedicated communication line.

(2) It not only transmits data signals, but also audio and image signals.

(3) because the current INTERNET protocol is active and open, the use of dozens of megabytes of Microsoft IE browsers, or a browser with a size of KB can read network data.

4 System Design

4.1 Hardware Design

The hardware operating platform of the embedded system is the basis of developing applications. The entire development board can be based on the IntelR SA-1110 microprocessor architecture.

Figure 2 shows the hardware structure of an embedded system. The hardware selects strongARM MCU in the Intel series for network service applications. StrongARM SA-1110 is a high-performance, low-price, highly integrated microprocessor. The SA-1110 chip is integrated with a 32-bit IntelR Stron-gARM * RISC processor capable of running at 20 6 MHz, a memory bus with a speed of up to 100 MHz and a flexible memory controller, supports SDRAM, SMROM, and variable-latency I/O devices, and provides high storage bandwidth for system design. Because the SA-1110 can adapt to a large flow of network applications, it can provide hardware support for running Linux. In addition, the SA-1110 is also integrated into the Development Board 32 MB of SDRAM, 8 mb flash, 10 baseT Ethernet interface, RS232/RS485 serial port, I/O interface and extended FLASH card memory. For more detailed information about the SA-1110, refer to the relevant information.

4.2 Software Design

The embedded operating system is the core of the entire embedded system. As described above, when the memory and storage capacity of the embedded system are insufficient, the linux system must be reduced. The following are the main technologies involved in the cropping process.

(1) kernel streamlining

Standard Linux is PC-oriented. It integrates many functions that are not needed by embedded systems. Therefore, for some functional blocks that can be independently added or removed, you can retain only the functional modules required by the embedded system when compiling the kernel, and delete unnecessary functional blocks. In this way, the re-compiled kernel will be significantly reduced.

(2) shielding of the virtual memory mechanism

After analysis, we found that virtual memory is one of the reasons that Linux's real-time performance is not strong. In industrial control, some tasks must meet certain real-time requirements. Shielding the virtual memory management mechanism of the kernel can enhance the real-time performance of Linux. When you want to change a mechanism of the kernel, you do not need to write code on a large scale. You can use the Conditional compilation method. At the same time, because the linux system uses a fair time allocation scheduling algorithm for the application process, but this algorithm does not ensure the real-time requirements of the system, it must be changed. There are two ways to change: POSIX and underlying programming. In linux, the real-time famous Pipeline (FIFO) Special queue is used to process the sequence of real-time tasks. In fact, real-time famous pipelines never change pages like real-time tasks, which can greatly reduce the uncertain latency caused by memory paging.

Figure 3 shows the operating principle of Linux.

(3) Compile the device driver

After determining the basic features of the kernel, you need to write a driver for a specific device. You can write the driver according to the rules of writing the driver in Linux. The device driver must have the following functions:

● Initialize and release the device;

● Transfers data from the kernel to the hardware device and reads data from the hardware device;

● Read the data transmitted by the application to the device and the data requested by the application;

● Detect and handle device errors.

(4) developing a flash-based file system JFFS

Applications and important data are usually stored in the Flash file system as files. The JFFS2 file system is log structured, which means that it is basically a long column node. Each node contains part of the information about the file. JFFS2 is specially created for embedded devices like flash memory chips. Therefore, JFFS2 provides better flash memory management and has incomparable advantages for other file systems. The details are as follows:

● JFFS2 performs flash erasure/Write/read operations on the sector level, which is better than Ext2 file system.

● JFFS2 provides better crash/power loss security protection than Ext2fs. When a small amount of data needs to be changed, the Ext2 File System copies the entire sector to the memory (DRAM), merges the new data into the memory, and then writes it back to the entire sector. JFFS2 can change the entire slice at any time (rather than rewrite), and provides crash/power-down security protection.

After the preceding steps are implemented, a small Linux operating system is constructed. The constructed Linux system consists of three parts: process management, memory management, and file management. It supports multi-task concurrency, complete TCP/IP protocol, and Ethernet controller support in Linux. It can be connected to Ethernet through Ethernet ports for remote configuration and monitoring.

When we port the cropped kernel to the target board, we should first compile the kernel into the target code for this processor. Because the porting startup code of different hardware systems may be different, some kernel programs may need to be rewritten. The code that involves writing the Linux boot code and modifying the Code related to the architecture is mainly the boot guide, memory management, and interrupt processing. When the M-System DOC2000 is used as the System startup device, the guiding code can be put on the DOC. In this way, after the system powers up, the boot code can initialize the basic hardware, load the kernel image into the memory and run it, and then burn the debugged kernel and application into the flash memory. Because the cropped Linux has been successfully transplanted to the target platform, you can develop applications based on specific applications when starting a running development system. Such as the data collection module, data processing module, communication and data publishing module.

5 conclusion

Nowadays, Internet applications are being switched to embedded devices. Therefore, it is an inevitable trend to combine industrial control systems with the Internet to achieve network. The embedded linux microprocessor kernel is embedded into a 32-bit MCU System Based on StrongARM SA1110, and then multiple TCP/IP network protocols and basic network communication protocols are constructed, using the embedded operating system's support for underlying hardware and network protocols, as well as the lin-ux kernel and virtual memory mechanisms required for real-time industrial control systems, real-time and reliable measurement and control tasks can be completed. It is foreseeable that this solution has good application prospects in the industrial control field, and has the characteristics of short development cycle, stable and reliable system performance, and strong adaptability.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.