Saturday, January 7, 2012

AVRISP mkII & Arduino 1.0

There are plenty of reasons why you would want to use your AVRISP programmer to upload sketches to the Arduino board if you own one. In fact, it might be worth spending the $35.
  • No bootloader delay when booting.
  • Can use the serial port for something else without having to disconnect it to upload.
  • Faster.
  • Don't have to worry about which bootloader (OPTIBOOT?) and version (today v4.4) to install.
  • Can use all of the flash space on the ATmega.

This is based on http://www.arduino.cc/en/Hacking/Programmer which is dated.

Here are the steps which you only have to do once:
  1. Close the Arduino (arduino.exe) software.
  2. Locate your boards.txt file. On windows it is C:\arduino-1.0\hardware\arduino\boards.txt depending on where you installed unzipped the Arduino download package.
  3. Add the following code to the top of the file. Save and start arduino.exe.
##############################################################

avrispmkii328.name=-- AVRISP mkII - ATmega328 --

avrispmkii328.upload.using=avrispmkii
avrispmkii328.upload.maximum_size=32768
avrispmkii328.upload.speed=115200

avrispmkii328.build.mcu=atmega328p
avrispmkii328.build.f_cpu=16000000L
avrispmkii328.build.core=arduino
avrispmkii328.build.variant=standard

##############################################################

Now you will have a new option under tools->board menu:

Simply select that option to upload your sketch with the AVRISP.

Few things to remember:
  • You need external power to upload sketches. This is a little different because normally, the USB cable connected directly to the Arduino board during uploading powers the board.  
  • When you update or reinstall the Arduino software, your boards.txt will be overwritten. Just bookmark this page for the future.
  • Once you upload any sketch, the bootloader is gone until you put it back. 
  • You will want to burn the bootloader once to new chips to set their fuses.
To put the bootloader back or to install it for the first time on a naked chip: 
  1. Setup the AVRISP mkII just like you would to upload a sketch.
  2. Open the Arduino software.
  3. Select Tools-> Board and select the board you have connected.
  4. Select Tools -> Programmer -> AVRISP mkII.
  5. Select Tools -> Burn Bootloader.
Hopefully, this will save you a bunch of time while playing developing with the Arduino!

Thanks.

No comments:

Post a Comment