# AVRDUDE throws “target doesn't answer.” with USBASP and ATMEGA48PA

So far, I could reprogram a circuit with an ATMEGA48PA without problem. Until I got (after apparently was programed successfully):

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
0x19 != 0x00
avrdude: verification error; content mismatch


Now every time I try to program it, I get:

avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: error: programm enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.


On that last unsuccessful program (the one with the verification error) I had pulled down the reset pin manually. Could that have made such harm? According to my multimeter, the reset PIN is pulled up by default (so it is supposed that it is still configured as reset).

• did you change fuse bits one last time the programming actually worked? – miceuz Feb 5 '13 at 22:26
• were you running the atmega with a crystal of without? – miceuz Feb 5 '13 at 22:27
• Have you tried another chip? – Leon Heller Feb 5 '13 at 22:31
• I usually get that message when I don't have the micrcontroller powered by the programmer, or I accidentally wire the programmer to the micrcontroller incorrectly. I'm sure you have checked several times, but just in case. – capcom Feb 6 '13 at 2:12
• @miceuz No, I didn't. I never changed the fuses, so it should have been using the internal oscillator divided by 8. However, the board has a 8MHz crystal. – Eduardo Feb 6 '13 at 15:53

## 1 Answer

You can fuse off the Atmega48's ISP interface if you corrupt the incoming programming data stream just-so, but it would be very difficult to do. Although, I've seen it happen with shifted byte streams which your manual override of the reset line could have caused (but still highly unlikely).

It's also possible that the USBASP needs a firmware update (as suggested by the warning message) or merely needs to be re-flashed. As in, you just got unlucky with your timing and really this is an unrelated failure in the USPASP.

avrdude is awful at debugging programming communication problems. You are better off using AVR Programmer (part of AVR Studio) for this.

For the general diagnostic procedure, see this question:

avrispMKII short circuit protection triggering when programming

• It worked with the same programmer and the same firmware. I can also program an Arduino (ATMEGA328P) without problem with that programmer, so it may be the case of fuse corruption. – Eduardo Feb 6 '13 at 16:14