Design of Single-Chip Microcomputer Multi-CPU System

Publisher:BeaLaity0170Latest update time:2013-02-21 Source: 51hei Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Single-chip microcomputers are small, flexible, and easy to expand into powerful control systems. At present, some monitoring terminals and many independent control systems (such as: microcomputer excitation devices of generators) are mostly composed of single-chip microcomputers as the core. However, due to reasons such as harsh working environment and electromagnetic interference, even if a single-chip microcomputer designed according to the requirements of the industrial measurement and control environment is used, it is difficult to ensure that the control system can operate reliably for a long time, which leads to the paralysis of the control system. In this way, how to improve the reliability of the control system and ensure that the measurement and control system can operate correctly and stably is particularly important. Obviously, the use of dual CPU redundant design is a very effective solution. Due to the powerful functions and low price of single-chip microcomputers, it provides good conditions for the design of dual-machine redundant systems. To this end, we designed a dual-machine fault-tolerant system consisting of two single-chip microcomputers, which realized the mutual backup and mutual switching of the dual machines with a relatively simple design method that is completely different from the traditional multi-CPU system. In the design of this dual-machine redundant system, the key issues are the reconstruction strategy of the dual-machine system and the arbitration logic switching of the dual-machine system.

1 Traditional multi-CPU system design method

There are three common design methods for traditional multi-CPU systems:

① Use dual-port RAM to realize communication between CPUs. Dual-port RAM is a high-speed parallel transmission chip with two sets of I/O ports and competition arbitration circuits. It can connect two CPUs at the same time. In this way, communication between multiple CPUs can be realized through dual-port RAM.

② Use shared memory to achieve communication between CPUs. This method is similar to the previous method, but the difference is that the previous method uses the competition arbitration circuit of the dual-port RAM to achieve access to the RAM, while this method uses different timings to achieve memory sharing.

③ Use bus method to realize communication between CPUs. Communication between CPUs is realized through interface chips or interfaces such as SPI, I2C and SMBus of the CPU itself.

2 Structure and working principle of the dual CPU system

The dual-CPU control system is completely different from the traditional multi-CPU system design method. It is composed of two AT89C51 CPUs produced by Atmel. The two machines serve as backup for each other, run independently and in parallel, and switch hard logic. The principle block diagram of the dual-CPU control system is shown in Figure 1.

This is a non-voting dual-machine redundant system, where one CPU serves as a hot backup for the other CPU, and the two machines run synchronously on tasks. All input signals are sent to both CPUs through the input interface at the same time, but the output after CPU calculation and processing is controlled by the arbitration switching circuit. Only the main CPU is allowed to read and write external data storage and output to external devices. When the main CPU fails, the system's self-detection switching logic will send a signal to automatically cut off its output channel and alarm through the CPU's working indication system. At this time, the system automatically or manually switches to another backup CPU and opens its output channel at the same time. The backup machine becomes the main machine running state, and the control system is downgraded to single machine operation. People can unplug the original host from the system for maintenance. As can be seen from the figure, the address, data and control buses of the two CPUs are connected to the external data storage through a group of three-state gates (three-state gates 1 and 2) outputs, and some output control I/O ports of the two CPUs are connected to the external output control device through another group of three-state gates (three-state gates 3 and 4) outputs. The control ends of the two groups of three-state gates are simultaneously controlled by the arbitration switching circuit, and the two outputs of the arbitration switching circuit are mutually inversely logical, that is, only one output can make the corresponding three-state gate (such as three-state gates 1 and 3) output normally, and the other output makes the corresponding three-state gate (such as three-state gates 2 and 4) in a high-impedance state, thereby not affecting the normal reading and writing of data by the main CPU and the output of data to the control I/O port.

Click to browse the next page

Figure 1 Schematic diagram of dual CPU control system

Table 1 Truth table of dual-machine arbitration switching logic

ST1 ST2

S

CTL1 CTL2

CPU1 CPU2

1 1

1

0

0 1

1 0

Main Auxiliary

Auxiliary

0 0

´

1 1

Both CPUs are not working properly

1 0

´

0 1

CPU1 is the host, CPU2 is not working properly

0 1

´

1 0

CPU2 is the host, CPU1 is not working properly

[page]

3 Dual-machine arbitration switching logic circuit

