avrdude: initialization failed, rc=-1 clocks, prescalars and fuses

So, if you’re trying to program your avr, and you get this message

$ avrdude -p attiny85 -c usbtiny -u   -U flash:w:tinytemp.hex 

avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude done.  Thank you.

And it worked before. What on earth went wrong? So you check the wiring. But it’s good. Of course it’s good, you haven’t touched it, you just recompiled and hit program again. So you hop online and find people saying a few things like “check the wiring” and a few hints, that perhaps there’s something to do with -B and matching up clocks. Here was me thinking that the programmer put it into reset and then provided it’s own clock via SCK, so who the hell cared what the device clocking was configured at.

I’d just done some power trickery, slowing down the clocks and timer scalars and resetting them at runtime, brining my boards power consumption from ~70mA down to 1.5mA at idle, but now the damn thing wouldn’t program! I couldn’t believe that avrdude had wrecked the fuses or anything, I’d have no warnings or messages, it just stopped working.

Lady Ada suggested that -B 32 should enough for just about anything. It’s not. But after an hour of double checking wiring and even pulling the chip out and putting it on a dedicated ICSP board, and getting the same damn error over and over, I tried drastic measures. I had even tried a virgin chip, straight from the foil and tube. It worked just fine, my chip, nothing. But…

avrdude -B 100000 -p attiny85 -c usbtiny -U lfuse:r:-:b

-B 100000 worked magic! And now, for god knows reason, it works again normally now too. *grumble*grumble*

Update: It still happened fairly often, but I got away with it at -B 300, which is much faster for programming than -B 100000

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>