Reset clock fuse bits on AVR


I am just starting to learn about AVR programming and I really enjoy myself! πŸ˜€
Except maybe when I play with the fuse bytes and I screw things up…

Basically, I was using a ATtiny13A microcontroller and I configured the fuse bytes to use the internal low-frequency oscillator running at 128kHz. I thought it would be a good idea to check if my simple blinking LED program was still working with this internal oscillator.
The good news is the LED was still blinking. But the bad news is I wasn’t able to reprogram the chip anymore… πŸ™ After some research, I figure it out: the ISP interface needs to run slower than the microcontroller in order to flash it! And obviously, my ISP interface was running faster than 128kHz…

These microcontrollers are very cheap so I could just throw it away. But I am not the kind of person to give up without a fight! πŸ˜‰
So I talked to my friend Google and he suggested me to read the following article: Fixing a bad frequency fuse bit on an AVR.
I followed the instructions and here is the output:

C:\AVR>avrdude -p attiny13 -P usb -c usbtiny -tuF

avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATtiny13 is 1E 90 07
avrdude> sck 1000
>>> sck 1000
avrdude: Setting SCK period to 250 usec
avrdude> e
>>> e
avrdude: erasing chip
avrdude> sck 10
>>> sck 10
avrdude: Setting SCK period to 10 usec
avrdude> quit
>>> quit

avrdude done. Thank you.

However, there is a missing instruction in this article. Indeed, these instructions erased the chip but didn’t fix the fuses, so now it’s blank but the fuses are still wrong!
In order to reprogram the fuses, you need to use the ‘-B250’ in the command line:

avrdude -p attiny13 -P usb -c usbtiny -U lfuse:w:0x6A:m -U hfuse:w:0xFF:m -B250

, , , ,


  1. #1 by Paul on 05 Feb 2012 - 20:51

    This worked! THANKS!

  2. #2 by ElectroNick on 29 Feb 2012 - 19:35

    Thank you! You saved my day. Burnt fuses on two ATtiny13s last night only to see them both play dead. That was *not* a good feeling πŸ™‚

    128kHz did not work for my application anyhow, had to re-burn the fuses differently and your instructions had explain the issue of speed incompatibility very well and got me on my merry way.

    Thanks again!

  3. #3 by smoreau on 29 Feb 2012 - 19:40

    Happy that I’ve been able to help. πŸ™‚

  4. #4 by JJ on 22 Apr 2012 - 09:34

    I just ‘bricked’ my ATTiny85 by setting the clock fuses to select the 128KHz RC oscillator. Well, not bricked, but I certainly lost the ability to program it. Found your post useful, but it wasn’t the answer for me. I’m using an Aurduino Uno (rev3) as an ISP, and the sketch that runs it (the example that comes with 1.0) sets the SPI hardware to talk at it’s lowest possible speed with the highest prescaler of 128. With the 16Mhz clock speed of the Uno that’s 125KHz , well beyond the maximum speed of 32KHz (target’s clock speed /4), so no amount of fiddling with avrdude options could remedy the situation.

    I stumbled across a modified version of that example sketch at http://pastebin.com/Aw5BD0zy that implements slow software SPI, overcoming the problem of the original sketch. It worked perfectly.

    I made some changes to allow it to be used in both modes. I’ve posted the modified sketch at http://pastebin.com/Mngw3UH9

  5. #5 by JJ on 24 Apr 2012 - 03:02

    Made a few more changes to the sketch:
    http://pastebin.com/60xYhyq0

  6. #6 by weller on 27 Jun 2012 - 16:00

    Thanks, this works for me!

  7. #7 by Sebastian on 22 Jul 2012 - 01:18

    I LOVE YOU =D

    trust me, i had 6 “bricked” chips lying arround, and THIS worked =D

    You have my entire enternal gratitude, i hope that a gigant brick of gold hits your window by this years end =D

  8. #8 by Milind on 30 Jan 2014 - 13:25

    I just recovered half dead m128… Thanks a lot..

  9. #9 by w32blaster on 26 Mar 2014 - 21:31

    Only this tutorial helped me! Thanks a lot!

  10. #10 by V on 13 Dec 2014 - 16:36

    Thank You JJ! You saved my attiny13 πŸ™‚

  11. #11 by Nugroho Adi Pramono on 16 May 2015 - 15:19

    Thanks, I left my footprint here, my ATTiny13A’s half dead too, so far -B4 works, from other forum.

    But I will definitely try this tutorial

  12. #12 by Jothi on 27 Nov 2015 - 05:16

    Iam facing a problem with ATMEGA 128. This controller was programmed with wrong fuse bits( all 0s) by mistake and from then the controller is locked and i could not even read signature through AVR programmer. So the controller was changed and with the new ATMEGA 128 on PCB also faces the same problem. i.e., am not able to read even signature. After that i changed even the crystal oscillator on PCB with new one (16MHz) thinking that this could solve the issue. Still facing same problem. Pls help

  13. #13 by Romit on 11 Dec 2015 - 18:30

    I am getting an error while trying uploading the programs in atmega16a with usbasp which states “Initialization failed, target doesn’t answer rc=-1” seems like after I done something with the fuses this error stats up, before that all was well and good. plz help me.

  14. #14 by ARN on 23 May 2016 - 06:52

    How can i reset fuse bits from Atmea328. While settig fuse bits to Atmega 328 there occurs an error. Can the above method in ATTiny works for Atmega328

  15. #15 by Kalle on 20 Jul 2016 - 08:31

    Big THANKS to you! Saved my day as I am playing with my ATTINY13 in very remote location and I already thought that I had lost it.

  16. #16 by Greg on 09 Jan 2017 - 22:41

    Thank you very very much for your solution. I managed to unbrick ATTINY13 with STK500 equivalent programmer (Proggy) and it worked!

    My commands:
    avrdude -p t13 -c stk500 -P COM1 -tuF

    avrdude -p t13 -c stk500 -P COM1 -U lfuse:w:0x6A:m -U hfuse:w:0xFF:m -B250

  17. #17 by Pradeep wagre on 03 Mar 2017 - 12:29

    How can i use this for arduinomega 2560?

(will not be published)