In this dual CPU control system, the two CPUs are hot backups for each other and run at the same time, one is the host and the other is the backup. When both CPUs are running normally, the system defaults CPU1 as the host and CPU2 as the backup. When the host fails, the system is required to automatically switch to the backup so that the backup becomes the host, thereby replacing the original host and continuously running from the fault location and sending an alarm signal. At the same time, it is required to be able to manually select the host to run through a manual switch. Let the signals for judging whether the two CPUs are working normally be ST1 and ST2 respectively. When working normally, their states are 1, and when working abnormally, their states are 0. The control end whose arbitration switching circuit output is 0 controls the corresponding three-state gate group of the CPU that is working normally to enable, and the control end whose arbitration switching circuit output is 1 controls the corresponding three-state gate group of the other CPU to prohibit output. The control switch for automatically or manually selecting the host is S. When both CPUs are working properly, the S switch can automatically select or specify the host (when the S switch state is 1, CPU1 is automatically defaulted as the host, and when the S switch state is 0, CPU2 is forced to be the host); when any of the two CPUs is not working properly, it is irrelevant to the state of the S switch at this time. The output of the arbitration switching circuit can ensure that only the enable end of the three-state gate group connected to the normal CPU is 0, thereby controlling the normal CPU to read and write data and output control normally; when both CPUs are not normal, the two outputs of the arbitration switching circuit are 1, and both CPUs cannot read and write data and output control normally. In this way, when any one or all of the two CPUs are normal, it can be guaranteed that only one CPU can read and write data and output control normally. When both CPUs are not normal, the system cannot work normally. The truth table obtained as required is shown in Table 1.

From the truth table, we can get the control signal logic CTL1 and CTL2 of the two control tri-state gates of the arbitration switching circuit respectively:

Click to browse the next page,

The constructed arbitration switching circuit is shown in FIG2 .

Click to browse the next page

 

4 CPU status monitoring circuit

Click to browse the next page

The monitoring circuit uses a microprocessor chip MAX813L with power monitoring circuit and watchdog function. This chip has 4 functions:

① Watchdog timer function. When the watchdog input signal does not change within 1.6s, a watchdog output is generated;

② Voltage monitoring function. When the power is off or the power monitoring voltage is lower than 1.25V, a power-off output is generated;

③ Power-on reset function. Automatically generates a reset signal with a pulse width of 200ms when powered on;

④ Manual reset function: When the manual reset terminal inputs a low level, a reset signal is generated and output.

MAX813L uses DIP-8 package, as shown in Figure 3, the pin functions are as follows:

① MR: Manual reset input terminal, which can be connected to a manual reset button. If the input low level is maintained for more than 140ms, a reset (RST) signal can be generated;

② Vcc: +5v power supply;

③ GND: power ground;

④ PFI: power detection input terminal;

⑤ PFO: power supply detection output terminal, maintains high level when the power supply is normal;

⑥ WDI: Watchdog input terminal. Commonly known as the "feed the dog" signal, the terminal must input a reverse signal within 1.6s;

⑦ RST: reset output terminal. High level is effective, and can output a positive pulse of 200ms. When the power supply Vcc is lower than 4.65v, RST maintains a high level;

⑧ WDO: Watchdog output terminal. It outputs high level in normal operation. When the WDI signal cannot be sent in time and reverses within 1.6s, this terminal outputs low level signal.

Since AT89C51 does not have a watchdog function, in order to monitor the system status, the watchdog timer function of MAX813L is mainly used in this system. The watchdog input terminal WDI is provided by P3.4 of the CPU. The CPU changes P3.4 regularly within the specified time.

The watchdog output terminal WDO provides the current CPU status signal to the STi (i = 1 or 2) terminal of the arbitration switching circuit, so that the arbitration switching circuit automatically or manually determines the host. Figure 4 shows the watchdog circuit connected to CPU1 using MAX813L. When CPU1 works normally and can provide P3.4 signal normally, WDO terminal ST1 outputs high level, D1 is on and D2 is off; when CPU1 works abnormally and cannot provide P3.4 signal normally, WDO terminal ST1 outputs low level, D2 is on and D1 is off. [page]

Click to browse the next page

5 System Hardware Circuit

