Precision PCB Fabrication, High-Frequency PCB, High-Speed PCB, Standard PCB, Multilayer PCB and PCB Assembly.
The most reliable PCB & PCBA custom service factory.
PCB Blog

PCB Blog - Electromagnetic compatibility design from PCB board to software processing

PCB Blog

PCB Blog - Electromagnetic compatibility design from PCB board to software processing

Electromagnetic compatibility design from PCB board to software processing

2022-01-19
View:644
Author:pcb

From the PCB board design of the single-chip microcomputer to the software processing is to introduce the processing of electromagnetic compatibility.
1. Factors affecting EMC
1.1 Voltage: Higher supply voltage means greater voltage amplitude and more emissions, while lower supply voltage affects sensitivity.
1.2 Frequency: High frequencies generate more emissions, periodic signals generate more emissions. In a high-frequency microcontroller system, a current spike is generated when the device switches; in an analog system, a current spike is generated when the load current changes.
1.3 Grounding: Among all EMC problems, the main problem is caused by improper grounding. There are three signal grounding methods: single-point, multi-point, and mixed. When the frequency is lower than 1MHz, the single-point grounding method can be used, but it is not suitable for high frequency; in high-frequency applications, multi-point grounding is used. Hybrid grounding is a single-point grounding method for low frequencies and multi-point grounding for high frequencies. The layout of the ground wire is the key, and the ground circuits of high-frequency digital circuits and low-level analog circuits cannot be mixed as much as possible.
1.4 PCB Board Design: Proper printed circuit board (PCB) routing is critical to preventing EMI.
1.5 Power supply decoupling: When the device switches, transient currents are generated on the power supply line, and these transient currents must be attenuated and filtered. Transient currents from high di/dt sources cause ground and traces to "shoot" voltages, and high di/dt generates large-scale high frequency currents that excite components and radiate cables. Changes in current flow and inductance through the wire cause a voltage drop, which can be caused by reducing inductance or changes in current over time.

PCB board

Second, the hardware processing method of interference measures
2.1 Electromagnetic Compatibility Design of Printed Circuit Boards (PCB)
The PCB board is the support of the circuit components and devices in the single-chip microcomputer system, and it provides the electrical connection between the circuit components and the devices. With the rapid development of electronic technology, the density of PCB boards is getting higher and higher. The quality of the PCB board design has a great influence on the electromagnetic compatibility of the single-chip microcomputer system. Practice has proved that even if the circuit schematic design is correct and the printed circuit board design is improper, it will also have an adverse effect on the reliability of the single-chip microcomputer system. For example, if two thin parallel lines on a printed circuit board are very close together, there will be a delay in the signal waveform and reflection noise at the end of the transmission line. Therefore, when designing a printed circuit board, attention should be paid to using the correct method, complying with the general principles of PCB board design, and should meet the design requirements for anti-interference. To obtain the performance of electronic circuits, the layout of components and the layout of wires are very important.

2.2 Electromagnetic compatibility design of input/output
In the single-chip microcomputer system, the input/output is also the conduction line of the interference source, and the pickup source for receiving the radio frequency interference signal. We generally take effective measures when designing:
(1) Adopt necessary common mode/differential mode suppression circuit, and also take certain filtering and anti-electromagnetic shielding measures to reduce the interference.
(2) Take various isolation measures (such as photoelectric isolation or magnetoelectric isolation) as far as possible to block the spread of interference.

2.3 Design of MCU reset circuit
In the single-chip microcomputer system, the watchdog system plays a particularly important role in the operation of the entire single-chip microcomputer. Since all interference sources cannot be isolated or removed, once the CPU interferes with the normal operation of the program, the reset system combined with the software The treatment measures become a barrier to an effective error correction defense. There are two commonly used reset systems:
(1) External reset system. The external "watchdog" circuit can be designed by yourself or built with a special "watchdog" chip. However, they have their own advantages and disadvantages. Most of the dedicated "watchdog" chips cannot respond to the low-frequency "feed the dog" signal, but can respond to the high-frequency "feed the dog" signal, so that it can be generated under the low-frequency "feed the dog" signal. The reset action does not occur under the high-frequency "feed the dog" signal. In this way, if the program system falls into an infinite loop, and the loop happens to have the "feed the dog" signal, then the reset circuit cannot realize it. the proper function. However, we can design a system with a band-pass "feed the dog" circuit and other reset circuits that is a very effective external monitoring system.
(2) Nowadays, more and more single-chip microcomputers have their own on-chip reset system, so that users can easily use their internal reset timers. However, some models of single-chip microcomputers have too simple reset instructions. In this way, there will also be "feed the dog" instructions like the above infinite loop, making it lose its monitoring function. The on-chip reset instructions of some single-chip microcomputers are better. Generally, they make the "feed the dog" signal into multiple instructions in a fixed format and execute them in sequence. If there is a certain error, the "feed the dog" operation is invalid, which greatly The reliability of the reset circuit is improved.

