# Why does my AVRISP MKII Programmer not work?

I am using Ubuntu and I am trying to upload a hex file (called src.hex) to my ATtiny85 with my AVRISP MKII programmer with avrdude. But I get a strange error. I run this command:

sudo avrdude -p t85 -c avrispmkII -P usb_device -U flash:w:src.hex


I get this error:

avrdude: stk500v2_command(): command failed
avrdude: stk500v2_program_enable(): bad AVRISPmkII connection status: Target not detected
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.


I have all pins connected correctly, I have my programmer plugged in my computer, I have the cdc-acm module running, and I have a .rules files places in the director /etc/udev/ (from this question).

How can I resolve this error?

Assuming everything is hooked up correctly, target microcontroller is turned on, then...

1. ISP mkII is running too fast for target device. (shouldn't be a problem out of the box I dont think, but if the target is running slower it can be. The -B flag can be used to slow it down, I'm not sure how it works with the mk2, though.

2. Target has no clock - fuses have been bungled, crystal isn't installed if it is set to crystal, no external clock if it is set to external clock.

3. Some peripheral you have it hooked up to it is overloading / driving the SPI lines, causing bus contention. Or your reset circuit won't let reset be pulled low, or low fast enough.(too much capacitance, too stiff of a pull up, etc).

4. More fuse bungling - ISP can be disabled, as can the reset pin (which also disables ISP). This may have happened in the past. Not on a new one, though. You'll need a high voltage programmer to get around this one.

And lastly, it could be blown. Fairly likely that is miswired, or one of the above, though.

Either the ICSP header is on backwards, or you are not providing power to the chip while attempting to program it.

• Yes I did see my programmer's light turn red so you were partially right... – user151324 May 1 '13 at 15:17
• +1 for "not providing power". Made my day. – Lennart Rolland Dec 8 '14 at 2:20

Does your circuit have it's own power supply? If you don't know, install the (free) AVR Studio, set up the AVRISP mkII with your microchip and run a first test. AVR Studio shows when your circuit has no power.