Arduino Forum

Using Arduino => Microcontrollers => Topic started by: fanofard on Feb 14, 2016, 01:17 pm

Title: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: fanofard on Feb 14, 2016, 01:17 pm
Hi,
I have recent version of Optiboot. How should I proceed for having working Optiboot bootloader in Arduino Pro Mini with 8MHz crystal? I am able to burn the bootloader, but then I am failing on uploading of the sketch.

I have following entry in boards.txt:

Code: [Select]
##############################################################
## Optiboot on 32pin (SMT) CPUs (Nano, Pro Micro, etc.)
##############################################################

optiboot32.name=Optiboot on 32-pin cpus

optiboot32.upload.tool=arduino:avrdude
optiboot32.upload.protocol=arduino
optiboot32.upload.speed=115200

optiboot32.bootloader.tool=arduino:avrdude
optiboot32.bootloader.low_fuses=0xF7
optiboot32.bootloader.unlock_bits=0x2F
optiboot32.bootloader.lock_bits=0x0F
optiboot32.build.f_cpu=16000000L

#
# Other Clock speeds.
#  For 8MHz using the internal RC Oscillator, we adjust fuses, use the same
#  bootloader binary, and halve the upload rate.
#
optiboot32.menu.mhz.16MHz=16MHz
optiboot32.menu.mhz.16MHz.upload.speed=115200
optiboot32.menu.mhz.16MHz.upload.speed=57600
optiboot32.menu.mhz.8MHzC=8MHz (crystal)
optiboot32.menu.mhz.8MHzC.build.f_cpu=8000000L
optiboot32.menu.mhz.8MHzC.upload.speed=57600
optiboot32.menu.mhz.8MHz=8MHz (int)
optiboot32.menu.mhz.8MHz.build.f_cpu=8000000L
optiboot32.menu.mhz.8MHz.bootloader.low_fuses=0xE2
optiboot32.menu.mhz.8MHz.upload.speed=57600
optiboot32.menu.mhz.1MHz=1MHz (int)
optiboot32.menu.mhz.1MHz.build.f_cpu=1000000L
optiboot32.menu.mhz.1MHz.bootloader.low_fuses=0x62
optiboot32.menu.mhz.1MHz.upload.speed=9600

# optiboot platforms should be UNO-like more than anything else.
optiboot32.build.board=AVR_UNO
optiboot32.build.core=arduino:arduino
optiboot32.build.variant=arduino:eightanaloginputs


## Optiboot for ATmega328p
## ---------------------------------------------
optiboot32.menu.cpu.atmega328p=ATmega328p
optiboot32.menu.cpu.atmega328p.upload.maximum_size=32256
optiboot32.menu.cpu.atmega328p.upload.maximum_data_size=2048

optiboot32.menu.cpu.atmega328p.bootloader.high_fuses=0xDE
optiboot32.menu.cpu.atmega328p.bootloader.extended_fuses=0x05
optiboot32.menu.cpu.atmega328p.bootloader.file=optiboot/optiboot_atmega328.hex

optiboot32.menu.cpu.atmega328p.build.mcu=atmega328p


I choose "Optiboot on 32-pin cpus" as the board, "8MHz (crystal)" as the CPU Speed and using Arduino UNO with ArduinoISP sketch loaded, I burn the bootloader successfully (see the log in an attached file).

So this is fine. But the problem comes up when I want to upload the sketch via ftdi cable (the log is attached).

I read several threads where they suggested to upload the 16MHz version of the bootloader and then using half baud rate (57600) when uploading. I do not know why this does not work for me. I think optiboot_atmega328.hex is a 16MHz optiboot bootloader and as you can see, I use 57600 baud rate when uploading:

Code: [Select]
Using Port                    : /dev/ttyUSB0
Using Programmer              : arduino
Overriding Baud Rate          : 57600


