Saturday, May 7, 2011

Arduino Uno: Upload new firmware to the Atmega8U2

In the previous article it is described how to put Arduino Uno into DFU mode. To upload a new firmware the dfu-programmer is needed (Ubuntu users: sudo apt-get install dfu-programmer). Windows user can try FLIP software from Atmel. You can upload already compiled hex code from Arduino package or build it from sources (/usr/share/arduino/hardware/arduino/firmwares/arduino-usbserial/Arduino-usbserial-uno.hex or the latest one from github https://github.com/arduino/Arduino/raw/master/hardware/arduino/firmwares/arduino-usbserial/Arduino-usbserial-uno.hex). The steps are:
Put Uno into DFU mode,
sudo dfu-programmer at90usb82 erase
sudo dfu-programmer at90usb82 flash .../Arduino-usbserial-uno.hex
sudo dfu-programmer at90usb82 reset 
reconnect the USB cable.

The LUFA library is needed for building hex file from sources. Download the lib version 100807. Current sources doesn't compile with the latest LUFA(version 101122).
mkdir uno
cd uno
cp -r /usr/share/arduino/hardware/arduino/firmwares/arduino-usbserial ./
wget http://www.fourwalledcubicle.com/files/LUFA/LUFA-100807.zip
unzip LUFA-100807.zip
mv LUFA\ 100807/ LUFA
Fix the LUFA path in "arduino-usbserial/makefile":
     # Path to the LUFA library
     LUFA_PATH = ../..
change to
     # Path to the LUFA library
     LUFA_PATH = ../LUFA
make all
After the successful build the file "Arduino-usbserial.hex" is created. Now you can upload this hex file using above steps.

P.S. After the new firmware upload try to upload and run something using Arduino IDE(the Blink example), to make sure the "USB to Serial converter" firmware works fine.

That's all.

1 comment:

  1. Wow, I was just battling with the error "make: *** No rule to make target" For a couple of hours till I found this. The problem was that I was using the new version of LUFA. Hope this helps others find this post sooner!

    ReplyDelete