Share this

Research on Industrial Embedded Control Systems Based on LINUX and CAN Bus

2026-04-06 08:57:29 · · #1
Abstract: This paper introduces the technical requirements and characteristics of embedded systems in industrial control, elaborates on the real-time performance of control systems, provides a simple example of an embedded industrial real-time control system design based on CAN bus, and discusses the key technologies for operating systems and application software programming required by users in the redevelopment process. Keywords: Embedded control system; Real-time; LINUX; CAN bus 1. Introduction Control systems based on fieldbus have been widely used in industrial control. Fieldbus, defined by the International Electrotechnical Commission (IEC) 61158 standard, is applied in production sites to enable bidirectional, serial, multi-node communication between field devices and between field devices and control devices. It is also known as an open, digital, multi-point communication low-level control network. Fieldbus has advantages such as system openness, interoperability and interoperability, intelligent and functional autonomy of field devices, highly distributed system structure, and adaptability to the field environment. Therefore, fieldbus has become one of the hot topics in the field of automation technology development. In recent years, control modules adapted to fieldbus have been designed, and their advantages such as low power consumption, high reliability, and ease of development have made them a major component of embedded systems. Embedded application technology refers to the integration of a fully functional small or microcomputer device as a component or subsystem with a carrier to form a more reliable, stable, and powerful system. The main performance requirements for industrial embedded systems are: real-time performance, high efficiency, security, stability, reliability, compact structure, ease of customization, and good openness. Real-time performance refers to event-driven and time-driven capabilities, based on the kernel's architecture and process management mechanisms. High efficiency includes system startup and running speeds, as well as message passing efficiency. Stability and reliability include performance indicators related to stability, security, and fault tolerance. Previously, most industrial embedded operating systems were built on DOS. However, DOS cannot meet the requirements of industrial applications in many aspects, including real-time performance, security, distributed network support, visual programming, and ease of use. Various graphical operating systems are available for embedded applications, such as Windows CE, Palm OS, Blackberry, and EPOC. However, Palm OS, Blackberry, and EPOC are generally only used in handheld devices. Systems suitable for industrial application (process) standards currently include Windows CE and Linux, among others. This article introduces an embedded control system based on the Linux graphical operating system. 2. Embedded Control System Generally speaking, an embedded control system refers to a non-PC system, a device or equipment with computer functions but not explicitly called a computer; in a narrower sense, it is a combination of PLC functions, measurement functions, PID control (e.g., temperature control), human-machine interface functions, fieldbus communication functions, and high-level language programming and library functions. This system includes a control panel and related supporting hardware (microprocessor, I/O ports and other peripherals, expansion modules, memory, etc.) and application software. 2.1 Control Panel (Taking EPIS products from Germany as an example): The design is diverse. Users can choose existing controller panels or customize panels to match their equipment or system environment. The display type is an LCD display, equipped with both dot-matrix and graphic displays. The entire system panel ranges from 144*72mm to 255*183mm, suitable for application on various devices. 2.2 Related Supporting Hardware: The embedded microprocessor is the core of the embedded system. It boasts strong support for real-time and multitasking capabilities, enabling multitasking with short interrupt response times, minimizing the execution time of internal code and the real-time operating system; it features robust memory protection and expansion capabilities; a scalable processor architecture allows for easy and rapid expansion to meet application requirements with high-performance configurations; and it utilizes the low power consumption of the embedded microprocessor. The number of I/O ports (digital inputs and outputs) is selectable, with each port expandable up to 512 channels. The input voltage is 24VDC, divided into standard speed ports (3.5ms from high to low, 2.8ms from low to high) and fast input ports (20μs response time), while a high-speed input port is also available with a rated voltage of 5V or 24V and a response time of 1.1μs. The digital output ports employ a 24V opto-isolated structure, with a maximum current of 500mA per channel, and are equipped with short-circuit and overload protection; the relay output ports have one normally open and one normally closed contact, a maximum conversion voltage of 48VDC, a maximum conversion current of 1A, a maximum conversion capacity of 30W, and an operating time of 3ms. The number of analog input and output ports can each be expanded to 40. The analog input ports include both voltage and current inputs, and can also receive temperature sensor signals. The internal A/D converter is 15-bit with a conversion time of 20μs. Special function ports include: multiple high-speed counter input ports (maximum input frequency 25kHz); incremental encoder input ports (maximum input frequency 1MHz); and a 25-bit absolute encoder input port. The internal D/A converter for analog output is 11-bit with a conversion time of 100ms. The CAN bus expansion module is opto-isolated and compatible with ISO/DIS 11898. Its transmission cable is a double-wound shielded cable, and the bit rate varies depending on the cable length. The CAN bus expansion module card has its own CPU and can operate independently offline, saving the main CPU overhead. The bus function can support one or more CAN bus ports and multiple expansion slots. Utilizing TCP/IP network functionality, it supports online data exchange between devices and between devices and the network. Optional interfaces include RS232/RS485, CANopen, and Profibus. 2.3 Application software includes operating system software and application programming software. Operating system software includes hardware-related low-level driver software, system kernel, device driver interfaces, communication protocols, and graphical interfaces. The basic characteristics of an embedded operating system are its ability to effectively manage increasingly complex system resources, virtualize hardware, and free developers from the burden of driver porting and maintenance; it provides a large number of dedicated and general-purpose library functions, drivers, toolsets, and applications. Application programs control the system's operation and behavior to complete specific tasks, while the operating system controls the interaction between application programming and hardware. The programming environment is excellent; programming on a PC provides convenient simulation, breakpoint setting, parameter setting and tracing, single-step execution, and other debugging functions. 3. Real-time Performance of Industrial Embedded Control Systems and the Linux Operating System 3.1 Real-time performance is a fundamental requirement of industrial systems and one of the most important indicators for evaluating embedded systems. Operating systems in industrial control require strict real-time performance, which is also a key characteristic of embedded systems. Real-time systems require all tasks to be completed within a specified timeframe, such as field data acquisition, power monitoring and management, and spacecraft flight control. Designing a real-time system has two relative objectives: first, to ensure strict time-critical deadlines; and second, to fully and effectively utilize various resources while maintaining good fault tolerance. Embedded systems, under software control, acquire data at high speed through hardware, process it, and generate corresponding responses. The entire process must adhere to strict time and reliability constraints. Key concepts in real-time operating systems include: system response time (the time from when the system issues a processing request to when it provides a response signal); context switching time (the time used for switching between tasks); and interrupt latency (the time from when the computer receives an interrupt signal to when the operating system responds and completes the context switching to the interrupt service routine). A real-time operating system should have the following functions: task management (multi-tasking and priority-based task scheduling); inter-task synchronization and communication (semaphores and mailboxes, etc.); memory optimization management (including ROM management); real-time clock service; and interrupt management service. Generally, based on the deadline requirements in practical applications, real-time processes can be divided into hard real-time processes that strictly meet deadlines and soft real-time processes that are only related to deadline requirements. Real-time Linux scheduling strategies should use threads as the basic unit of scheduling. A scheduling clock is arranged in the scheduling system and used as a reference for thread scheduling. The scheduling clock is based on the priority set when the thread is created, and threads with higher priority will run continuously. If two threads have the same priority, random scheduling is used. Linux is a general-purpose operating system, and its kernel does not support event priority and preemptive real-time performance. Therefore, when using Linux as an embedded system in industrial measurement and control, real-time functionality must be developed and extended to elevate Linux to a real-time operating system. 3.2 Linux is composed of many small and high-performance microkernels and components. Due to the complete openness of the kernel code, users at different levels and in different fields can modify and tailor the kernel according to specific application needs, designing embedded operating systems that meet their requirements at a lower cost. It has a complete toolchain (gcc), allowing users to easily build and configure embedded systems and their development and simulation environments without the need for a dedicated emulator. It supports RISC and CISC architecture chips, and 16-bit, 32-bit, and 64-bit CPUs. For currently popular devices, it can run on Intel CPUs, IBM and Motorola PowerPC CPUs, and Alpha and SPARC CPUs. Linux offers excellent flexibility. An application written on a 64MB PIII platform can be ported to an 8MB embedded hardware device and run reliably and stably. Considering the rapid development of portable and customizable hardware platforms, it provides a rich operating platform for real-time applications (from microcontrollers to DSPs, from CISC to RISC microprocessors, etc.). To adapt to the diversity of hardware platforms, portability must be carefully considered when designing and developing embedded real-time operating system kernels. Embedded Linux is a successful example of an operating system that provides broad platform support. Portability is highly dependent on the language used for implementation. For example, C language has better portability than assembly language for the same functionality. However, code implemented in assembly language has higher execution efficiency and a more compact code space. Therefore, to achieve better execution efficiency, save code space, and obtain strong portability, it is necessary to choose a C language compiler that excels in code optimization and can effectively optimize C code. [align=center]Figure 1 LINUX Kernel Architecture[/align] The above figure shows the Linux kernel architecture. It clearly divides the Linux kernel source code into architecture-dependent and architecture-independent parts. The architecture-independent parts define the interface with the underlying layers, i.e., the architecture-dependent parts. More precisely, this figure illustrates all operating systems that expect platform independence. Architecture-independent code does not concern itself with the exact definition of macros, leaving the actual hardware architecture to the relevant code sections. This approach improves code reusability, portability, and scalability. However, since Linux uses a monolithic kernel design, a microkernel design would make porting to other architectures much easier. 4 Design of an Industrial Embedded Control System Based on CAN Bus The entire module of an industrial embedded control system based on the CAN bus is shown in Figure 2. [align=center]Figure 2 Schematic diagram of a CAN-based industrial embedded real-time control system[/align] Bus controller SJA1000 8000H~801FH The designed PC/104 module is inserted as an independent control system into a dedicated application board. Several of the same module can be embedded in the same application board in a stacked manner, performing similar functions or completely different functions (such as data acquisition and conversion). PC/104 provides a very compact stacked module that is fully compatible with standard desktop PCs or PC/AT architectures. All the functions of a desktop PC are repackaged into a standard module with a unified format, stability, reliability, flexibility, and conforming to the size of embedded systems. It is PC compatible and very suitable for use in embedded system design to replace traditional embedded microprocessors. The microprocessor can communicate with the system very easily through the PC/104 bus. To meet the requirements of large-scale data exchange, 8kb of RAM is added to expand memory. To increase the driving capability of the local bus, a data/address drive circuit is added between the microprocessor and the PC104 bus. To enhance system expandability, an address decoding circuit was added, decoding addresses 0300H to 031FH for future I/O peripheral use. Simultaneously, to increase the effective transmission distance, the high-performance Philips 82C250 CAN bus transceiver was adopted, offering advantages such as high speed (up to 1Mb/s), immunity to transient interference, bus protection, and support for up to 110 node connections. Additionally, a CAN address selection circuit was designed to ensure the unique address of each CAN bus node within the entire system. 5. Introduction to Linux Embedded Application Programming 5.1 Embedded systems generally lack editing and compilation tools, so program editing, compilation, simulation, and modification must first be completed in the development system to form an executable file, which is then executed on the running system (i.e., the embedded system). Developing applications on a Linux embedded system is event-driven programming, specifically "message queues" and "message loops." Two commonly used message functions are GetMessage() and DispatchMessage(). A common.h file is also generally required. Its programming is very similar to the message handling functions used in VC++ programming. Below, we will introduce some simple and basic GUI elements: main window, static text box, edit box, button, progress bar, dialog box, and some basic graphical operations. Some commonly used message handling functions are as follows: Output text MEG_PAINT (using the TextOut() function) Set pixel color SetPixel() Draw line LineTo() Draw rectangle Rectangle() Draw circle Circle() Set brush color SetBrushColor() Create window MES_CREATE Create main window CreateMainWindow(&CreateInfo) In addition, most controls can be created using the CreateWindow() function. 5.2 RTOS Development Platform General-purpose computers have a complete operating system and application programming interface (API), which is a fundamental and inseparable part of the computer. Application development and completed software run on the platform, but generally not in real time. Embedded systems differ in that applications can run directly on the chip without an operating system. However, to efficiently schedule multiple tasks, utilize system resources, system functions, and expert library interfaces, users must select and configure their own RTOS platform. This ensures the real-time performance, stability, and reliability of program execution, reduces development time, and guarantees software quality. The real-time operating system (RTOS) is a background program that executes first after the embedded system boots up. The user's application programs are tasks running on top of the RTOS. The RTOS manages resources (including memory and peripherals), manages messages, schedules tasks, and handles exceptions according to the requirements of each task. In systems supported by RTOS, each task has a priority, and the RTOS dynamically switches between tasks based on their priorities to ensure real-time performance. When writing programs, individual tasks can be written separately, reducing the workload and the possibility of errors, thus ensuring high reliability of the final program. RTOS embodies a new system design philosophy and an open software framework. Users can add or remove tasks without significantly altering other system tasks. During project development, multiple engineers can work simultaneously on the system's software development, with each engineer only needing to establish procedures and protocols. This shortens development time and reduces the final software product's dependence on any single developer. Mature and general-purpose tasks designed for RTOS can be made available as library functions for others to use, consistent with the design philosophy of the C++ language. 6. Conclusion CAN bus technology has broad application prospects in power plants, substations, and power systems, achieving maximum benefits in reliability, high precision, and economy. Embedded control systems, represented by the industrial standard PC/104, have outstanding advantages and are well-suited to the requirements of industrial environments. With the development of microprocessors and microcontrollers, the use of embedded real-time operating systems in industrial control technology has become a characteristic. Embedded operating systems have undergone a stage of development, and their application in industrial control will inevitably become increasingly widespread. References [1] Mao Decao, Hu Ximing Linux kernel source code scenario distribution [M] Hangzhou Zhejiang University Press 2001 [2] Xu Xin, Chen Ming et al. Design of embedded digital remote control system based on PC/104 bus standard [J] Industrial Equipment and Automation 2000 (3): (27-29 pages) [3] Yang Xianhui Land and air fieldbus technology and application [M] Beijing Tsinghua University Press 1999 (309-386 pages) [4] Cai Decong Industrial control computer real-time operating system [M] Beijing Tsinghua University Press 1999 [5] Lü Jingjian, Xiao Haiqiao Embedded system for the 21st century Beijing Yingbeiduo Embedded Network Technology Co., Ltd. [6] William stallings operating systems internal and design principles [M] Beijing Tsinghua University Press 1998 Research on industrial embedded control system based on LINUX and CAN bus
Read next

CATDOLL Charlotte Hard Silicone Head

The head made from hard silicone does not have a usable oral cavity. You can choose the skin tone, eye color, and wig, ...

Articles 2026-02-22