Can anybody "aim" me to working procedure?
What is interesting - when I use the standard bootloader "Pro or Pro Mini - ATmega328 (3.3V, 8 MHz) - atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex" in 1.6.7 IDE, everything works.
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: dmjlambert on Feb 14, 2016, 03:46 pm
What are you using for a USB-to-serial adapter?
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: fanofard on Feb 14, 2016, 04:19 pm
I use FTDI usb to serial converter (the same as on the attached image).
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: dmjlambert on Feb 14, 2016, 06:24 pm
Well, I had a close read of your post, and it has me stumped.   I am a little concerned about the way the boards.txt entries are arranged, but I guess it's a matter of style and I would have done it a little different.   This one place concerns me but it should not really affect your situation
Code: [Select]
optiboot32.menu.mhz.16MHz.upload.speed=115200
optiboot32.menu.mhz.16MHz.upload.speed=57600


Anyway it seems to me you are doing things right.   

I would suggest you choose "Optiboot on 32-pin cpus" as the board, "8MHz (crystal)" as the CPU Speed and upload the blink sketch using Upload Using Programmer.   Then observe the LED to make sure it is one second on and one second off.  That would make sure the crystal is really 8MHz.   Then re-burn the bootloader.    I am trying to imagine circumstances in which your process could fail and I just don't know.   
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: dmjlambert on Feb 14, 2016, 06:29 pm
You know just for kicks, you might try doing this with IDE version 1.6.5 and see what you get.  Also, make sure you have show verbose output during compilation and during upload checked in the IDE preferences.   Perhaps something would catch your eye in the output it gives you. 
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: DrAzzy on Feb 14, 2016, 06:42 pm
The final error:


avrdude: stk500_recv(): programmer is not responding


suggests that it wasn't able to get far enough to get a sync error, and you'll get a sync error without even connecting an atmega chip....

Does that serial adapter work for you? Do loopback test on it, and if it doesn't work, fiddle with drivers until it does.
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: fanofard on Feb 14, 2016, 07:13 pm
I tried once again now - I chose "Pro or Pro Mini - ATmega328 (3.3V, 8 MHz)", so non-optiboot bootloader and flashed it into the Pro Mini. Afterwards I connected the pro mini to the ftdi cable and tried to upload a sketch --> it worked properly.

Then I flashed the optiboot image as described in my 1st post, connected to ftdi and the same issue - I am not able to upload a sketch to the pro mini. So at least my FTDI cable works.

Currently I have no other pro mini with 8MHz crystal, so I can't test with another piece. But I do have an atmega328p DIP 28pin and I will try with that one on the breadboard with 8MHz crystal - just to check whether there is a general problem or a problem related to the currently tested pro mini.
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: fanofard on Feb 14, 2016, 08:03 pm
The breadboard setup resulted into the same issue.
I found this post - http://forum.arduino.cc/index.php?topic=134508.0
and this port - http://forum.arduino.cc/index.php/topic,101064.msg760450.html#msg760450
There is optiboot_atmega328_pro_8MHz.hex which user claims is compiled with 8MHz setting.
Believe or not, but once flashed into the Pro Mini, I am able to upload the sketch into it.

This is the boards entry for the mentioned hex file I used:

Code: [Select]
pro328.name=Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328

pro328.upload.tool=arduino:avrdude
pro328.upload.protocol=arduino
pro328.upload.maximum_size=32256
pro328.upload.speed=57600
pro328.bootloader.tool=arduino:avrdude

pro328.bootloader.low_fuses=0xFF
pro328.bootloader.high_fuses=0xDE
pro328.bootloader.extended_fuses=0x05
#pro328.bootloader.path=optiboot
pro328.bootloader.file=optiboot/optiboot_atmega328_pro_8MHz.hex
#pro328.bootloader.path=atmega
#pro328.bootloader.file=optiboot/ATmegaBOOT_168_atmega328_pro_8MHz.hex
pro328.bootloader.unlock_bits=0x3F
pro328.bootloader.lock_bits=0x0F

pro328.build.mcu=atmega328p
pro328.build.f_cpu=8000000L
pro328.build.core=arduino
pro328.build.board=AVR_UNO
pro328.build.variant=standard


This is the difference between "original" optiboot hex file and the one I downloaded from the post above:

