Question about brownout setting

I've just read the reset section on the atmel ATMEGA328 document. I wonder what brownout voltage is set for ATMEGA328 by arduino software. I found several posts on the forum but was still unclear.

Can someone with experience on brownout tell me whether arduino software sets this setting and what voltage it is? Is it sufficient to prevent FLASH corruption? Thanks.

From boards.txt (came with the Arduino IDE; the following is from 0019)...

atmega328.bootloader.low_fuses=0xFF
atmega328.bootloader.high_fuses=0xDA
atmega328.bootloader.extended_fuses=0x05

Off to my favorite fuse calculator...
http://www.engbedded.com/fusecalc

Gives us a BOD level of 2.7V.

Is it sufficient to prevent FLASH corruption?

Can't say. Someone else will have to answer that question.

Thank you CodingBadly. The calculator is interesting, took a while to understand how to use it. So there is a setting for brownout voltage 4.3V. Maybe this is more strict but safer?

Maybe this is more strict but safer?

It depends...

I have a hand-held kitchen timer sort of device that runs directly from 2 AA batteries. I have the BOD disabled. Why? Because I don't care if the battaries can't provide enough energy for the device to run correctly. In the worst case, the thing makes strange noises instead of beeping, flashes an LED erratically, or doesn't keep time. In this case, BOD disabled is perfectly safe1.

For an Arduino controlling a very large engine that compresses natural gas for transportation down a pipeline a disabled BOD is certainly NOT safe.

Basically, the processor is guaranteed to function correctly at a certain voltage and clock speed. The BOD should be set based on the clock speed and the circumstances. In other words, only you can decide what's "safer".

1 In the sense that no one will be injured. The same can't be said for what's cooking!

What is BOD all about?
When power fails,or the power is just switched off regularly, this is not a spontanious event. Depending on the caps it can take seconds during which the voltage slowly drops down.

Different functional devices inside the processor will stop their working at different voltage levels; so it will give some confusion for the program, as instructions will no longer work as expected. The best way is to keep the processor in a reset state as soon as the supply voltage drops below a "safe" margin. If you run @ 20MHz, 4.3 Volts is a safer value....

BOD is a very important feature. In older professional designs there was always an external BOD chip for this purpose (otherwise they would not have been considered "professional"" :slight_smile: )

Thanks guys! FLASH corruption is what I want to aviod. Any suggestions on which voltage I should use, 2.7V or 4.3V? I'm running 328 at 16MHz. Since instructions could be entirely retrived wrong if FLASH is under powered, some instruction may BECOME say WRITE FLASH XXX, which was supposed to be totally different instructions under proper voltage. This will corrupt FLASH. It may not happen very often, only when battery is low, but is still problematic.

2.7V or 4.3V? I'm running 328 at 16MHz

From "Figure 28-1. Maximum Frequency vs. VCC" in the '328 datasheet 10 MHz is the highest frequency for 2.7V. 4.3V is the one you want.

Thanks so much CodingBadly! I think you're right. BTW, atmel really screwed up that figure, no tick marks? How do I easily read it? I guess I'll have to load it into a program and figure out the sloped line or solve with 4MHZ, 1.8V, and 10MHZ, 2.7V. (Will 20MHZ, 4.5V be on this line? Guess not ;D)

I guess It's probably 3.6V for 16MHz (0.15V/MHz). I'll make the change on my arduino IDE with your favorate calculator.