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?


4 Answers 4


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.

  • \$\begingroup\$ Yes I did see my programmer's light turn red so you were partially right... \$\endgroup\$
    – user151324
    Commented May 1, 2013 at 15:17
  • \$\begingroup\$ +1 for "not providing power". Made my day. \$\endgroup\$ Commented Dec 8, 2014 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.

Read further here:


As shipped, the AVR ISP Mk2 DOES NOT supply target power, it only senses it. It must see voltage on both the Vcc Pin as well as the Reset pin supplied by an external source. Additionally, it must be able to pull down the reset pin to ground. Normally this is accomplished by tying the Vcc pin to supply voltage through a 10K resistor and also a 0.1uF cap to ground.


First of all I would recommend you to check the microcontroller itself. I've got the same error message and I found that my Atmega has been damaged. Swapping for the new one fixed the problem.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.