Optiboot on Arduino Pro Mini

A bit too much opti, not enough boot

The newer Arduino boards such as the Uno include a new bootloader that takes up about 1/4 of the size of the old one. That means some extra memory can be freed up for applications. The new bootloader is known as Optiboot, and the site says "Compatible with 168 and 328 Arduinos including Lilypad, Pro, Nano". Unfortunately, in the case of the Pro Mini, that's not true, but it can be made to work.

  1. At the time of writing, the current v3 release tarball doesn't include some important bugfixes such as this one. My advice is to pull the latest version from the repository and build it yourself.
  2. With the standard makefile flags Optiboot may not build, depending on which version of the compiler you are using. The fix is to add -nostdlib to LDFLAGS as detailed in this bug.
  3. Optiboot uses different upload baud speeds from the old bootloader, apparently to shave a few seconds off uploads. Unfortunately that has caused sketch upload issues such as this, and in the specific case of the Pro Mini, this. The common factor is that the Optiboot baud rate is too high to be reliable. I suspect that several of the other "Sketch won't upload" reports are caused by the same thing. Also, changing the baud rate means that it's not only necessary to fiddle with the boards.txt file to make the Arduino environment use the new baud rates, it's also necessary that you know exactly what bootloader is on a board. My recommendation is to edit the Makefile and change the -DBAUD_RATE=XXXXX values to those in the original boards.txt file.

Update

I've tried five different Pro Minis, setting the baud rate to 57600 instead of 115200 and whilst four of them upload fine with Optiboot, one of them doesn't. I can get it to work by manually resetting the board, and it works fine with the standard Arduino bootloader. Clearly there's some sort of timing issue related to resets, I'll have to tinker some more.

Categories : Tech, AVR


Re: Optiboot on Arduino Pro Mini

Timing is marginal, even at 57600 baud, and the APM typically has a ceramic resonator rather than a crystal (less accurate).

Some people have had better luck running at 76800 baud, which the ATMega can more accurately approximate with an 8 MHz clock.

See: http://yveaux.blogspot.com/2014/07/changing-arduino-bootloader-to-optiboot.html for instructions.

Note that if you need to recompile Optiboot, you may need to use a 1.0.x Arduino IDE (not 1.6) because some of the tools used for optiboot compilation (eg: make) are not longer included in the 1.6 distribution.