Friends who have worked on products have all experienced that a design seems easy, and hardware design and code writing can be done quickly, but more or less accidents occur during the debugging process. These are all manifestations of insufficient anti-interference capabilities. Let's
talk about how to avoid detours in your design:
Anti-interference is currently developed in two aspects, one is hardware design, and the other is software writing.
Here is a key reminder: In MCU design, the main anti-interference design is in hardware, supplemented by software. Because the computing power of MCU is limited, it is necessary to spend a lot of time on hardware.
Look at the way interference occurs:
1: The main path for interference signals to interfere with MCU is through the I/O port, which affects the data collection of MCU and other internal storage.
Solution: Discuss later.
2: Power supply interference: Although MCU is used to a wider voltage (3-5.5V), it is very sensitive to power supply fluctuations. For example, MCU can work safely at 3V voltage, but cannot work safely when the voltage fluctuates between 3V-5.5V.
Solution: Use a power supply voltage regulator to filter the power supply. Note: Be sure to bypass the power supply and add a 0.1UF ceramic capacitor to filter out high-frequency interference, because electrolytic capacitors are ineffective for high-frequency interference exceeding tens of KHZ.
3: Power on and off interference: But every MCU system has to go through such a process when it is powered on, so be especially careful.
Although the MCU can work safely at a voltage of 3V, it does not mean that it cannot work at a voltage below 3V. Of course, the MCU is extremely unstable at such a low voltage. When the system is powered on, the system power supply voltage is gradually increased from 0V to the rated voltage. For example, when the voltage reaches 2V, the MCU starts to work, but this is extremely unstable and it is very easy to run away.
Solution : 1 Let the MCU start working after the power is stable. The PIC integrates POR (internal power-on delay reset) in the chip. This function must be turned on in the configuration bit.
Surface power-on delay reset circuit. There are many forms. The low-cost one is to connect a resistor-capacitor circuit to the reset pin. The high-cost one is to use a dedicated chip. There are a lot of materials in this regard, and they can be found everywhere.
The most difficult to eliminate is the first type of interference mentioned above, and the interference signal can occur at any time, and the intensity of the interference signal is not the same.
But they also have similarities: the interference signal also obeys Ohm's law, and the coupling path of the interference signal is nothing more than electromagnetic interference, one is electric sparks, and the other is magnetic fields.
Among them, the most severe interference is electric spark interference, followed by magnetic field interference. The occasions where electric spark interference occurs are mainly near high-power switches, relays, contactors, brushed motors, etc. The occasions where magnetic field interference occurs are mainly near high-power AC motors, transformers, etc.
Treatment measures: The first point: It is also the most classic, that is, to work hard on the PCB routing and component position arrangement. There is a lot of knowledge in this, and it can't be finished in a few days^^.
Second: Summarize the input impedance of each I/O port, acquisition rate and other factors to design the peripheral circuit of the I/O port.
Generally, there are three situations to determine the input impedance of an I/O port:
A: The I/O port has a pull-up resistor, and the pull-up resistor value is the input impedance of the I/O port.
Generally, everyone uses a 4K-20K resistor for pull-up (the internal pull-up resistor of the B port of the PIC is about 20K).
Since the interference signal also obeys Ohm's law, the smaller the pull-up resistor should be when there is more interference, because the voltage generated by the interference signal on the resistor is smaller.
Since the smaller the pull-up resistor, the more power it consumes, in home designs, the pull-up resistor is generally 10-20K, and in strong interference situations, the pull-up resistor can even be as low as 1K.
(If you want to abandon the pull-up function of the B port in a strong interference situation, you must use a surface pull-up.)
B: The I/O port is connected to the output pin of other digital circuits. At this time, the input impedance of the I/O port is the impedance of the output port of the digital circuit, which is generally tens to hundreds of ohms.
It can be seen that using digital circuits as an intermediary can reduce impedance to the minimum. Many digital circuits can be seen on many industrial control boards, even to ensure performance and protect the MCU.
C: A small capacitor is connected in parallel to the I/O port.
Since the capacitor is connected to the DC and the interference signal is generated and extinguished, the capacitor can filter out the interference signal. But the disadvantage is that it causes the speed of the I/O port to collect signals to drop. For example, it is absolutely not advisable to connect capacitors to the serial port, because the capacitor will filter out the digital signal as an interference signal.
For some detection switches, reed switches, Hall elements, etc., capacitors can be connected in parallel, because the changes in these switch quantities cannot have a high speed, and connecting a small capacitor will not have any effect on the signal collection. It is easier to find fault with other people's work than to find your own faults.
Reference address:How to Improve the Anti-disturbance Function of MCU System
talk about how to avoid detours in your design:
Anti-interference is currently developed in two aspects, one is hardware design, and the other is software writing.
Here is a key reminder: In MCU design, the main anti-interference design is in hardware, supplemented by software. Because the computing power of MCU is limited, it is necessary to spend a lot of time on hardware.
Look at the way interference occurs:
1: The main path for interference signals to interfere with MCU is through the I/O port, which affects the data collection of MCU and other internal storage.
Solution: Discuss later.
2: Power supply interference: Although MCU is used to a wider voltage (3-5.5V), it is very sensitive to power supply fluctuations. For example, MCU can work safely at 3V voltage, but cannot work safely when the voltage fluctuates between 3V-5.5V.
Solution: Use a power supply voltage regulator to filter the power supply. Note: Be sure to bypass the power supply and add a 0.1UF ceramic capacitor to filter out high-frequency interference, because electrolytic capacitors are ineffective for high-frequency interference exceeding tens of KHZ.
3: Power on and off interference: But every MCU system has to go through such a process when it is powered on, so be especially careful.
Although the MCU can work safely at a voltage of 3V, it does not mean that it cannot work at a voltage below 3V. Of course, the MCU is extremely unstable at such a low voltage. When the system is powered on, the system power supply voltage is gradually increased from 0V to the rated voltage. For example, when the voltage reaches 2V, the MCU starts to work, but this is extremely unstable and it is very easy to run away.
Solution : 1 Let the MCU start working after the power is stable. The PIC integrates POR (internal power-on delay reset) in the chip. This function must be turned on in the configuration bit.
Surface power-on delay reset circuit. There are many forms. The low-cost one is to connect a resistor-capacitor circuit to the reset pin. The high-cost one is to use a dedicated chip. There are a lot of materials in this regard, and they can be found everywhere.
The most difficult to eliminate is the first type of interference mentioned above, and the interference signal can occur at any time, and the intensity of the interference signal is not the same.
But they also have similarities: the interference signal also obeys Ohm's law, and the coupling path of the interference signal is nothing more than electromagnetic interference, one is electric sparks, and the other is magnetic fields.
Among them, the most severe interference is electric spark interference, followed by magnetic field interference. The occasions where electric spark interference occurs are mainly near high-power switches, relays, contactors, brushed motors, etc. The occasions where magnetic field interference occurs are mainly near high-power AC motors, transformers, etc.
Treatment measures: The first point: It is also the most classic, that is, to work hard on the PCB routing and component position arrangement. There is a lot of knowledge in this, and it can't be finished in a few days^^.
Second: Summarize the input impedance of each I/O port, acquisition rate and other factors to design the peripheral circuit of the I/O port.
Generally, there are three situations to determine the input impedance of an I/O port:
A: The I/O port has a pull-up resistor, and the pull-up resistor value is the input impedance of the I/O port.
Generally, everyone uses a 4K-20K resistor for pull-up (the internal pull-up resistor of the B port of the PIC is about 20K).
Since the interference signal also obeys Ohm's law, the smaller the pull-up resistor should be when there is more interference, because the voltage generated by the interference signal on the resistor is smaller.
Since the smaller the pull-up resistor, the more power it consumes, in home designs, the pull-up resistor is generally 10-20K, and in strong interference situations, the pull-up resistor can even be as low as 1K.
(If you want to abandon the pull-up function of the B port in a strong interference situation, you must use a surface pull-up.)
B: The I/O port is connected to the output pin of other digital circuits. At this time, the input impedance of the I/O port is the impedance of the output port of the digital circuit, which is generally tens to hundreds of ohms.
It can be seen that using digital circuits as an intermediary can reduce impedance to the minimum. Many digital circuits can be seen on many industrial control boards, even to ensure performance and protect the MCU.
C: A small capacitor is connected in parallel to the I/O port.
Since the capacitor is connected to the DC and the interference signal is generated and extinguished, the capacitor can filter out the interference signal. But the disadvantage is that it causes the speed of the I/O port to collect signals to drop. For example, it is absolutely not advisable to connect capacitors to the serial port, because the capacitor will filter out the digital signal as an interference signal.
For some detection switches, reed switches, Hall elements, etc., capacitors can be connected in parallel, because the changes in these switch quantities cannot have a high speed, and connecting a small capacitor will not have any effect on the signal collection. It is easier to find fault with other people's work than to find your own faults.
Previous article:Flash reading and writing program for msp430F149 microcontroller
Next article:MSP430 Tutorial 14: MSP430 MCU ADC12 Module
- Popular Resources
- Popular amplifiers
Recommended Content
Latest Microcontroller Articles
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
MoreDaily News
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
Guess you like
- GD32E231 DIY Contest (5) - Complete the driver and settings of DS1302 and the recognition of long and short keys
- Share the troubleshooting of using bq34z100 chip
- The salary and development path of hardware engineers
- Here are some questions about the differential signal amplifier circuit
- How to Meet the Testing Challenges of Multi-Antenna Systems
- A beginner was trapped by the garbage code of the development board for a whole night
- SinlinxA33 development board Linux platform bus device driver
- MSP430 MCU application of timer, PWM, comparator
- I need help. I am using AD17 to learn how to draw a 4-layer board. Is there any good teaching guide?
- Also on the G-question of the electronic competition