Changing BOD on Pro Mini

Hello,

I've scoured for a clear explanation of how to change the brown-out detection from the set 2.7v to the higher 4.3v but after much head banging, I'm turning to asking the question.

The root issue is I'm seeing instability of saved info to eeprom and much research leads me to believe it's due to a period of low voltage, and that setting the BOD to 4.3v will help. This is an automotive application with much filtering and regulating before the Arduino.

My issue is; I can successfully burn a new bootloader with BOD of 4.3v, but then my program either does not load (I get a clock sync error), or it doesn't fully work (some like interrupts sections don't work).

Does there exist a step by step that explains how to get from A to B without leaving out steps like "now change the extended fuse value in the boards.txt file" (just an example, don't know if this is actually needed)?

Board is Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega328p. Can someone verify the fuse settings should be low_fuses=0xFF, high_fuses=0xDA, extended_fuses=0xFC to just set the BOD to 4.3v?

Thanks! I truly appreciate the help!

Looks like 0b11111100 or 0xFC to me for 4.3V typical with Vcc = 5V.
328P brownout fuses.jpg

Thanks CrossRoads, that confirms 0xFC for setting BOD to 4.3v.

Now, how to do this without upsetting other bits??

I have an Uno that I can use the programmer, but I’m missing the “how to” do this with the Arduino IDE. What seems straight forward in the explanations I’ve read must be obvious to the experienced, but to me (the inexperienced) I can’t get it to work. By that I mean I’m not clear on the steps to take. I keep running in to statements like “now you can program your board…”. Great, and I can fly a plane too, but after taking lessons and tests! :slight_smile:

Thanks again.

As far as I know, you can only set the Fuses with a Programmer connected to the ICSP pins. Change the fuses in boards.txt, then Burn Bootloader to change them. The other two bytes will just get reprogrammed with the same bytes again if you didn't change them.

There may be a way with avrdude commands, I've never tried that.

Easiest way is with a USBAsp - with that, you just connect up the isp lines (see countless instructions ) to the usbasp, and can set fuse bits with the "extreme burner avr" tool, which has a nice graphical interface.

Saves you having to figure out the avrdude syntax and the usbasp is more reliable in general.

Minicore, hansibull 'score for the 328/328p and it's smaller kin may also provide menu option for bod level when burning bootloader (its technically easy to implement the menu option in a third party hardware package)

You should check out MiniCore. This is the easiest way to change the BOD option on an ATmega328p :)

@hansibul, thank you! I think that gets me close, but I don't have a bare 328P - I have a ProMini. Assuming I can skip all the caps and such and connect my Uno as a programmer to the mini via the MISO, MOSI, Reset, +5, and GND pins?

And as a sequence, do you: 1. Program the bootloader (Uno) 2. Connect the bootloader to the mini via the pinout supplied 3. Burn the bootloader to the mini 4. Disconnect everything and load my code to the mini

Thanks!

Just call your pro mini a bare 328p. All a pro mini is is a bare 328p and basic supporting components

I understand, but can skip all the caps and such and connect my Uno as a programmer to the mini via the MISO, MOSI, Reset, +5, and GND pins? Or do I need to add the caps and such?

  1. Upload the ArduinoISP sketch on your Arduino UNO.
  2. Hook up your pro mini like shown in the diagram below
  3. Select "Arduino as ISP" in the Programmers menu
  4. Select "ATmega328p", "16 MHz", and your BOD setting
  5. hit "Burn bootloader" :) |443x500

You rock! Thanks so much.

Of course, I'll need to set the BOD bit in the boards.txt file first correct?

Yep, that’s correct. When you hit “burn booloader”, you actually set the fuse bits first, then uploading the bootloader, changing the clock frequency and BOD setting without reburning the fuses/bootloader won’t have any effect

hansibull:

  1. Upload the ArduinoISP sketch on your Arduino UNO.
  2. Hook up your pro mini like shown in the diagram below
  3. Select “ArduinoISP” in the Programmers menu
  4. Select “ATmega328p”, “16 MHz”, and your BOD setting
  5. hit “Burn bootloader”
    :slight_smile:

Thought I had it… after following the above (changed the BOD setting in the boards.txt for my board) and received this error:
avrdude: Error: Could not find USBtiny device (0x2341/0x49)
Error while burning bootloader.

Strange because I’m not using or targeting a USBtiny device…

Any thoughts?

Choose for the programmer Arduino as ISP, not ArduinoISP

Thanks to all of you for the help so far.

I'm still getting errors: the latest, after selecting the programmer "Arduino as ISP", is this Arduino: 1.6.5 (Windows 8.1), Board: "Arduino Pro or Pro Mini, ATmega328 (5V, 16 MHz)"

avrdude: Yikes! Invalid device signature.

Double check connections and try again, or use -F to override

this check.

Wait! I'm happy to report success!

I went with hansibull's Minicore and wow, what a difference! I was able to burn the bootloader and upload my code holding shift-upload.

Is there a way to read the settings back to make sure the bod is 4.3v? And is there a way to read the code I wrote back to make sure it's all there?

Thanks again all!!

You can use avrdude to read out the fuses. I'll strongly recommend Engbedded's AVR fuse calc rather than struggling with the datasheets, like CrossRoads wants you to do. Simply select your microcontroller, and insert your fuses at the bottom. The corresponding settings will appear :) If you have a look at the output from avrdude (after you've burnt the bootloader), it's actually telling you the new fuse settings (high, low and extended fuses).

binduni: is there a way to read the code I wrote back to make sure it's all there?

If you have File > Preferences > Verify code after upload checked then AVRDUDE will automatically do this for you on every upload.

WestfW has a nice sketch called fusebytes that reads the fuses and displays lots of info via the Serial Monitor. https://github.com/WestfW/fusebytes That will verify it for you.

You can also go into IDE preferences and check show verbose output during upload. Then when you burn the bootloader you will see the avrdude command lines used to burn the bootloader and set the fuses. Just look at what extended fuse byte is being written.

When you upload code using a programmer, such as with Shift-Upload, it overwrites the bootloader. So you will always have to upload your code using a programmer until the next time you burn the bootloader. If you have a bootloader installed, you can do a regular serial upload such as with an FTDI adapter.

I want to thank everyone for their help - I couldn't have do it (in this lifetime) without you!

I verified the bod is set to 4.3v, I was able to load my code and verified it worked as it should. Now off to test if all this effort was worth it! Hoping this stops the corrupting of the eeprom settings...

Thanks again!

Brian