Skip to content

How-To update the Arduino

dapaCableAfter doing the reset mod to my Arduino Compatible Bare Bones Boards I wanted to update the firmware to get the full benefit of the Diecimila update. I followed the directions on the Arduino website but could not succeed. I sent emails and did web searches and still did not find the answer. Ultimately with the help of David Mellis, one of the Arduino Team members, we figured out that it can not be done from the IDE using the simple cable described at the Arduino web site. It can be done however and this article will give you the information needed to update or program new Mega168 chips with the latest Arduino code.

The new Diecimila update is worth the effort. The new boot loader starts the code in about 2 seconds. The old one waited around for 10 seconds or so for potential load commands from the IDE. Since the new IDE can force a reset the timing can be much quicker. This quicker startup makes developing with the Arduino much nicer.

The Arduino IDE package includes the AVRDude programming software which it can use for firmware updates if you have a USB AVR-ISP like the one recommended by Paul in the previous article then you may be all set. AVRDude does work with the simple (and slow) parallel port cable but the IDE does not know how to automate that process. The Arduino team will try to get this sorted out in the next release. For now, we need to use AVRDude from the command line.

I don’t mind spending $50 for the other programmer. I just wanted something quick and dirty and I assumed that since it was described at the Arduino site, it would work OK. I also expect that many of the hobbyist on a budget would want to use this method too so I hoped to lead the way…

AVRDude is a nice tool. With it you can download the contents of your chip, program tons of different processor types using many different programmers. For my initial testing, I worked on reading the chip first. Only after that worked did I try programming. I recommend that you do the same. Read more and learn how to use AVRDude here.

OK now for the information you have been waiting for… First thing to say is that you can kill your chip trying to reprogram it. Usually if this happens you can just try again until you get the code loaded but it’s possible to destroy the chip or get some protection fuses messed up such that you would need extra steps not described here to recover. When and if AVRDude ask if you want it to fixed changed fuses, I strongly recommend that you say no. You must have had some kind of read problem and it would not be wise to try to program fuse bits if things are not working perfectly. Just say no.

Step 1: Build the programming cable
Build the parallel port programming cable as described here at the main Arduino site. The picture here is my version of the cable.

Step 2: Install libusb-win32
Install the latest libusb-win32. This library is apparently not installed or properly available when you setup your Arduino IDE. You need this DLL installed even if the programmer you want to use is not interfaced on USB. I could be wrong about this but I could not get AVRDude to run, at all, until I installed the libusb DLL from here. There is a simple to use installer for Windows. Just run the installer.

Step 3: Locate and copy files
Locate all the required files. We need to copy all these files to the tools directory where the AVRDude exe is. you could use long path names but I think copying is easier. When the IDE automates the process the long directory names are not a problem but for us, they create opportunity for errors. Find each of these files then copy as required so that all the files are where “avrdude.exe” is. Note that the directory names on your system may be different as they depend on where you installed the Arduino package.

  • AVRDude: “avrdude.exe” at “arduino-0009\tool\avr\bin”
  • The new boot loader: “ATmegaBOOT_168_diecimila.hex” at “arduino-0009\bootloader\168”
  • AVRDude configuration file: “avrdude.conf” at “ardunio-0009\tools\avr\etc\”

Step 4: Connect the cable
Connect the programming cable to the ICSP connector and Power up your Arduino or Arduino compatible board, I don’t recommend that you have the USB or serial interface connected. It would probably be OK to leave them connected but I am concerned about a reset during the load process. I recommend that you power the board separately and leave the serial interface disconnected.

Step 5: Test
DOSWindowWe want to test that AVRDude is connected and working with our hardware. There are several options including just asking it to read the device ID or parameters. Look up the commands if you have any trouble as this might be a quicker test then dumping the existing code to a file.

Open a DOS prompt/window in the directory where AVRDude and all the files you copied from step 3. Issue the following command.

avrdude -c dapa -i 800 -p m168 -U flash:r:"oldbl.bin":r

The quotes around the file name are important. If everything works OK AVRDude should read your chip and dump the contents to “oldbl.bin” The “-I 800” is a timing delay value that could be set for a shorter value. I needed 800 on my system to get reliable verifies. This is a slow process so expect to wait a few minutes. With the USB programmer this would be done in a few seconds.

Step 6: Burn the boot loader
Now that you are fairly confident that your cable works, we can burn the boot-loader. Use this command to do the burn.

avrdude -c dapa -i 800 -p m168 -U flash:w:ATmegaBOOT_168_diecimila.hex