Code: [Select]
diff optiboot_atmega328_pro_8MHz.hex optiboot_atmega328.hex
4c4
< :107E300028E13EEF91E0309385002093840096BBCB
---
> :107E300020E33CEF91E0309385002093840096BBD3
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: fanofard on Feb 14, 2016, 08:14 pm
Interesting is the current optiboot package from https://github.com/Optiboot/optiboot includes the file with the same name, but the file is different size and when I replace the "downloaded from http://forum.arduino.cc/index.php/topic,101064.msg760450.html#msg760450" hex file with the one which is included in the official optiboot package, it does not work - I can burn this bootloader, but using the same entry in boards.txt, the upload of a sketch fails.

I am wondering what is the optiboot_atmega328_pro_8MHz.hex in the official optiboot github repository for or how it should be flashed to have it working properly with Pro Mini 8MHz (crystal).
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: dmjlambert on Feb 14, 2016, 08:34 pm
 That is interesting, it seems you have found a mystery. I'm glad you got it going somewhat.
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: fanofard on Feb 15, 2016, 12:21 am
I believe this is not a mystery and it has an explanation. I would be very interested in the explanation of the issue and I would like to know what should be the official procedure for putting optiboot into an 8MHz crystal version of the pro mini.
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: dmjlambert on Feb 15, 2016, 12:40 am
It's up to you to explain it to us!  :-)  We're counting on you.   There isn't an official procedure because officially the Pro Mini comes with the ATmegaBOOT bootloader.   The semi-official way on the forum is to use Nick Gammon's Board Programmer sketch and use it to load the UNO 16MHz bootloader onto it.   Then when your Pro Mini runs that bootloader at 8MHz it will result in the baud rate half speed, 57600.  

http://www.gammon.com.au/bootloader (http://www.gammon.com.au/bootloader)

Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: dmjlambert on Feb 15, 2016, 12:51 am
Also WestfW has a sketch that he recently updated, called OptiLoader:

https://github.com/WestfW/OptiLoader (https://github.com/WestfW/OptiLoader)
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: westfw on Feb 15, 2016, 01:58 am
Tagging to look at when I get home.
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: fanofard on Feb 15, 2016, 07:59 am
OK, so I needed a bit of sleep to get it working :)
I took the current version (6.2) of the optiboot from theit repository. Then I modified Makefile and changed:
Code: [Select]
ifdef BAUD_RATE
BAUD_RATE_CMD = -DBAUD_RATE=$(BAUD_RATE)
dummy = FORCE
else
BAUD_RATE_CMD = -DBAUD_RATE=115200
endif


to
Code: [Select]
ifdef BAUD_RATE
BAUD_RATE_CMD = -DBAUD_RATE=$(BAUD_RATE)
dummy = FORCE
else
BAUD_RATE_CMD = -DBAUD_RATE=57600
endif


Then executed (ubuntu 15.04):
sudo apt-get install gcc-avr
sudo apt-get install avr-libc
make clean
make atmega328_pro8

And it compiled new bootloader optiboot_atmega328_pro_8MHz.hex

Interesting is there was this warining about BAUD_RATE error greater than 2%:

Code: [Select]
make atmega328_pro8
make atmega328 AVR_FREQ=8000000L LED_START_FLASHES=3
make[1]: Entering directory '/tmp/optiboot-master/optiboot/bootloaders/optiboot'
avr-gcc (GCC) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

BAUD RATE CHECK: Desired: 57600, Real: 58823, UBRRL = 16, Error=2.1%
avr-gcc -g -Wall -Os -fno-split-wide-types -mrelax -mmcu=atmega328p -DF_CPU=8000000L  -DBAUD_RATE=57600 -DLED_START_FLASHES=3        -c -o optiboot.o optiboot.c
optiboot.c:305:6: warning: #warning BAUD_RATE error greater than 2% [-Wcpp]
     #warning BAUD_RATE error greater than 2%
      ^