Figure 5 shows a hardware circuit composed of the dual CPU switching and control system introduced in this article. As can be seen from the figure, each CPU in the system can communicate with the host computer through the RS232 serial port, and the two CPUs run independently of each other, sharing the external 16KB RAM and controlling the 8-way I/O port output through the dual-machine arbitration switching logic circuit. This method can also be used to form a larger capacity (maximum 64KB) external RAM and more output control I/O ports or expand I/O ports by adding three-state gates.

Click to browse the next page

Figure 5 A hardware circuit of a dual CPU switching and control system

6 Conclusion

The dual CPU control system has a unique design. The two CPUs run independently of each other, but they read and write data from the same external RAM. Only the main CPU can actually read and write data, so there is no problem of memory data exchange and sharing. At the same time, only the main CPU can output and control external devices. It can be widely used in occasions requiring high-reliability control. The author applied this technology to the computer sample cutting machine developed by himself and achieved satisfactory results.

Reference address:Design of Single-Chip Microcomputer Multi-CPU System

Previous article:Design of single chip microcomputer for sending and receiving short messages
Next article:Design of automatic control system for ironing machine based on single chip microcomputer

Recommended ReadingLatest update time:2024-11-16 17:56

Volume Control Circuit and Program Design Based on AT89C51
1 Introduction The volume control IC introduced in this article is M62429. There are many similar products on the market, such as FM62429, CD62429, CSC62429, etc. In fact, if you master the programming methods of one or two ICs, it is easy to transplant them to other products with a slight change. M62429 is
[Microcontroller]
Single chip temperature measurement system (AT89C51, DS18B20 temperature sensor, LCD1602)
1. Introduction This system is mainly composed of AT89C51, DS18B20 temperature module and LCD1602. The general principle is that the temperature data collected by DS18B20 is transmitted to P3.3/INT1 (external interrupt 1) of AT89C51, and finally the current real-time temperature is displayed through LCD1602. 2. Rend
[Microcontroller]
Single chip temperature measurement system (AT89C51, DS18B20 temperature sensor, LCD1602)
Design of LED Chinese character dot matrix scrolling display based on AT89C51 microcontroller
LED display screen is a flat display screen composed of light-emitting diode dot matrix modules or pixel units. It has the advantages of high luminous rate, long service life, flexible configuration, rich colors and strong adaptability to indoor and outdoor environments. And it is widely used for information release a
[Microcontroller]
Design of LED Chinese character dot matrix scrolling display based on AT89C51 microcontroller
Application of AT89C51 single chip microcomputer in variable frequency speed regulation constant pressure water supply system
The principle of variable frequency speed regulation constant pressure water supply and the hardware composition and software design method of variable frequency speed regulation constant pressure water supply control system composed of AT89C51 are discussed. 1 Working Principle Compared with water sup
[Microcontroller]
Application of AT89C51 single chip microcomputer in variable frequency speed regulation constant pressure water supply system
Serial communication design based on AT89C51 application system
1 Introduction In the power equipment status detection system using infrared imaging technology, the application system is based on the AT89C51 microcontroller and uses the non-contact infrared thermometer model 3iLRL3 from the American Raytheon Company. This thermometer uses the RS232C serial communication standard
[Microcontroller]
Design of Portable Digital Blood Pressure Monitor Based on AT89C51 Single Chip Microcomputer
introduction At present, due to unscientific eating habits and unhealthy living habits, people are prone to various diseases, and hypertension, as one of the diseases, has seriously threatened the health of modern people. How to detect hypertension as early as possible has become the primary issue for people to fight
[Microcontroller]
Design of Portable Digital Blood Pressure Monitor Based on AT89C51 Single Chip Microcomputer
Intelligent Mine Environment Quality Monitoring System Based on AT89C51
1 Introduction With the purpose of monitoring toxic and harmful gases in mines, this paper introduces the design and implementation of a highly versatile intelligent air monitoring system. Using AT89C51 single-chip microcomputer as the main controller, it can realize the collection, processing, storage, display
[Microcontroller]
Intelligent Mine Environment Quality Monitoring System Based on AT89C51
Design of AT89C51 Single-Chip Microcomputer Digital Electronic Clock
1. Design Purpose and Requirements Design purpose: Through design, cultivate the ability to use the knowledge learned to solve practical problems, the ability to consult information, the ability to self-study and the ability to analyze and solve problems independently and the ability to think independently. Design r
[Microcontroller]
Design of AT89C51 Single-Chip Microcomputer Digital Electronic Clock
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号