2.4 Oscillator
Most microcontrollers have an oscillator circuit coupled to an external crystal or ceramic resonator. On the PCB board, it is required that the leads of external capacitors, crystals or ceramic resonators be as short as possible. RC oscillators have latent sensitivity to interference signals and can generate very short clock cycles, so crystal or ceramic resonators are selected. In addition, the case of the quartz crystal should be grounded.

2.5 Lightning protection measures
The single-chip microcomputer system used outdoors or the power lines and signal lines introduced into the room from the outside should be considered against the lightning strike of the system. Commonly used lightning protection devices are: gas discharge tube, TVS and so on. The gas discharge tube is when the voltage of the power supply is greater than a certain value, usually tens or hundreds of V, the gas breaks down and discharges, and the strong impulse pulse on the power line is guided into the ground. TVS can be regarded as two zener diodes in parallel and in opposite directions, which are turned on when the voltage at both ends is higher than a certain value. Its characteristic is that it can transiently pass currents of hundreds or thousands of A.

3. Software processing method for interference measures
The interference signal generated by the electromagnetic interference source cannot be completely eliminated in some specific cases (such as in some cases where the electromagnetic environment is relatively harsh), and will enter the unit processed by the CPU, so that in some large-scale integrated circuits often may be disturbed, causing it to not work properly or to work in the wrong state. Especially a device like RAM that uses bistable for storage, it often flips under strong interference, so that the original stored "0" becomes "1", or "1" becomes "0"; some serial The timing and data of transmission will change due to interference; more seriously, it will destroy some important data parameters, etc.; the consequences are often very serious. In this case, the quality of software design directly affects the anti-interference ability of the whole system.

3.1 The program will be roughly in the following situations due to electromagnetic interference:
(1) The program runs away. This situation is a common interference result. Generally speaking, a good reset system or software frame measurement system is enough, and it will not have much impact on the entire running system.
(2) Infinite loop or abnormal program code operation. Of course, this kind of infinite loop and abnormal program code is not intentionally written by the designers. We know that the instructions of the program are composed of bytes, some are single-byte instructions and some are multi-byte instructions. When the interference occurs, the PC pointer occurs. Change, so that the original program code is reorganized to produce unpredictable executable program code, then, this kind of error is fatal, it may modify important data parameters, and may produce unpredictable control A series of error states such as output.

3.2 Measures for storage of important parameters
In general, we can use error detection and correction to effectively reduce or avoid this situation. According to the principle of error detection and correction, the main idea is that when data is written in, a certain number of check codes are generated according to the written data and stored together with the corresponding data; Read the code and make a decision. If there is a one-bit error, it will be automatically corrected, the correct data will be sent, and at the same time, the corrected data will be written back to cover the original wrong data; if there is a two-bit error, an interrupt will be generated and the CPU will be notified for exception handling. All these actions are automatically completed by software design, and have the characteristics of real-time and automatic completion. Through such a design, the anti-interference ability of the system can be greatly improved, thereby improving the reliability of the system. Principles of error detection and correction: Let's first look at the basic principles of error detection and correction. The basic idea of error control is to add redundancy codes in different ways to the information code group according to certain rules, so as to rely on the redundant monitoring code or check code to find or automatically correct errors when the information is read. According to the characteristics of bit error occurrence, that is, the randomness and randomness of error occurrence, it almost always affects a bit (bit) in a certain byte at random. Therefore, if it can be designed to automatically correct a bit error, and Check for two-digit error encoding. It can greatly improve the reliability of the system.

3.3 Detection of RAM and FLASH (ROM)
When programming, we write some testing programs to test the data codes of RAM and FLASH (ROM) to see if there is any error. Once it occurs, it should be corrected immediately. If it cannot be corrected, an error indication should be given in time so that users can deal with it. It is indispensable to add program redundancy when we compile programs. Adding three or more NOP instructions in a certain place can effectively prevent program reorganization. At the same time, the flag data and detection state should be introduced in the running state of the program, so as to detect and correct the PCB board error in time.