The hardware circuit design of a microcontroller application system includes two parts: one is system expansion, that is, when the functional units inside the microcontroller, such as ROM, RAM, I/O, timer/counter, and interrupt system cannot meet the requirements of the application system, It must be expanded outside the chip, select the appropriate chip, and design the corresponding circuit. The second is the configuration of the system, that is, to configure the peripheral devices according to the functional requirements of the system, such as keyboards, monitors, printers, A/D, D/A converters, etc., to design appropriate interface circuits.
The expansion and configuration of the system should follow the following principles:
1. Select a typical circuit as much as possible, and conform to the conventional usage of single-chip microcomputer. It lays a good foundation for the standardization and modularization of the hardware system.
2. The configuration level of system expansion and peripheral equipment should fully meet the functional requirements of the application system, and leave appropriate room for secondary development.
3. The hardware structure should be considered together with the application software scheme. The hardware structure and the software scheme will have mutual influence, and the consideration principle is: the functions that can be realized by the software are realized by the software as much as possible, so as to simplify the hardware structure. However, it must be noted that hardware functions implemented by software generally have longer response times than hardware implementations and take up CPU time.
4. The related devices in the system should match the performance as much as possible. If a CMOS chip single-chip microcomputer is selected to form a low-power consumption system, all chips in the system should be selected as low-power consumption products as possible.
5. Reliability and anti-interference design is an essential part of hardware design, which includes chip, device selection, decoupling filtering, printed circuit board wiring, channel isolation, etc.
6. When there are many peripheral circuits of the single-chip microcomputer, its driving capability must be considered. When the driving capacity is insufficient, the system work is unreliable, and the bus load can be reduced by adding a line driver to enhance the driving capacity or reduce the power consumption of the chip.
7. Try to design the hardware system in the direction of “monolithic”. The more devices in the system, the stronger the mutual interference between the devices and the increased power consumption, which inevitably reduces the stability of the system. As the integrated functions of the single-chip microcomputer become stronger and stronger, the real system-on-chip SoC can be realized. For example, ST’s newly launched μPSD32xx series products integrate 80C32 core, large-capacity FLASH memory, SRAM, A /D, I/O, two serial ports, watchdog, power-on reset circuit, etc.
Practice of common methods for hardware anti-jamming of single-chip microcomputer system
The main factors affecting the reliable and safe operation of the single-chip microcomputer system mainly come from various electrical disturbances inside and outside the system, and are affected by the system structure design, component selection, installation, and manufacturing process. These all constitute the interference factors of the single-chip microcomputer system, which often lead to the abnormal operation of the single-chip microcomputer system, which affects the product quality and output at light level, and causes accidents and heavy economic losses.
There are three basic elements that create interference:
(1) Interference source. Refers to the component, device or signal that produces interference, described in mathematical language as follows: du/dt, where the di/dt is large is the source of interference. Such as: lightning, relays, thyristors, motors, high-frequency clocks, etc. may become sources of interference.
(2) Propagation path. Refers to the path or medium through which interference propagates from the interference source to the sensitive device. Typical interference propagation paths are conduction through wires and radiation from space.
(3) Sensitive devices. Refers to objects that are easily disturbed. Such as: A/D, D/A converter, microcontroller, digital IC, weak signal amplifier, etc.
Classification of interference
1. Classification of disturbances
There are many types of interference, which can usually be classified according to the cause of noise, conduction mode, waveform characteristics, and so on. By cause:
It can be divided into discharge noise, high frequency oscillation noise and surge noise.
According to the conduction mode, it can be divided into common mode noise and series mode noise.
According to the waveform: it can be divided into continuous sine wave, pulse voltage, pulse sequence and so on.
2. Interference coupling method
The interference signal generated by the interference source only acts on the measurement and control system through a certain coupling channel. Therefore, it is necessary for me to look at the transmission between the interferer and the interfered object. The coupling method of interference is nothing more than through wires, spaces, common lines, etc., which are subdivided and mainly include the following:
(1) Direct coupling:
This is the most direct way, and the one that exists most commonly in the system. For example, interfering signals enter the system through the power line. For this form, the most efficient way is to add decoupling circuits. So as to suppress well.
(2) Common impedance coupling:
This is also a common form of coupling, which often occurs when two circuit currents have a common path. In order to prevent this coupling, it is usually considered in circuit design. There is no common impedance between the interference source and the interfered object.
(3) Capacitive coupling:
Also known as electric field coupling or electrostatic coupling. is the coupling due to the presence of distributed capacitance.
(4) Electromagnetic induction coupling:
Also called magnetic field coupling. is the coupling due to distributed electromagnetic induction.
(5) Leakage coupling:
This coupling is purely resistive and occurs when insulation is poor.
Commonly used hardware anti-jamming technology
In view of the three elements that form interference, the anti-interference methods adopted mainly include the following methods.
1. Suppress interference sources
Suppressing the interference source is to reduce the du/dt and di/dt of the interference source as much as possible. This is the most prioritized and most important principle in anti-jamming design, and often results in a multiplier effect. The reduction of du/dt of the interference source is mainly achieved by connecting capacitors in parallel at both ends of the interference source. Reducing the di/dt of the interference source is realized by connecting the inductance or resistance in series with the interference source loop and increasing the freewheeling diode.
Common measures to suppress interference sources are as follows:
(1) A freewheeling diode is added to the relay coil to eliminate the back EMF interference generated when the coil is disconnected. Only adding a freewheeling diode will delay the disconnection time of the relay. After adding a zener diode, the relay can operate more times per unit time.
(2) Connect a spark suppression circuit (usually an RC series circuit, a resistance of several K to several tens of K, and a capacitor of 0.01uF) in parallel at both ends of the relay contact to reduce the influence of sparks.
(3) Add a filter circuit to the motor, pay attention to the shortest possible lead wires of capacitors and inductors.
(4) Each IC on the circuit board should be connected in parallel with a 0.01μF ~ 0.1μF high-frequency capacitor to reduce the influence of the IC on the power supply. Pay attention to the wiring of high-frequency capacitors. The wiring should be close to the power supply end and be as thick and short as possible. Otherwise, the equivalent series resistance of the capacitor will be increased, which will affect the filtering effect.
(5) Avoid 90-degree broken lines during wiring to reduce high-frequency noise emission.
(6) The two ends of the thyristor are connected to the RC suppression circuit in parallel to reduce the noise generated by the thyristor (the thyristor may be broken down when the noise is serious).
2. Cut off the interference propagation path
According to the propagation path of interference, it can be divided into two types: conducted interference and radiated interference.
The so-called conducted interference refers to the interference transmitted to sensitive devices through wires. The frequency band of high-frequency interference noise is different from that of useful signals. It can be solved by adding a filter on the wire to cut off the propagation of high-frequency interference noise, and sometimes adding an isolation optocoupler. Power supply noise is the most harmful and should be handled with special attention.
The so-called radiated interference refers to the interference transmitted to sensitive devices through space radiation. The general solution is to increase the distance between the interference source and the sensitive device, isolate them with a ground wire and add a shield on the sensitive device.
Common measures to cut off the interference propagation path are as follows:
(1) Fully consider the influence of the power supply on the microcontroller. If the power supply is done well, the anti-interference of the whole circuit is solved more than half.
Many single-chip microcomputers are very sensitive to power supply noise, and a filter circuit or voltage regulator should be added to the power supply of the single-chip microcomputer to reduce the interference of power supply noise to the single-chip microcomputer. For example, magnetic beads and capacitors can be used to form a π-shaped filter circuit. Of course, 100Ω resistors can be used instead of magnetic beads when the conditions are not high.
(2) If the I/O port of the microcontroller is used to control noise devices such as motors, isolation should be added between the I/O port and the noise source (a π-shaped filter circuit is added).
(3) Pay attention to the crystal oscillator wiring. The crystal oscillator and the MCU pins should be as close as possible, the clock area should be isolated by the ground wire, and the crystal oscillator shell should be grounded and fixed.
(4) The circuit board is reasonably partitioned, such as strong and weak signals, digital and analog signals. Keep interference sources (such as motors, relays) away from sensitive components (such as single-chip microcomputers) as much as possible.
(5) Use the ground wire to isolate the digital area from the analog area. The digital ground and the analog ground should be separated, and finally connected to the power ground at one point. A/D, D/A chip wiring is also based on this principle.
(6) The ground wires of the single-chip microcomputer and high-power devices should be grounded separately to reduce mutual interference. High-power devices should be placed on the edge of the board as much as possible.
(7) The use of anti-interference components such as magnetic beads, magnetic rings, power filters, and shielding covers in key places such as microcontroller I/O ports, power lines, and circuit board connecting lines can significantly improve the anti-interference performance of the circuit.
3. Improve the anti-interference performance of sensitive devices
Improving the anti-jamming performance of sensitive devices refers to reducing the pickup of interference noise as much as possible from the sensitive device side, and the method of recovering from abnormal conditions as soon as possible.
Common measures to improve the anti-interference performance of sensitive devices are as follows:
(1) Minimize the area of the loop loop during wiring to reduce induced noise.
(2) When wiring, the power and ground wires should be as thick as possible. In addition to reducing the voltage drop, it is more important to reduce the coupled noise.
(3) For the idle I/O ports of the single-chip microcomputer, do not float, but connect to ground or power supply. The idle terminals of other ICs can be connected to ground or power without changing the system logic.
(4) The use of power monitoring and watchdog circuits for single-chip microcomputers, such as: IMP809, IMP706, IMP813, X5043, X5045, etc., can greatly improve the anti-interference performance of the entire circuit.
(5) On the premise that the speed can meet the requirements, try to reduce the crystal oscillator of the single-chip microcomputer and select low-speed digital circuits. (6) The IC device should be directly soldered on the circuit board as much as possible, and the IC seat should be used less.
4. Other common anti-interference measures
Inductor-capacitor filtering at the AC end: remove high-frequency and low-frequency interference pulses.
Transformer double isolation measures: the primary input end of the transformer is connected in series with a capacitor, the shielding layer between the primary and secondary coils and the center contact of the capacitor between the primary and the ground are connected to the ground, and the secondary outer shielding layer is connected to the printed board ground. This is the key means of hardware anti-interference.
Secondary plus low-pass filter: absorb the surge voltage generated by the transformer.
Adopt integrated DC regulated power supply: because there are overcurrent, overvoltage, overheating and other protections. The I/O ports are isolated by photoelectric, magnetoelectric, and relay, and the common ground is removed at the same time.
Twisted pair for communication line: exclude parallel mutual inductance. Optical fiber isolation for lightning protection is the most effective.
Use an isolation amplifier for A/D conversion or use field conversion: reduce errors.
The shell is connected to the earth: to solve personal safety and prevent external electromagnetic field interference. Plus reset voltage detection circuit. To prevent insufficient reset, the CPU will work, especially for devices with EEPROM, and insufficient reset will change the contents of the EEPROM.
PCB process anti-interference:
① The power cord should be thickened, routed and grounded reasonably, and the three buses should be separated to reduce mutual inductance oscillation.
② For main chips such as CPU, RAM, ROM, etc., connect electrolytic capacitors and ceramic capacitors between VCC and GND to remove high and low frequency interference signals.
③ Independent system structure, reducing connectors and wiring, improving reliability and reducing failure rate.
④The contact between the integrated block and the socket is reliable, and the double-spring socket is used.
⑤ Conditionally use more than four layers of printed boards, and the middle two layers are power supply and ground.