How to program your Arduino Uno with an AVRISP mkII

Have an AVRISP mkII that you want to use to program your Arduino Uno and still use the Arduino IDE? Well this post will show you how.This post assumes you have an Arduino Uno, running Windows XP, and have the latest IDE software (version 0022 as of this post).

The main reason I wanted to go this route was because of the start up lag. The lag is used by the Arduino IDE when you program via USB. The Arduino IDE will reset your Uno which fires up the bootloader to check for a new incoming program. This half a second or so lag will always be there on start-up and I wanted to get rid of it. Another draw back is that if you have stuff connected to the pins that is used for the serial communications, you could get erroneous data as those pins are checking for incoming serial data.

This procedure is rather simple. All you need to do is modify the boards.txt file. Boards.txt should be located in the Arduino folder. Hardware > Arduino > Boards.txt

Add this code in there and then save it after:

##############################################################
unoisp.name=Arduino Uno w/ AVR ISP MKii
unoisp.upload.protocol=avrispmkii
unoisp.upload.using=avrispmkii
unoisp.upload.maximum_size=32256
unoisp.upload.speed=115200
unoisp.bootloader.low_fuses=0xff
unoisp.bootloader.high_fuses=0xde
unoisp.bootloader.extended_fuses=0x05
unoisp.bootloader.path=optiboot
unoisp.bootloader.file=optiboot_atmega328.hex
unoisp.bootloader.unlock_bits=0x3F
unoisp.bootloader.lock_bits=0x0F
unoisp.build.mcu=atmega328p
unoisp.build.f_cpu=16000000L
unoisp.build.core=arduino

Now fire up the Arduino IDE and you’ll notice a new option available under Tools > Board. It’s called Arduino Uno w/ AVR ISP MKii. That’s pretty much it! Make sure you that option selected before you hit the upload button.

Note 1: If you have any issues with the speed and time of the programs, use the AVRISP to burn a fresh bootloader for your Arduino Uno and then try again. Burning the bootloader will set the internal fuses on the ATMEGA328 so that it works correctly on the board.

Note 2: If you have issues with it not responding to the AVRISP then you may have issues with the driver. A driver comes with the IDE download called libusb. When trying to update the driver, it is located in the Arduino folder. Hardware > Tools > avr > utils > libusb > bin.

Any other questions or problems? Leave me a comment and I’ll responds as soon as possible to help you out.

UPDATE 1/18/2012:

The Arduino has been updated to 1.0 and this work around is no longer needed. If your are using the new 1.0 IDE, then check out the new way to program your Arduino with an AVRISP mkII.

Posted in Arduino, Electronics Tagged with: , , ,
6 comments on “How to program your Arduino Uno with an AVRISP mkII
  1. Richard says:

    Hi thanks for the article. I am newbee in Arduino and I have bought a AVRISP mkII. a question:
    Is the bootloader program that is loaded by AVR Studio the same boot loader that Arduino IDE load?. or they are different?. I want to use AVR Studio to burn the boat loader but use Arduino IDE to write my programs and load in to my projects, possible?.

    Regards

    Richard

    • John says:

      No need to use AVR Studio to burn the bootloader. It’s pretty easy to burn the required bootloader onto a blank ATMEGA chip right from the Arduino IDE.

  2. Robert says:

    What would need to be changed to make this work with arduino 1.0?

    In file included from Blink.cpp:8:
    D:\arduino-1.0-windows\arduino-1.0\hardware\arduino\cores\arduino/Arduino.h:212:26: error: pins_arduino.h: No such file or directory

    • John says:

      Working on a new blog post to address this very question. I believe you no longer need to modify any files with the 1.0 software. As soon as I test it out, I’ll make a post. Stay Tuned!

      • Robert says:

        Hey John,

        The strange thing is that I cannot find much about this topic.
        It’s possible to use the arduino as programmer, but not directly a avr programmer?

        I am looking forward to your post, thank you 🙂

        Robert

      • John says:

        I finished up my post for the new Arduino 1.0 IDE. It’s still based on the Arduino Uno and the AVRISP mkII programmer. I’ve amended the post above with a link to an updated post.

        As far as using a second Arduino as a programmer instead of the AVRISP then you can check out the ArduinoISP page on the Arduino website. Warning though, I’ve never tried it because I only have the Uno and it’s not compatible with that model. You would need an older Arduino model.

Share your thoughts

Subscribe via Email Today

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Sponsors

Follow me on Twitter