Programming with Arduino IDE & AVRISP MKII

August 9th, 2011

I had a PCB already made, with an ATmega328 soldered on. I had an AVRISP MKII laying around and an Arduino Duemilanove. Rather than desoldering the ATmega328 off the PCB and plugging it into the duemilanove, I just used the ICSP port I had on the board.

  1. Power up the PCB so that the ATmega328 or ATmega168 gets 5v of power.
  2. Plug the USB Cable into the AVRISP MKII and the programming cable from the AVRISP MKII into the ICSP of the board.
  3. Make sure the chip has the bootloader on it.
  4. Open up C:\Program Files (x86)\arduino-0022\hardware\arduino\boards.txt (file path may be different) and add the appropriate code below. You can add both if you want.

How to Burn the Bootloader onto ATmega Chip

Burning the Bootloader on ATmega Chip

Click Tools > Burn Bootloader > w/ AVRISP mkII

Board Code for ATmega168 and AVRISP mkII


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

avrispmkii.name=AVRISP mkII w/ ATmega168

avrispmkii.upload.protocol=avrispmkii
avrispmkii.upload.maximum_size=14336
avrispmkii.upload.speed=19200
avrispmkii.upload.using=avrispmkii

avrispmkii.bootloader.low_fuses=0xff
avrispmkii.bootloader.high_fuses=0xdd
avrispmkii.bootloader.extended_fuses=0×00
avrispmkii.bootloader.path=atmega
avrispmkii.bootloader.file=ATmegaBOOT_168_diecimila.hex
avrispmkii.bootloader.unlock_bits=0×3F
avrispmkii.bootloader.lock_bits=0×0F

avrispmkii.build.mcu=atmega168
avrispmkii.build.f_cpu=16000000L
avrispmkii.build.core=arduino

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

Board Code for ATmega328 and AVRISP mkII


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

avrispmkii.name=AVRISP mkII w/ ATmega328

avrispmkii.upload.protocol=avrispmkii
avrispmkii.upload.maximum_size=30720
avrispmkii.upload.speed=19200
avrispmkii.upload.using=avrispmkii

avrispmkii.bootloader.low_fuses=0xFF
avrispmkii.bootloader.high_fuses=0xDA
avrispmkii.bootloader.extended_fuses=0×05
avrispmkii.bootloader.path=atmega
avrispmkii.bootloader.file=ATmegaBOOT_168_atmega328.hex
avrispmkii.bootloader.unlock_bits=0×3F
avrispmkii.bootloader.lock_bits=0×0F

avrispmkii.build.mcu=atmega328p
avrispmkii.build.f_cpu=16000000L
avrispmkii.build.core=arduino

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

After adding the code you should be able to change the board to use the AVRISP mkII programmer. See the below screenshot.

Tools > Board > AVRISP mkII w/ ATmega328

Similar Posts

3 Responses to “Programming with Arduino IDE & AVRISP MKII”

  1. Jon Paul says:

    Hi,congratulation!!,

    Can you tell me how to configure the “board.txt” for use with the ATMEGA2560?

    Best regards,

    Jon

  2. Steven Johal says:

    Hi Jon,

    Yes, try adding this code for Arduino Mega 2560. I don’t have this chip/board so I can’t test it to double check. Let me know if it works.

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

    mega2560.name=Arduino Mega 2560

    mega2560.upload.protocol=stk500v2
    mega2560.upload.maximum_size=258048
    mega2560.upload.speed=115200

    mega2560.bootloader.low_fuses=0xFF
    mega2560.bootloader.high_fuses=0xD8
    mega2560.bootloader.extended_fuses=0xFD
    mega2560.bootloader.path=stk500v2
    mega2560.bootloader.file=stk500boot_v2_mega2560.hex
    mega2560.bootloader.unlock_bits=0×3F
    mega2560.bootloader.lock_bits=0×0F

    mega2560.build.mcu=atmega2560
    mega2560.build.f_cpu=16000000L
    mega2560.build.core=arduino

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

  3. Steven Johal says:

    Also you may need the hex file mentioned in that code above. Download: stk500boot_v2_mega2560.hex and save it to the appropriate arduino folder.

Comments