Watch for verify failures. This means that the code did not read back correctly. I had this problem and found that I needed to slow down the timing. The “-i 800” parameter puts in a large delay allowing things to stabilize as AVRDude bit-bangs the programming interface. Depending on how fast your PC is and how well you built the cable, you may need even more delay on your system. Try increasing the 800 value. You may be fine with lower numbers. 800 does seem kind of high. My system is a AMD X2 Dual core 64-Bit 4200.

That’s it. If all went well your code should verify.

If it does not verify or you cant get things to work, just keep at it. Read more at the AVRDude and Arduino web sites. Also look in the forums and do web searches. I spent hours working on this and have explained all I know in this article.

Comments Please
If you find that I left out an important step, please let me know so I can update this article. I did take notes as I worked but it is possible, even likely, that I missed something. Also let me know if these steps work for you. I hope to save everyone the pain I went though…

Posted in Arduino, Development Tools, Microcontroller, Workshop Tools.

8 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. frgmnt says

    hours later.. everything works!

    three times 50 minutes (test-read, program, verify) – time enough to learn a lot about fuses & later tried everything:

    if u just update your arduino, u dont have to worry about the fuses, just the lockbits are reset & have to be set again to protect the bootloader from overwriting.

    “avrdude -c dapa -p m644p -P lpt3 -t” entered terminal mode
    “d lock” gave the lockbits´ value after programming = 0x3f,
    “w lock 0 0x0f” set them to boot loader protection,
    “quit” to exit.

    u see, i had to use “-P lpt3” for my non standard parallel port address (and of cause i got a different processor in the sanguino: “m644p”). since my chip was brand-new i also had to set the three fuses manually.

    an aduino which was preprogrammed has them already set right.


    50 minutes is just too much! i have to burn 64 k instead of 16. i just tried to drop the delay introduced with “-i 800”.

    programmed & verified in 1 minute – instead of 100. this sounds like more fun, or? 🙂

    but seriously: something is very wrong if such a huge delay is neccessary:

    noise from the power supply – use a 9v battery.
    weak drivers in the parallel port, thats what i suspect. – a buffer like 74hc244 will boost the signal easily.

    hope this helps someone.

    thanx again for pointing me in the right direction. now i m proud member of the AVR community!

    .. soon i need no buffer – but a pillow.

  2. frgmnt says

    nice to find this tutorial. thanx!

    i try to set up my new sanguino board (arduino compatible with atmega 644p, 64k flash) – i have some problems with the 0012 Alpha IDE built-in support for burning bootloaders with parallel dapa programmer.

    since my parallel port is located at adress 0x3BC, i have to use the parameter -P lpt3 as well. i guess this is the reason why this IDE bootloader support doesnt work.

    ATM i am reading out my empty chip (just testing) but be astonished how SLOW this is, also uses 90% of my processor 1GHz athlon. with 64 k it will be 50 mins or so – but at least it seems to work. 🙂

    i have extracted the fuse settings from the boards.txt file – i guess i will need them later to protect the bootloader, right?

  3. David A. Mellis says

    Arduino 0010 will have built-in support for burning bootloaders with a parallel programmer. I don’t have one to test with, but it’s generating the same command lines you were using, so it should work. It should be out in the next week or so.

  4. Felixe says

    I had one of the first Decimilla Arduinos with the incorrect hex image. I re-programmed it with USBtinyISP programmer with the instructions found at:

    Now I can program, upload and verify my code really fast (2 seconds aprox.) I’m also quite sure I could have done the same with my parallel port programmer.

  5. dfowler says


    Yes I see that now.. I did not notice the directory prefix on your AVRDude command line.

    It may still be a good idea to do the steps as described to reduce the chances for error on the command line.

  6. David A. Mellis says

    Right, it’s in the root Arduino application directory, since that’s the working directory for the Arduino environment (arduino.exe) and thus where Windows will look for DLL’s. That’s why you need to use the .\tools\avr\bin\avrdude path – so your working directory is the Arduino application directory and avrdude can find the libusb DLL.

    Of course, in the next version of Arduino, you shouldn’t need to worry about any of this. 🙂

  7. dfowler says


    Libusb was not in the bin directory where AVRDude is. At least not on my install. I am fairly sure I just copied the directory as expected for the install so libusb may have been left out of the currrent Arduino IDE release.

  8. David A. Mellis says

    Thanks for the great writeup. This should definitely be helpful to people looking to upgrade their bootloader. It will definitely help me, since now I have a good place to point people who are looking for good directions.

    One comment about libusb. Because there’s no installer for Arduino on Windows, everything needs to be in the Arduino application directory, including libusb. If you run avrdude from the Arduino application directory, it should find the libusb dll there and use it. That is, you should be able to do something like:

    cd c:\arduino-0009
    .\tools\avr\bin\avrdude -C .\tools\avr\etc\avrdude.conf ….