“Although the performance of the digital signal processor (DSP) is getting stronger and stronger, and the functions of the embedded system based on DSP are also increasing, the multi-task signal processing and multi-channel process which require high real-time, fault-tolerance and reliability For control applications, the processing power of a single DSP embedded system is not enough. The distributed system has strong processing capability and high reliability. It adopts multiple DSP embedded subsystems to form a distributed system, and uses the concurrency of the distributed system to realize the parallel processing of multiple DSPs to meet the requirements of multi-tasking and real-time performance. At the same time, through the redundant design of hardware and software, the reliability of the system is guaranteed.
Although the performance of the digital signal processor (DSP) is getting stronger and stronger, and the functions of the embedded system based on DSP are also increasing, the multi-task signal processing and multi-channel process which require high real-time, fault-tolerance and reliability For control applications, the processing power of a single DSP embedded system is not enough. The distributed system has strong processing capability and high reliability. It adopts multiple DSP embedded subsystems to form a distributed system, and uses the concurrency of the distributed system to realize the parallel processing of multiple DSPs to meet the requirements of multi-tasking and real-time performance. At the same time, through the redundant design of hardware and software, the reliability of the system is guaranteed.
In this paper, TMS320F2812 DSP is used to realize three homogeneous embedded subsystems A, B, and C with multiple real-time signal processing and multiple process control functions. The CAN bus is used as the communication network to form a distributed system. The system can interact with the external measurement and control center in real time, and simultaneously complete the real-time acquisition/preprocessing of 23 channels of analog signals, 16 channels of digital signal processing, 16 channels of digital signal output, 1 channel of pulse signal processing, and real-time calculation of multi-channel process control parameters. , Real-time recording of various states and parameters, etc. The hardware design of the three subsystems is exactly the same. The information is exchanged with the RS422 serial port through the CAN bus, and the software is configured to allocate resources and dynamically assign tasks to each subsystem, which effectively balances the load of each processor. The three subsystems share resources and backup each other, which improves the reliability of the whole system.
In a real-time system, if the operation of the system cannot meet the requirements of response time, it will lead to the collapse of the entire system. Therefore, the communication and coordination among the components of the distributed system is the key to realize the concurrent processing of the components of the system, share the system resources, balance the load of each component of the system, improve the throughput of the entire system, and ensure the reliable operation of the system.
This paper focuses on the communication mode between the subsystems, the task assignment of the system and the coordination mechanism of the system.
1. Composition of the system
1.1 CAN bus
CAN (Controller Area Network) is a bus-type serial communication network. The CAN bus effectively supports a safe and reliable distributed real-time control system, with flexible communication methods, strong anti-interference ability, and high reliability. 40m), the number of online nodes can reach 110. CAN bus is a multi-master working mode, which can easily form a multi-machine backup system.
1.2 Digital Signal Processor
TMS320F2812 DSP is a high-end product in the field of industrial control. It has the characteristics of fast speed, low power consumption, convenient and flexible interface, easy development, high precision, good compatibility, and abundant resources. F2812 adopts Harvard bus structure, has 32-bit high-performance CPU, the clock frequency is 150MHz and supports dynamic change of the frequency of the phase-locked loop. It has various types of memory such as Flash, PIE interrupt module, A/D conversion module, event manager, Rich peripheral devices such as SCI port, SPI port, eCAN bus and McBSP communication module can meet the needs of various applications.
1.3 Hardware composition of embedded subsystem based on DSP
The embedded subsystem based on TMSF2812 DSP (see Figure 1) is designed to meet real-time multitasking. The hardware and software can be tailored as needed, with high reliability, fast response and high degree of automation.
The hardware design of the three subsystems is exactly the same. Except for the DSP on-chip resources, each subsystem is extended with non-volatile memory (E2PROM or ferroelectric random access memory), SRAM, four-way RS422 interface (two-way RS232 optional), real-time Clock and other auxiliary modules.
1.4 System Architecture
The system is composed of three embedded subsystems A, B, and C based on F2812 DSP to form a homogeneous and asynchronous distributed system through CAN bus (see Figure 2). The three subsystems have no master-slave relationship, and the functions of each subsystem are configured by software according to the system state and through the task allocation strategy. The three subsystems are mutually backup with hardware and software, which improves the reliability of the system.
The three subsystems mainly exchange information through the CAN bus, and the data that changes slowly can also be exchanged through the UART serial port. Each subsystem can simultaneously receive signals and output control signals. Through special hardware design, each subsystem has the function of fault isolation, which can prevent the failure of one subsystem from affecting the work of the entire system.
2. Collaborative work of distributed systems
The resources of a distributed system are located in different locations, and the system needs to constantly monitor the status of each component and check the usage of resources. When a processor fails, the system should respond immediately, re-allocate resources, plan the task allocation scheme, determine the task allocation strategy, reconfigure the system, and sacrifice some performance of the system if necessary to ensure the normal operation of the system.
2.1 System Status Monitoring
The system status includes the working status of each module of each subsystem (the working status of CPU, UART, on-chip memory (SDRAM, FLASH, etc.) and off-chip memory (SRAM), the allocation of non-volatile memory), the allocation of communication status, etc.
In a distributed system, it is difficult for each subsystem to determine the state of the system. To this end, each subsystem on the network should periodically broadcast to other subsystems to notify other subsystems of their status (see Figure 3). If the message of a certain subsystem is not received within the specified time, it is considered that the subsystem is faulty, and the system should reconfigure system resources, reassign tasks, and reconstruct the system.
In Figure 3: SCAB represents the case of subsystem A to B communication. Through the mutual communication between A, B, and C, the state of the system is determined.
Without loss of generality, let the set of states of the three subsystems be SA, SB, SC, then the system state SS is:
where: ρ(A) represents the power set of A, N=|SS|
2.2 Task allocation strategy
In general, the multiprocessor task assignment problem is NP-complete, and a feasible and satisfactory task assignment strategy is usually determined according to specific application requirements. The purpose of task allocation is to reasonably allocate system resources and try to reduce the communication overhead between processors in the system and the overhead required by the execution module. Load balancing is to reasonably distribute the tasks undertaken by the system to each processor in the system to maximize the throughput of the system. Generally speaking, reducing the traffic of the system and balancing the load are contradictory. Therefore, the task allocation strategy is to minimize the communication between the subsystems in the system, and balance the load of each subsystem, so as to improve the performance of the entire system.
There are two ways to assign tasks to the system: automatic and manual. The automatic allocation method is to determine the task allocation strategy according to the system state and the estimation of the task amount of each subsystem, and automatically allocate tasks to each subsystem through the software. The manual distribution method is that the measurement and control center assigns tasks to the subsystems through instructions.
Suppose the system is a distributed system composed of N components, and the task is T, then:
In practical applications, the task allocation strategy is restricted and affected by many factors, such as space constraints, signal interference, communication distance, etc. Therefore, tasks such as load balancing and minimum communication between tasks can only be met to the greatest extent under certain conditions. distribution principle.
In the specific application of the system, considering the requirements of signal interference and data transmission, the tasks undertaken by the system are mainly divided into signal acquisition/preprocessing (SP), signal operation (SC), and process control (SO). The SP task is mainly responsible for the acquisition of 23 channels of analog signals, AD conversion, signal filtering, etc.; the SC task is mainly responsible for the operation of various signals; the SO task is mainly responsible for the parameter calculation of process control, control signal output, and real-time interaction with the measurement and control center. After testing, the CPU load is basically balanced for SP, SC, and SO tasks, and the traffic between the three subsystems is basically the same. Place the subsystems that undertake SP tasks as close to the signal source as possible, and place the subsystems that undertake SO tasks as close to the control components as possible, which can reduce signal interference and data traffic. Based on the consideration of the above factors, according to the system state, determine the task allocation strategy shown in Table 1.
2.3 Collaborative work of the system
The cooperative work of the system includes the unified allocation of system resources (CPU, various types of memory, event manager, GPIO, etc.), determining the task allocation strategy according to the actual demand and system status, and assigning tasks to each subsystem. When the system state changes, the system resources are reconfigured, the task allocation strategy is determined, and tasks are reassigned to each subsystem (see Figure 4). When the system is working normally, the three subsystems undertake the tasks of signal acquisition/preprocessing, signal operation and process control respectively; when one or two subsystems fail, the system detects the conditions of each subsystem through the CAN bus to determine the state of the system, according to the Task allocation strategy, the task of the faulty subsystem is replaced by the remaining subsystems. When the line fails, the measurement and control center sends instructions through the serial port to manually assign tasks to ensure the normal operation of the system.
2.4 Auxiliary communication and interaction with measurement and control center
The system consists of three subsystems, each of which has four RS422 serial ports, denoted as Ai, Bi, Ci (i=1, 2, 3, 4). According to the requirements of the task, Ai, Bi, and Ci are connected together to complete the tasks of information collection, auxiliary communication between subsystems, and interaction with the measurement and control center.
The purpose of real-time interaction with the measurement and control center is: on the one hand, the system status and various parameters are transmitted to the measurement and control center; on the other hand, the measurement and control center can send instructions to complete the specified tasks.
The measurement and control center monitors the working status of the system in real time. When the CAN bus works normally, the system automatically completes tasks such as task assignment; when the CAN bus is disconnected or other line failures occur, the measurement and control center sends instructions to the system to manually assign tasks to ensure the normal operation of the system.
According to the requirements of the task, the serial ports Ai, Bi, Ci (i=1, 2, 3, 4) of the three subsystems will conflict when they are connected together to send data. Therefore, the system should determine the line status according to the working status of each serial port. Read and write to the serial port is determined according to the line state.
This paper introduces the software and hardware design scheme of the CAN bus-based distributed system composed of three DSP embedded subsystems, and focuses on the way of cooperative work among the subsystems. The system makes full use of the concurrency and reliability of the distributed system. On the basis of meeting the requirements of multi-channel signal real-time processing, multiple process control, and real-time interaction with the measurement and control center, it adopts automatic task assignment and instruction assignment tasks. The combined method effectively improves the reliability of the system. Experimental simulations and field tests show that the system not only meets the mission requirements, but also has high stability and reliability.