As a formal system or product, after the basic system functions are debugged, once the field test phase is carried out, please remember to immediately rewrite the fuse configuration and enable the AVR power supply detection (BOD) function.
For 5V system, set the BOD level to 4.0V; for 3V system, set the BOD level to 2.7V. Then enable BOD detection.
In this way, once the power supply voltage of the AVR is lower than the BOD level, the AVR enters RESET (no longer executes the program). When the power supply returns to above the BOD level, the AVR officially starts to execute the program from the beginning. This ensures the reliability of the system!
The reasons are analyzed as follows:
AVR is a chip that works with a wide voltage. When the voltage drops to 2.5V, the system program can still work. There are two terrible phenomena that may occur:
1. The peripheral chip is working in a mess, and what the AVR reads is incorrect, causing a logical error in the execution of the program (not caused by the AVR itself).
2. When the power supply is as low as the critical point, such as 2.4V, and the voltage is up and down, the AVR program execution is not normal, and errors may occur when fetching instructions and reading data, or the program may be flying around and unstable (the reason is AVR itself, and any single-chip microcomputer is like this), which can easily cause damage to EEPROM and FALSH. Some people ask why 51 will not work? In fact, 51 is also like this, but there is no direct instruction to write EEPROM and FLASH inside 51, so its program will fly around and leave no trace. Some people also have questions: Why won’t the external EEPROM be rewritten when the power is off? In fact, the external EEPROM will not work when the voltage is lower than 4V (2.7V), and the program cannot change the content. The internal things of AVR can work at the critical voltage, but they are very unstable.
The BOD function of AVR must be used. When I used 51 in the early days, all external products required a power monitoring chip. Now AVR itself has this function, so it must be used.
Here are some AVR hunters’ experiences:
I am working on a control system. The power supply provided to me by the on-site environment is DC 24V. My system needs two voltages, one is DC 12V 3A, and the other is DC 5V 200mA. The 12V voltage regulator uses the 1501A12 switching voltage regulator IC (this chip can withstand a maximum current of 5A. If you want to reach such a large current, the matching inductor is very important. You must use a blue-green magnetic ring, 0.85mm enameled wire winding, and 22uH inductance). The 5V power supply uses 7805 to stabilize the 12V power supply. The microcontroller used is ATMEGA48, and the experiment is done by welding with a perforated board. The fuse of the chip only changes the oscillation source to an external crystal oscillator and turns off the 8-frequency division function, and does not turn on BOD.
Because the 12V voltage system needs to drive a DC motor, which is driven and controlled by a 12V relay. When the motor is working, the load driven by the motor may be blocked by external force and cause the motor to stop and overload. At this time, the motor's stall current may reach about 3A. Therefore, I have made hardware protection and used AVR's ADC to detect the working current of the motor. If an overload occurs, the motor will stop working immediately.
This hand-soldered control board worked fine during testing, including the motor overload test, and there were no failures.
After all the tests passed, the board was made and the BOD of AVR was turned on while burning the program, and it was set to 4.3V. Then I started to do some overload tests, and found that the MCU would reset immediately when overloaded. I was so depressed. I thought I had changed some program again, which caused instability, or the delay time after starting the motor was not enough (as everyone knows: when driving a high-power load, when connecting the relay, the MCU's command control must be delayed by tens of milliseconds to hundreds of milliseconds, otherwise the relay will be disconnected immediately after being attracted. The detailed reasons are beyond the scope of this article, so I won't go into details. The books have detailed descriptions of these uses). It was really frustrating. I thought AVR was not that fragile. Or was my board design unreasonable? There is no reason for this. The previous board was welded with a perforated board, and it would not reset no matter how I tested it. I tried to increase the delay time of the output control, but the result was the same. It would reset when overloaded.
The software has been changed~No~~~Writing the previous software~No
I changed back to the previous perforated board and tested it. It was OK. No problem.
Calm down and think carefully, the difference between the two boards is the same hardware, software, and chip. Wait... It seems... Right! The new boards are all enabled with BOD. I immediately turned off BOD, and sure enough, the system did not reset again. The problem is solved, but there must be a reason, I can't just leave BOD unused~~~ I carefully observed some states of the circuit board when the motor is overloaded, and found that the 12V LED power indicator would dim for a moment when the motor is overloaded. Wow~! Fiery eyes~! Wearing glasses really makes a difference! ^_^ Haha, I know what the problem is. It should be that when the motor is overloaded, the 12V voltage drops, and then the 5V voltage after the 7805 voltage regulator also drops. Although this voltage drop is only a moment, it may drop below 4.3V, but this moment is immediately detected by BOD, and BOD forces the MCU to reset. This instantaneous drop cannot be detected by a multimeter, especially a digital meter. If you have an oscilloscope, you can see the drop waveform. I only have two digital meters, so I can't capture this instantaneous waveform for everyone to see. (Sometimes a digital meter is not as good as a pointer meter. A pointer meter may show some transient changes more intuitively. If you have a pointer meter, you should be able to see some subtle voltage fluctuations.)
Solution: Mr. Ma has already explained the function of BOD, so it cannot be turned off. Just set it to 2.7V. You can think about it yourself if what I did makes sense^_^
I share my experience of using BOD to tell everyone: when using BOD, you can't just turn it on and leave it at that. You need to pay attention to some abnormal conditions that may occur during actual work. Only by setting a BOD voltage that is suitable for the system can your system work more reliably.
Previous article:Application of AVR MCU ADC
Next article:AVR IO usage notes
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- MicroPython adds instructions for pyboard.py
- SD/MMC SPI mode command set
- DS90UB954 debugging problem help
- MLCC Noise Howling and Countermeasures
- The concepts of short circuit protection, overload protection and zero voltage protection
- Design of brushless DC motor driver based on hardware FOC TMC4671
- [ART-Pi Review] VI: Review of ATT-Pi's onboard Flash file system and FTP functions in RTT Studio environment
- Use transistor + MOS tube to control battery output
- Contemporary IoT smart antenna design trends | Review TE's exciting live broadcast, write a comment and win a gift!
- VLSI Digital Signal Processing Systems: Design and Implementation