avr-gcc -g -Wall -Os -fno-split-wide-types -mrelax -mmcu=atmega328p -DF_CPU=8000000L  -DBAUD_RATE=57600 -DLED_START_FLASHES=3      -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe -Wl,--relax -nostartfiles -nostdlib -o optiboot_atmega328.elf optiboot.o -lc
avr-size optiboot_atmega328.elf
   text    data     bss     dec     hex filename
    464       0       0     464     1d0 optiboot_atmega328.elf
avr-objcopy -j .text -j .data -j .version --set-section-flags .version=alloc,load -O ihex optiboot_atmega328.elf optiboot_atmega328.hex
avr-objdump -h -S optiboot_atmega328.elf > optiboot_atmega328.lst
rm optiboot.o optiboot_atmega328.elf
make[1]: Leaving directory '/tmp/optiboot-master/optiboot/bootloaders/optiboot'
mv optiboot_atmega328.hex optiboot_atmega328_pro_8MHz.hex
mv optiboot_atmega328.lst optiboot_atmega328_pro_8MHz.lst


I am not an expert in this area (as you already most likely noticed  :D ) and I do not know based on what is the error rate calculeted and how does it affects things.
Nevermind - I took the built hex file, renamed it to optiboot_atmega328_pro_8MHz_56k.hex (to prevent confusion) and burned it to the pro mini 8MHz using this boards.txt entry:

Code: [Select]
pro328.name=[Optiboot 6.2] Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328 for 56K
pro328.upload.protocol=arduino
pro328.upload.maximum_size=32256
pro328.upload.speed=57600
pro328.bootloader.low_fuses=0xFF
pro328.bootloader.high_fuses=0xDE
pro328.bootloader.extended_fuses=0x05
#pro328.bootloader.path=optiboot
pro328.bootloader.file=optiboot/optiboot_atmega328_pro_8MHz_56k.hex
pro328.bootloader.unlock_bits=0x3F
pro328.bootloader.lock_bits=0x0F
pro328.build.mcu=atmega328p
pro328.build.f_cpu=8000000L
pro328.build.core=arduino:arduino
pro328.build.variant=arduino:standard


Now guess what? :) FINALLY I got it working!!!
So it looks the optiboot_atmega328_pro_8MHz.hex which is originally included in optiboot repository is built with 115200 baud rate and 8MHz, so you can't use it for the pro mini 8mhz (I tried this before and it did not work). And the trick was to build an optiboot bootloader atmega328_pro8 with 57600 baud rate. And the building is quite east - just editing 1 line in Makefile and 2 commands as mentioned above.
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: fanofard on Feb 15, 2016, 08:25 am
But anyway - I still do not know why the 115200 baud / 16MHz optiboot bootloader does not work with the pro mini using 57600 baud when uploading sketch. But I will have to stop thinking about this because I wasted a lot of time yesterday with that unsuccessful experiments.
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: parthk on May 12, 2016, 09:24 pm
I did try the same thing but didnt work for me. Bootloader uploaded successfully but cant upload program. But its working correctly with pro mini 8mhz bootloader.
Getting following errors. I am using ft232rl for programming and Arduino as ISP for burning bootloader.


Sketch uses 1,042 bytes (3%) of program storage space. Maximum is 32,256 bytes.
Global variables use 9 bytes of dynamic memory.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x5a
avrdude: stk500_recv(): programmer is not responding
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: SukkoPera on May 18, 2016, 01:16 am
Well, same problem here. I tried compiling my own Optiboot at 115200@8 MHz but I haven't been able to carry out a single upload with that.
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: parthk on May 18, 2016, 02:53 pm
SukkoPera.. Can you try to compile your optiboot with 57600 baud rate?
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: SukkoPera on May 18, 2016, 03:08 pm
I'll try ASAP. What is really strange is that the stock Optiboot works fine on a few standalone 328's I flashed it on, using the internal 8 MHz clock. But I can't get it to work on some Minis using an external oscillator.
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: fanofard on May 18, 2016, 03:52 pm
If anybody is interested, you can test the hex file I compiled with 56k baud rate / 8MHz. For me this bootloader works fine.

