#!/bin/blog

December 9, 2011

Optiboot on legacy Arduinos

Filed under: Hardware — Tags: — martin @ 9:55 pm

Here’s my approach for getting Optiboot from current Arduino 1.0 onto old boards.

I’m stepping forward with this despite my highly amateurish understanding of the Arduino system, so please cut me some slack on this one. Your corrections in the comment section are highly appreciated.

My only “true” Optiboot board, an Arduino Uno, is buried in my son’s room. What I do have are Arduino Duemilanoves and Pro Minis (ATmega 328, 16MHz, 5V), which are perfectly good for the exact same tasks as the Uno. I want them to be upgraded to Optiboot, because instant start-up makes a lot of sense in battery-powered applications. I also have an Atmel AVRISP mkII, which is the proper tool for programming the bootloader. Also at hand is an adapter board for the Pro Mini, to break out the proper pins for the ISP.


A Duemilanove during the bootloader upgrade.


A Pro Mini during the bootloader upgrade.

I first seek out boards.txt in the Arduino distribution and spot the sections that match my legacy boards:

atmega328.name=Arduino Duemilanove w/ ATmega328

atmega328.upload.protocol=arduino
atmega328.upload.maximum_size=30720
atmega328.upload.speed=57600

atmega328.bootloader.low_fuses=0xFF
atmega328.bootloader.high_fuses=0xDA
atmega328.bootloader.extended_fuses=0×05
atmega328.bootloader.path=atmega
atmega328.bootloader.file=ATmegaBOOT_168_atmega328.hex
atmega328.bootloader.unlock_bits=0x3F
atmega328.bootloader.lock_bits=0x0F

atmega328.build.mcu=atmega328p
atmega328.build.f_cpu=16000000L
atmega328.build.core=arduino
atmega328.build.variant=standard

##############################################################

pro5v328.name=Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega328

pro5v328.upload.protocol=arduino
pro5v328.upload.maximum_size=30720
pro5v328.upload.speed=57600

pro5v328.bootloader.low_fuses=0xFF
pro5v328.bootloader.high_fuses=0xDA
pro5v328.bootloader.extended_fuses=0×05
pro5v328.bootloader.path=atmega
pro5v328.bootloader.file=ATmegaBOOT_168_atmega328.hex
pro5v328.bootloader.unlock_bits=0x3F
pro5v328.bootloader.lock_bits=0x0F

pro5v328.build.mcu=atmega328p
pro5v328.build.f_cpu=16000000L
pro5v328.build.core=arduino
pro5v328.build.variant=standard

I copy these blocks and change the respective entries to match what’s already there for native Optiboot boards. Boards.txt lists the Arduino Ethernet, which is an Optiboot board and needs to be programmed using an FTDI breakout just like the Pro Mini. Hence, I assume that the serial chipset makes no difference for Optiboot settings.

Note how the board token at the beginning of the line has been extended with an “o” on the entire group of lines. Also note how I have not modified the maximum sketch size. I would expect that this can be pushed up towards the limit that is listed in the Arduino Uno’s section.

atmega328o.name=[Optiboot] Arduino Duemilanove w/ ATmega328

atmega328o.upload.protocol=arduino
atmega328o.upload.maximum_size=30720
atmega328o.upload.speed=115200

atmega328o.bootloader.low_fuses=0xFF
atmega328o.bootloader.high_fuses=0xDE
atmega328o.bootloader.extended_fuses=0×05
atmega328o.bootloader.path=optiboot
atmega328o.bootloader.file=optiboot_atmega328.hex
atmega328o.bootloader.unlock_bits=0x3F
atmega328o.bootloader.lock_bits=0x0F

atmega328o.build.mcu=atmega328p
atmega328o.build.f_cpu=16000000L
atmega328o.build.core=arduino
atmega328o.build.variant=standard

##############################################################

pro5v328o.name=[Optiboot] Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega328

pro5v328o.upload.protocol=arduino
pro5v328o.upload.maximum_size=30720
pro5v328o.upload.speed=115200

pro5v328o.bootloader.low_fuses=0xFF
pro5v328o.bootloader.high_fuses=0xDE
pro5v328o.bootloader.extended_fuses=0×05
pro5v328o.bootloader.path=optiboot
pro5v328o.bootloader.file=optiboot_atmega328.hex
pro5v328o.bootloader.unlock_bits=0x3F
pro5v328o.bootloader.lock_bits=0x0F

pro5v328o.build.mcu=atmega328p
pro5v328o.build.f_cpu=16000000L
pro5v328o.build.core=arduino
pro5v328o.build.variant=standard

I restart Arduino, select the respective board tagged [Optiboot] from the tools menu. I burn the bootloader and I’m done.

Successfully tested functionality after upgrading, on both boards:
- Basic example blink on Pin13: Works.
- Analog example fade on PWM 9: Works.

Have a lot of fun and let me know how things worked out for you.

About these ads

2 Comments »

  1. You are a diamond geezer. Thanks. I got an pre-programmed 328 with Optiboot but needed to run it on a Duemilanove. I was not aware that Optiboot is supported in 1.0. I am still using 022 and of course I was having problems. I cut and pasted your settings into boards.txt and voila! No more stk500_recv error.

    Comment by bill — January 15, 2012 @ 4:02 pm

  2. HI thanks for this –

    i *think* you can safely also change the max upload size — to match the UNO — the optiboot bootloader is smaller than the standard loader for duemilanove.

    change
    atmega328o.upload.maximum_size=30720
    to
    atmega328o.upload.maximum_size=32256

    Comment by hex705 — January 22, 2012 @ 7:29 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The Shocking Blue Green Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: