The electromagnetic compatibility (EMC) design of the microcontroller system described in this article is mainly from the hardware and software aspects of the design, the next from the microcontroller PCB design to software processing to introduce the electromagnetic compatibility (EMC) deal with.

Factors that affect electromagnetic compatibility (EMC)

(1) PCB board design: appropriate PCB board wiring to prevent electromagnetic interference (EMI) is essential.

(2) Voltage: The higher the supply voltage, the greater the amplitude of the voltage, the more the emission, and the low supply voltage affect the sensitivity.

(3) power supply coupling: When the device switch, the power line will produce transient current, must decay and filter out these transient current. Transient currents from high di / dt sources cause ground and stitch "firing" voltages, and high di / dt produces a wide range of high frequency currents, excitation components and cable radiation. Current changes through the wire and inductance can lead to pressure drop, reducing the inductance or current changes over time can minimize the pressure drop.

(4) Grounding: In all electromagnetic compatibility (EMC) topics, the main problem is caused by improper grounding. There are three kinds of signal grounding methods: single point grounding, multi-point grounding and mixed ground. In the frequency below 1MHz, can be used single point grounding method, but not suitable for high frequency; in high frequency applications, the best use of multi-point grounding. Hybrid ground is a low-frequency single-point grounding, and high-frequency multi-point grounding method. Ground layout is the key, high-frequency digital circuits and low-level analog circuit grounding circuit can not be mixed.

(5) Frequency: High frequency produces more emissions, and periodic signals produce more emissions. In the high-frequency single-chip system, when the device switch produces a current spike signal; in the analog system, when the load current changes when the current spike signal.

Hardware handling of interference measures

(1) single-chip reset circuit design

In the single-chip system, the watchdog system plays a particularly important role in the operation of the entire microcontroller, since all the interference sources can not be completely isolated or removed, once the CPU to interfere with the normal operation of the program, then the reset system with software processing Measures have become an effective barrier to error correction. Commonly used reset system has the following two kinds:

1) External reset system.

External "watchdog" circuit can design their own can also use a special "watchdog" chip to build. However, they have their own advantages and disadvantages, most of the dedicated "watchdog" chip on the low frequency "feeding dog" signal can not respond, and high frequency "feed dog" signal can respond to the low frequency "feed dog" signal Reset operation does not produce a reset action at the high frequency "feed dog" signal, so that if the program system is stuck in an endless loop, and the cycle happens to have a "feed dog" signal, then the reset circuit can not achieve it The proper function of the. However, we can design a system with a bandpass "feed dog" circuit and other reset circuit is a very effective external monitoring system.

2) On-chip reset system.

Now more and more single-chip microcomputer with their own on-chip reset system, so that users can easily use its internal reset timer, but there are some models of the MCU reset it is too simple, it will There is like the death cycle as the "feed dog" command, so that it lost to monitor the role. There are some single-chip on-chip reset instructions to do better, they generally "feed the dog" signal made a fixed format of multiple instructions in accordance with the order to perform, if there is a certain error, the "feeding dog" is invalid, so greatly Improve the reliability of the reset circuit.

(2) single-chip system input / output electromagnetic compatibility (EMC) design

In the microcontroller system input / output is also the interference source of the transmission line, and receive radio frequency interference signal picking source, we are in the electromagnetic compatibility (EMC) design to take effective measures:

1) using the necessary common mode / differential mode suppression circuit, but also to take some filtering and anti-electromagnetic shielding measures to reduce the interference into the.

2) to take as much as possible in the circumstances permit a variety of isolation measures (such as optical isolation or magnetic isolation), thus blocking the spread of interference.

(3) PCB board electromagnetic compatibility (EMC) design

A PCB board is a support for circuit elements and devices in a microcontroller system that provides electrical connections between circuit elements and devices. With the rapid development of electronic technology, PCB board density is getting higher and higher. PCB board design of good or bad on the single-chip system of electromagnetic compatibility (EMC) a great impact, practice has proved that even if the circuit schematic design is correct, improper design of the printed circuit board, the microcontroller system will also adversely affect the reliability. If the two parallel lines of the printed circuit board are close together, the delay of the signal waveform is formed, and the reflection noise is formed at the terminal of the transmission line. Therefore, in the design of printed circuit board, should be used in the correct way to comply with the general principles of PCB board design, and should meet the anti-jamming design requirements. To make the best performance of electronic circuits, the layout of components and the layout of the wire is very important.

(4) anti-lightning measures

Outdoor use of the microcontroller system or from the outdoor crowding into the indoor power lines, signal lines, to consider the system of lightning protection problems. Commonly used anti-lightning devices are: gas discharge tube, TVS and so on. Gas discharge tube is when the power supply voltage is greater than a certain value, usually tens of V or hundreds of V, gas breakdown discharge, the power line on the strong impact pulse into the earth. TVS can be seen as two parallel and opposite Zener diodes, when the two ends of the voltage is higher than a value when the conduction. It is characterized by a transient over hundreds of thousands of current.

(5) Oscillator

Most of the microcontrollers have an oscillator circuit coupled to an external crystal or ceramic resonator. On the PCB board, the need for external capacitors, crystal or ceramic resonator lead the shorter the better. The RC oscillator has latent sensitivity to the interfering signal, which produces a very short clock cycle, so it is best to select a crystal or ceramic resonator. In addition, the quartz crystal shell to ground.

Software handling of interference measures

The interference signal generated by the electromagnetic interference source can not be completely eliminated in some specific cases (such as in some cases where the electromagnetic environment is relatively poor), and will eventually enter the core unit of the CPU processing, so that in some large-scale integration The circuit is often interfered with, causing it to fail or to work in an erroneous state. In particular, devices such as RAM that are stored in a bistable state tend to flip over strong interference, change the original "0" to "1", or "1" to "0"; some serial The timing and data of the transmission will change due to interference; more serious damage to some important data parameters; the consequences are often very serious. In this case the software design directly affects the overall system of anti-interference ability level.

(1) detection of RAM and FLASH (ROM)

In the preparation of the program we have to write some testing procedures to test the RAM and FLASH (ROM) data code to see if there is an error, in the event of immediate correction, can not be corrected in a timely manner to give the wrong instructions for the user to deal with The It is indispensable for us to add program redundancy when compiling the program. In a certain place to add three or more than three NOP instructions on the reorganization of the program has a very effective role in preventing. At the same time, in the running state of the program to introduce the flag data and detection status, so as to detect and correct the error in time.

(2) measures for important parameter storage

Under normal circumstances, we can use error detection and correction to effectively reduce or avoid the emergence of this situation. According to the principle of error detection and error correction, the main idea is that when the data is written, the check code is written according to the written data, and the data is saved together with the corresponding data. Read out the code. If there is a mistake will automatically correct, the correct data will be sent, and at the same time will be corrected after the data back to cover the original error data; if a two-bit error occurs interrupt report, notify the CPU for exception handling. All of these actions are done automatically by software design, with real-time and automatic completion of the characteristics. Through this design, can greatly improve the system's anti-jamming capability, thereby improving the reliability of the system.

Error detection and error correction principle:

First look at the basic principles of error detection and error correction. The basic idea of ​​error control is to add different rules in the information code group with different rules in order to find or automatically correct the error when the information is read out by redundant monitoring code or school code. For the characteristics of the occurrence of the error, that is, the randomness of the error and triviality, it almost always randomly affect a byte in a bit (bit), so if the design can automatically correct a mistake Check the two-bit encoding. You can greatly improve the reliability of the system.

(3) due to electromagnetic interference procedures will generally have the following circumstances:

1) program running away.

This is the most common interference results, in general there is a good reset system or software frame measurement system can be on the entire operating system will not have much impact.

2) Dead loop or abnormal program code running.

Of course, this dead loop and the abnormal program code is not intended by the design staff intends to write, we know that the program instructions are composed of bytes, some single-byte instructions and some multi-byte instructions, when the interference occurs after the PC pointer Change, so that the original program code has been reorganized to produce a non-guessable executable program code, then this error is fatal, it may be possible to modify the important data parameters, there may be unpredictable control Output and a series of error status.

The above is from the hardware and software aspects of the single-chip system of electromagnetic compatibility (EMC) design and processing.