Arduino Bootloader

This page is mainly for my own reference, but it may be helpful to others.

When programming an Arduino Uno with the firmware for the APRS Micromodem or APRS Tracker, you may encounter errors when programming. Using the method on this page, you can overcome these errors.

This procedure is written for programming with a Windows machine.

You will need a working Arduino Uno to create an "Arduino as ISP" programmer. For reference, I found the following pages that led me to this solution.

You will need to solder a 6 pin header to the Arduino Nano ICSP.

Connect the following 6 wires to the ICSP header:

    • pin 1 on Nano ICSP to D12 on the Uno

    • pin 2 on Nano ICSP to 5V on the Uno

    • pin 3 on Nano ICSP to D13 on the Uno

    • pin 4 on Nano ICSP to D11 on the Uno

    • pin 5 on Nano ICSP to D10 on the Uno

    • pin 6 on Nano ICSP to GND on the Uno

Using the Arduino IDE, determine the proper COM port to talk to the Uno. Load the following sketch: File > Examples > ArduinoISP > ArduinoISP and upload it to the Uno. The Uno is now a programmer for other Arduinos properly connected to it.

Close the IDE, unplug the USB connection to the Uno and plug it back it. (don't know why I had to do this)

From a Command Prompt, do the following:

Navigate to the location of avrdude.exe. It will be in a sub-directory where the Arduino IDE resides. On my machine it's at:

C:\Library\Arduino\hardware\tools\avr\bin (it will be somewhere else on your machine)

Copy the .hex file to this location (it just makes it easier).

From the same Command Prompt, issue the following commands:

avrdude -P COM5 -b 19200 -c avrisp -p m328p -v -e -U efuse:w:0xfd:m -U hfuse:w:0xD6:m -U lfuse:w:0xFF:m

(substitute COM5 with your COM port.)

Yes 19200 is correct, even though the Uno usually communicates at 115200.

This command sets up the fuses in the Nano to allow the bootloader to be overwritten.

then...

avrdude -P COM5 -b 19200 -c avrisp -p m328p -v -e -U flash:w:microaprs-5v-kiss-latest.hex -U lock:w:0x0F:m

(again, substitute the correct COM port and change the .hex file name to your .hex file. It could be a custom or stock bootloader or in this case the firmware for a KISS modem.

This command writes the .hex file and sets the fuses back to their proper state.

Using this method to re-install the stock bootloader will many times revive a seemingly bricked Nano.

An interesting side note: You can flash a Uno lootloader to a Nano and pick up some space if your sketches are just a tad bit too big.