Loading a new Bootloader to my Diecimila/ATMega168

After somehow I couldn´t upload any new software to my Arduino I learned how to use the Popolu USB AVR Programmer I luckily already had purchased before.

Even worse than that I didn´t immediately recognize that my software updates weren´t loaded to the Arduino, because somehow I didn´t see the upload error messages when working with the Arduino VS plugin; only in the Arduino programming software I saw those messages.
Attention: If you use this description for any of your purposes you do it on your own risk. I shall not be kept liable in any manner and I make no warranties.

Symptoms

  • I was getting upload verification errors
  • Messages like ‘not in sync’

Root Cause

I still have no clue. My best guess is that I had some voltage glitches from the electronics attached to my Arduino….

Connecting Programmer with PC and Arduino

  1. Connect Polulu to USB (PC)
    The Green light must be constantly on; anything else indicates that the PC connection doesn´t work (e.g. wrong USB driver)
  2. Power up Target Device (in my case Arduino Duemilanove)
  3. Connect ISP cable from Polulu to Target Device
    The yellow led on Pololu must blink

Uploading the Bootloader to the Arduino

As the whole procedure didn´t work from the Arduino IDE, I learned to use AVRDude from the command line. As an additional hurdle, avrdude.conf was missing on my windows installation.
http://www.ladyada.net/learn/avr/avrdude.html was a great help 🙂

I then created the following batch file

Attention: be sure to use the right COMxx interface

” avrdude -p m328p -P COM2 -c avrispv2 -e -U flash:w:bootloader.hex
” avrdude options doku under http://www.nongnu.org/avrdude/user-

manual/avrdude_4.html#Option-“Descriptions
” my Pololu connects on COM15
” -e erases what´s been there before
” -U flash  says that the flash ROM shall be written
” -v verbose
rem http://www.geocities.jp/arduino_diecimila/bootloader/files/avrdude.conf
rem Geocities 🙂 LOL. Didn´t know it still exists 😉
rem COM16 !!! Argh. Cost mw 30min to find out I´d used the wrong COM 🙁
C:
cd “C:\Program Files\ArduinoSoftware\Entwicklungsumgebung\Windows\arduino-1.0.1\hardware\arduino\bootloaders\atmega\”
“C:\Program Files\ArduinoSoftware\Entwicklungsumgebung\Windows\arduino-1.0.1\hardware\tools\avr
\bin\avrdude.exe” -C “C:\Users\Robert\Desktop\Arduino\avrdude.conf” -p m168 -P com16 -c avrispv2 -e  -v -U flash:w:ATmegaBOOT_168_diecimila.hex
pause

avrdude.conf

As no avrdude.conf file was on my machine, I created the following avrdude.conf
Attention: This must of course fit your programmer and target device.

Update 08/19/14:

had errorswhen writing the bootloader to a 328p :  stk500v2_command() command failed rc=-1. When using the -F option of AVRDUDE, it said the device signature was invalid:

avrdude.exe: Device signature = 0x000000
avrdude.exe: Yikes! Invalid device signature.
avrdude.exe: Expected signature for ATMEGA328P is 1E 95 0F

I then added the -B and -i options to the AVRDUDE call:

“C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avrdude.exe” -C “C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf” -p m328p -P
com3 -c avrispv2 -e -v -U flash:w:ATmegaBOOT_168_atmega328.hex -i 90 -B 22 -F

Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

Please calculate :) * Time limit is exhausted. Please reload CAPTCHA.