Discussion on Electromagnetic Compatibility Design of SCM System from PCB Design to Software Processing
PCB design to software processing to introduce the handling of electromagnetic compatibility.
First, the factors that affect EMC
1, the voltage: the higher the power supply voltage, means that the greater the voltage amplitude, the more emission, and low power supply voltage sensitivity.
2, frequency: high-frequency produce more emissions, periodic signals produce more emissions. In high-frequency microcontroller systems, current spikes occur when the device is on and off; in analog systems, current spikes occur when the load current changes.
3, grounding: In all EMC problems, the main problem is caused by improper grounding. There are three ways to signal ground: single point, multipoint and mixed. When the frequency is lower than 1MHz, single-point grounding method can be used, but not suitable for high frequency; in high-frequency applications, it is best to use multi-point grounding. Hybrid grounding is a single-point low-frequency grounding, and multi-point high-frequency grounding. Ground layout is the key, high-frequency digital circuits and low-level analog circuit ground circuit can not mix.
4, PCB Design: Appropriate printed circuit board (PCB) wiring to prevent EMI is crucial.
5, the power to the coupling: When the device switch, the power line will have a transient current, you must attenuate and filter out these transient currents. Transient currents from high di / dt sources cause “firing” of the ground and stray voltages, and high di / dt produces a wide range of high frequency currents that excite components and cable radiation. Current variations and inductances through the leads cause a voltage drop that can be minimized by reducing inductance or current over time.

Second, the interference of hardware processing methods
1, printed circuit board (PCB) of the electromagnetic compatibility design
The PCB is a support for circuit components and devices in a microcontroller system that provides electrical connections between the circuit components and the device. With the rapid development of electronic technology, PCB density is getting higher and higher. PCB design is good or bad on the microcontroller system electromagnetic compatibility has a great influence, practice has confirmed that even if the circuit schematic design, improper design of the printed circuit board, monolithic integrated circuit system will have an adverse effect on the reliability.
For example, if two thin parallel lines of a printed circuit board are close together, a delay of the signal waveform is formed, and reflection noise is formed at the terminal end of the transmission line. Therefore, in the design of printed circuit board, should pay attention to the correct way to comply with the general principles of PCB design, and should meet the anti-jamming design requirements. To get the best performance of the electronic circuit, the layout of components and the layout of the wire is very important.

2, the input / output of the electromagnetic compatibility design
Input / output in the SCM system is also the source of interference lines, and to receive radio frequency interference signal pickup source, we generally take effective measures to design:
① The necessary common mode / differential mode suppression circuit, but also to take some filtering and anti-electromagnetic shielding measures to reduce the interference into.
② If possible, adopt various isolation measures (such as optical isolation or magneto-electric isolation) as much as possible, thus blocking the propagation of interference.

3, microcontroller reset circuit design
In the one-chip computer system, the watchdog system plays an especially important role in the operation of the entire microcontroller. Since all the sources of interference can not be isolated or removed, once the system enters into the normal operation of the CPU interference program, the reset system incorporates software Measures have become an effective barrier to error correction. Common reset system has the following two kinds:
① external reset system. External “watchdog” circuit can design their own can also use a special “watchdog” chip to build. However, they all have their own advantages and disadvantages. Most dedicated watchdog chips do not respond to low frequency “feed dog” signals, whereas high frequency “feed dog” signals respond to low frequency “feed dog” signals The reset action does not generate a reset action at the high frequency “feed dog” signal so that if the program system falls into an infinite loop that happens to have a “feed dog” signal, the reset circuit can not achieve it The due function. However, our own design of a system with a band-pass “dog-feeding” circuit and other reset circuits is a very effective external monitoring system.
② Now more and more single-chip microcomputer has its own on-chip reset system,
so users can easily use its internal reset timer, however, some models of its reset command is too simple, so There would be a “feed dog” instruction, like the above-mentioned dead loop, losing its ability to monitor. There are some single-chip reset instructions on the chip to do better, they generally “feed dog” signal into a fixed format, multiple instructions in order to perform, if there is a certain error, the “feed dog” invalid operation, so much Improve the reliability of the reset circuit.
4, oscillator
Most microcontrollers have an oscillator circuit coupled to an external crystal or ceramic resonator. On the PCB, requires an external capacitor, crystal or ceramic resonator leads as short as possible. The RC oscillator is potentially sensitive to interfering signals and can generate very short clock cycles, so it is best to choose a crystal or ceramic resonator. In addition, the shell of quartz crystal should be grounded.
5, anti-lightning measures
Outdoor use of single-chip microcomputer system or the exclusion of the room from the outdoor power lines, signal lines, to consider the system of anti-lightning topics. Common lightning protection 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 dozens of V or hundreds of V, gas breakdown discharge, the power line on the impact of a strong pulse into the earth. TVS can be seen as two parallel and opposite direction Zener diodes, when the voltage across the two ends is turned on. Its characteristic is that it can transiently pass hundreds of thousands of current.

