Rescuing avr's after fuse errors

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 514 times
Been thanked: 467 times

Rescuing avr's after fuse errors

Postby dazz » Mon Sep 10, 2012 9:45 pm

We've all been there and done it but how do you recover after setting the wrong fuse bits, theres plenty of info and circuit diagrams on the web but most involve burning another chip, slaughtering chickens and dancing to the left in the hope it works, i started out blocking my turnigy 9x rc transmitter whilst flashing a new firmware, i initially used avr burnomat not realizing that it would change the fuses and an arduino mega as an isp programmer, then tried a usbasp(arrived dead) then downloaded some firmware to turn an atmega328pu into a usbasp type programmer as a spare yup you guessed it another brick, so i repaired the usbasp then set about trying to reset the fuses on the atmega328pu(you need to change the sig in avrdude ) so i read lots of websites tried various ways and could not get it to work so i sat down and had a think read and reread the datasheet and various website then it dawned on me and i found an easy way to get the fuses changed, you need to supply a clock to the xtal1 input on the bricked avr, i initily used a 1mhz signal but could not get any joy kept getting target not responding or invalid signature errors, i then noticed the usbasp has a slow sck setting, then reread the website and noticed that if the input clock to the bricked avr is less than 1.5mhz then slow sck has to be used, bingo i was able to set all the fuses except the extended fuse but as im not using any of them it does not matter, next i set up an external clock for 4 mhz and selected slow sck(wanted to make sure it worked) and managed to salvage my chip , i also changed the fuses to allow clk out on the target chip and int 8mhz osc, then connected an led to gnd as soon as i reset the fuses the led came on so i can now reprogram my previously dead chip, i then killed it a few more times to check various fixes and came up with the following, dont forgrt the external clk signal must be applied all the way through programming

1 if you have a usbee test pod or any other test pod that outputs a square wave, or a fuction generator ,set it for 3volts 4mhz and inject it into the xtal1 pin
2 if you have a pic fire up flowcode and and set the config for an internal osc with clk out and use the clk out pin to inject the signal into the xtal1 pin on the avr
3 as for the pic but use a spare avr, set the internal osc to 8mhz ,set divide by 8 and set clkout to get a 1mhz signal

Using option 2 or 3 you only need to set the config on the pic or fuses on an avr , then simply apply 5v and gnd and connect the clk out pin to the xtal1 pin on the targer avr no other components are needed, dont forget to set slow clk on the programmin software( -b option in avrdude), once you have recovered your avr then remove the external clk and program as normal, the advantage of this option is you can normally breadbord the chip and is cheap

Hope this saves building fancy circuits and wasting hours trying to recover bricked chips, this will work most of the time but depending on which fuses were set sometimes the only way to recover the chip is with a hv programmer or throw it in the bin

These users thanked the author dazz for the post (total 4):
JohnCrow (Tue Sep 11, 2012 8:18 am) • Benj (Tue Sep 11, 2012 9:35 am) • DavidA (Tue Sep 11, 2012 12:46 pm) • medelec35 (Sat Sep 07, 2013 11:47 pm)
Rating: 21.05%
To sign up to the V5 forum follow this link

User avatar
Matrix Staff
Posts: 14581
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4605 times
Been thanked: 4241 times

Re: Rescuing avr's after fuse errors

Postby Benj » Tue Sep 11, 2012 9:36 am

Cheers Dazz,

I'm pretty sure I've got some bricked AVR's in my collection so I will give this a whirl. Thanks.