This is the entry in boards.txt I use for uploading sketches to the minis with the mentioned bootloader:
Code: [Select]
pro328.name=[Optiboot 6.2] Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328 for 56K
pro328.upload.protocol=arduino
pro328.upload.maximum_size=32256
pro328.upload.speed=57600
pro328.bootloader.low_fuses=0xFF
pro328.bootloader.high_fuses=0xDE
pro328.bootloader.extended_fuses=0x05
#pro328.bootloader.path=optiboot
pro328.bootloader.file=optiboot/optiboot_atmega328_pro_8MHz_56k.hex
pro328.bootloader.unlock_bits=0x3F
pro328.bootloader.lock_bits=0x0F
pro328.build.mcu=atmega328p
pro328.build.f_cpu=8000000L
pro328.build.core=arduino:arduino
pro328.build.variant=arduino:standard
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: SukkoPera on May 18, 2016, 11:59 pm
I can confirm that Optiboot at real 57600 bps works. Basically I built it with:
Code: [Select]
make atmega328 AVR_FREQ=8000000L LED_START_FLASHES=3 BAUD_RATE=57600

And the section in boards.txt is pretty much identical to what fanofard just posted.

Still I can't understand why the stock Optiboot worked on my bare 328 DIPs and didn't on my Minis...
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: acitta on Jan 10, 2017, 07:20 am
Hi sorry to dig this up again. I'm new to this level of arduino coding and this is the first time I've had to modify a make file. Can anyone give some basic steps on how to do that (on a mac if possible). I've messed around with the boards.txt file and tried using the hex file posted on this thread but with no success. What do I need to do to use this line

make atmega328 AVR_FREQ=8000000L LED_START_FLASHES=3 BAUD_RATE=57600

to get the required files so I can use optiboot on my mini 3.3v?
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: pert on Jan 10, 2017, 10:20 am
Easiest way is to just install MiniCore:
https://github.com/MCUdude/MiniCore (https://github.com/MCUdude/MiniCore)
It's very easy to install, well done, and has optiboot already compiled for your hardware configuration(and practically any other you could desire.

Of course then you will miss out on all the fun of learning makefiles and toolchains and compiling bootloaders from source.
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: acitta on Jan 11, 2017, 01:34 am
Where have you been all my life pert! That was too easy. Thank you kindly
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: acitta on Jan 13, 2017, 06:08 am
My mini is now having trouble communicating with my 3G module. It connects to my webserver fine but the response gets cut off. I had to set a larger buffer size in softwareserial.h to make this work before. Could the Minicore override that and have lowered my buffer size? If so how to I rectify that?
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: ron_sutherland on Jan 13, 2017, 08:51 am
pert is being sarcastic, regarding learning about the toolchain and bootloader. Personally, I've stopped using this IDE and now prefer a makefile. Anyway AVR mega has a maximum optimal buffer size of 32, it has to do with the indirect indexing instruction (I think, but forget the specific one and am not going to look it up). Therefore a better way is to send out some data (less than 32 bytes) to the serial buffer and wait for the serial buffer to empty, preferably while looping through your program and doing other useful stuff, until serial is available again.
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: pert on Jan 13, 2017, 09:17 am
I had to set a larger buffer size in softwareserial.h to make this work before. Could the Minicore override that and have lowered my buffer size?
No, I don't see how that would happen. MiniCore references the Arduino AVR Boards core so it will use the SoftwareSerial library included with that core. So MiniCore boards should work just the same with that library as Arduino AVR Boards. Remember that you need to redo your modifications to SoftwareSerial.h anytime you update to a new version of the Arduino IDE/Arduino AVR Boards.

pert is being sarcastic, regarding learning about the toolchain and bootloader.
Not true I was sincere in what I said. Learning how to use makefiles and set up the toolchain to compile a bootloader from source is certainly educational. It really depends on what your priorities are though. There are an infinite number of interesting and useful things to learn but if your goal is to complete a specific project in a finite period of time sometimes you have to set priorities on what you absolutely need to learn to accomplish that goal. The average beginner to intermediate Arduino user doesn't have any immediate need for that knowledge since hansibull has kindly done the work of compiling the bootloaders for them. When the time does come when knowing how to do that is desirable I hope people would jump right in and go for it, it's really not so hard as some make it out to be(though certainly not so easy as using the Arduino IDE). Bootloaders shouldn't be seen as a "black box". The source code is available for anyone to learn from and play around with if that's your thing.
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: SureshKumar2610 on Feb 14, 2017, 08:42 pm
Try this. this may help you.

