The good old days were exactly that: Good.  These days, there is a vast number of problems to deal with that our predesscors did not even dream of worrying about. I’m not talking about all that climate change stuff, but the technology issues: Which phone to buy next, should I follow such-and-such on Facebook and (the one I am about to tackle) Arduino bootloaders defaulting to 57600 baud.

Whilst running at 57600 baud makes perfect sense when you are operating with a crystal oscillator, not all applications necessarily require this.  Sometimes, less is indeed more. The inaccuracy in the on board oscillator makes it difficult to operate at the higher baud rates.

There are a number of tutorials on the ‘tubes about configuring the ATMega328P chip (the Arduino chip)  to work with the internal 8MHz oscillator.   I’m not really trying to be user friendly with this post like most of the other authors aimed.  This is more of a “this is what worked for me” information dump, that may make this process faster for some other person.  The main changes that are required are:

  1. Change the Bootloader
  2. Change the Make File
  3. Recompile the Bootloader
  4. Program the Bootloader
  5. Modify the Arduino boards.txt to reflect this new configuration.

First and foremost – don’t do this unless you already know how to do this.  You could break stuff. I am not responsible for that stuff or anything else you may break by following this incorrect not-instructions. You have been warned.

Change the Bootloader

I am using the hardware\arduino\bootloaders\atmega\ATmegaBOOT_168.c as the basis for these modifications. Your experience and choice may vary, but this works for me!

The main change that needs to occur here is fixing the EEWE problem that can stop you building the software.  See here for the bug and here for a great writeup on this process.

If you have a custom board with a custom blinky LED location – you can also change where the bootloader blinks in this file.  Check around Line 131.

Other then that – follow the links and you should be good.  The baud rate here does NOT need changing (Line 97)

Change the Make File

Copy and paste from a known good working one – I chose the atmega328_pro8 configuration.  Change the baud rate setting to something slow, I am using 9600 which seems reliable. Done. Easy eh?

It should look something like this:

Recompile the Bootloader

I am not going to repeat this here, check that above mentioned link to here.

The gist is – make sure that all works with a known make configuration.

To compile the above modification is:

Following this, you should have the relevant hex file appear.

Program the Bootloader

Pick your favourite programmer, grab the above generated hex file and program away! If you have a blinky LED, it should be blinky after programming.

Modify the Arduino boards.txt to reflect this new configuration.

Again, copy the pro8 (or whatever you used as the starting point) configuration from hardware\arduino\boards.txt and paste into your user directory boards.txt.

Rename the configuration and then tweak the baud rate to the same number used in the make file and restart the Arduino software.  This new configuration should now appear.  The relevant lines that I added to my boards.txt file are:

Fuse Settings

A final note on fuse settings. The ones I am using with the above configuration are:
Extended: 0xFD
High: 0xD8
Low: 0xE2

Anyway, hopefully this makes the process a bit faster for somebody else!

« »