Third, the interference measures of software processing methods
Interference signals generated by sources of electromagnetic interference can not be completely eliminated under certain conditions (such as in some severe electromagnetic environments), and will eventually enter the CPU-intensive core unit. In some large-scale integration Circuits are often disturbed, causing them to malfunction or work in the wrong state. In particular, devices such as RAM, which utilize bistable storage, tend to flip under strong disturbances, causing the originally stored “0” to change to “1” or “1” to “0”; some serial Transmission timing and data will be changed due to interference; more serious will destroy some of the important data parameters; the consequences are often very serious. In this case, the quality of the software design directly affects the anti-interference ability of the whole system.
1, the program will be roughly due to electromagnetic interference in several cases:
① program to fly. This situation is the most common interference results, in general, there is a good reset system or software frame measurement system can, the entire operating system will not have much impact.
② dead cycle or abnormal code to run. Of course, this cycle of death and abnormal code is not designed to deliberately write staff, we know that the instructions of the program is composed of bytes, some single-byte instructions and some multi-byte instructions, when the PC pointer occurs after interference occurs Change, so that the original code has been reorganized produced unpredictable executable code, then, this error is fatal, it may be to modify the important data parameters, it may produce unpredictable control Output and a series of error status.
2, the storage of important parameters of the measures
Under normal circumstances, we can use error detection and correction to effectively reduce or avoid the appearance of this situation. According to the principles of error detection and error correction, the main idea is that when a data is written in, a certain number of bits of the check code is born according to the written data, and is stored together with the corresponding data. When the data is read, the check Code read out, the judgment. If there is an error is automatically corrected, the correct data is sent, and at the same time will be corrected after the data write-back cover the original error data; if there are two errors will generate an interrupt report, notify the CPU for exception handling. All of these actions are done automatically by software design, with real-time and auto-complete features. Through such a design, can greatly improve the anti-interference ability of the system, thereby improving the reliability of the system.
Error detection and correction principle:
First look at the basic principles of error detection and correction. The basic idea of error control is to add redundant codes in different ways with certain rules in the information code group so as to find or automatically correct the errors when the information is read by relying on redundant monitoring codes or school codes. Aiming at the characteristics of error code, that is, the randomness and small probability of error occur, it almost always randomly affects a certain bit in a byte, so if it can be designed to automatically correct an error, Check the two wrong encoding. Can greatly improve the reliability of the system.
3, the detection of RAM and FLASH (ROM)
In the preparation of the program, we’d better write some test procedures to test the RAM and FLASH (ROM) data code to see if there is an error occurred, once occurred to be corrected immediately, can not be corrected to give timely instructions to allow users to deal with.
Finally, it is indispensable to include program redundancy in programming. In certain places add three or more NOP directives on the restructuring process has a very effective role in preventing. At the same time, in the operating status of the program to be the introduction of flag data and test status, and thus timely detection and correction of errors







