About AVR BOD

Publisher:淡雅时光Latest update time:2013-05-11 Source: 21ICKeywords:AVR  BOD Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Keywords:AVR  BOD Reference address:About AVR BOD

Previous article:Application of AVR MCU ADC
Next article:AVR IO usage notes

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号