https://www.youtube.com/watch?v=IG-dMHgXajE


https://www.youtube.com/watch?v=T6NB7yF58po
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: kokuam on Nov 15, 2018, 09:10 pm
Hello Everyone!
I tried precompiled Optiboot 8,0 on 8Mhz 328p, it can upload with 57600bps speed only.

Optiboot 6.x from MiniCore ( optiboot_flash_atmega328p_UART0_115200_8000000L.hex ) doesn't cope with 115200bps neither. Does anybody know if it's possible to get bootloader working on 8Mhz with 115200bps speed? Is there any fundamental obstacles?

Thank you!
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: pert on Nov 15, 2018, 10:38 pm
Does anybody know if it's possible to get bootloader working on 8Mhz with 115200bps speed? Is there any fundamental obstacles?
Are you using an external clock source or the internal oscillator?
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: westfw on Nov 16, 2018, 12:16 am
Quote
Does anybody know if it's possible to get bootloader working on 8Mhz with 115200bps speed? Is there any fundamental obstacles?
There is a fundamental obstacle.   The baud rate generator works by dividing the CPU click speed by an integer, yielding a clock that is supposed to be 8x or 16x the desired baud rate.  When the integers get small, the "step" between the bit rates that you can actually set gets large.  At 8MHz, you have a choice of 125kbps or 111111bps - both are pretty far off the actual rate; depending on whether the "other side" of the serial connection is off as well, and in which direction, the speed difference is enough that it can't work.
If your destination supports it, running at 125000bps might work a lot better.
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: tomgrey on Jun 25, 2020, 10:51 pm
Hi,
Hex file with required setting for fuse bits.
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: Helbino on Jun 26, 2020, 03:15 am
Edit: didn't realized that the thread was necro'd.

I JUST wrote a guide on this!

https://www.instructables.com/id/Standalone-Arduino-33V-W-External-8-MHz-Clock-Bein/

You'll want to go to step 3 for bootloader specifics.
Title: Re: Optiboot for 8MHz 3.3V Arduino Pro Mini
Post by: swilson8686 on Aug 29, 2020, 09:01 pm
The ONLY solution I have ever found to load optiboot on an Arduino Pro Mini running at 8MHz and 3.3V is to use the optiboot code provided on the previous page by fanofard titled =[Optiboot 6.2] Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328p for 56K

In addition to using that optiboot file I needed to modify the boards.txt file and insert the following code which differs slightly from fanofard's suggestion (I modified fuse settings and fixed a couple of missing lines):

pro328.upload.protocol=arduino
pro328.upload.maximum_size=32256
pro328.upload.speed=57600
pro328.bootloader.low_fuses=0xFF
pro328.bootloader.high_fuses=0xD6
pro328.bootloader.extended_fuses=0xFE
pro328.bootloader.path=optiboot
pro328.bootloader.file=optiboot/optiboot_atmega328_pro_8MHz_56k.hex
pro328.bootloader.unlock_bits=0x3F
pro328.bootloader.lock_bits=0x0F
pro328.build.mcu=atmega328p
pro328.build.f_cpu=8000000L
pro328.build.core=arduino:arduino
pro328.build.variant=arduino:standard
pro328.build.board=AVR_PRO328
pro328.bootloader.tool=avrdude

I successfully used the sketch ArduinoISP by Randall Bohn on an Arduino UNO to create an Arduino as ISP burner.

All of the other solutions including Nick Gammon's excellent code (which I use for other boards), MCUdude's MiniCore, and Helbino's solution above have all failed for this particular Arduino board. The problem with all of the proposed solutions is either the WatchDog Timer in Arduino will not reboot the Arduino, millis() function is way off in timing, or optiboot does not install.