AVR High Voltage Programming (Fuses Rescue)

50K5346

Intro: AVR High Voltage Programming (Fuses Rescue)

Half a year ago I restarted one of my old passions - electronics. I've studied electronics in college but that happened during the Middle Age (20yrs ago). While I was expecting this huge leap in schematics and what a hobbyist can do nowadays, I still had some difficulties in catching up.

One which frustrated me greatly was the fuses for AVR/PIC microcontrollers (MCUs). I found a lot of interesting schematics with MCUs and fuses is a very important aspect when programming them. However, because I was a newbie in this department, I didn't want to spend too much on this so I bought quite cheap programmers from eBay. The PIC programmer worked fine but the USBAsp clone that I bought for AVRs was not a very good choice. An important percentage of my burning got screwed up because the fuses were wrongly programmed - most of the times the AVR became unrecognizable, it had a wrong ID, in other words it became almost dead/unusable.

STEP 1: Concept and Schematic

I started looking on the web for a solution and I found a very good way to reset the fuses using high voltage programming (link here: http://denki.world3.net/avr_rescue.html). I suggest reading the link for a better understanding of how it works :)

It was fun building it on a breadboard for the first time but it became boring and time consuming starting with the second, third and so on.

I decided to just put it on a PCB and have it handy whenever I need to quickly reset the fuses for an AVR. The schematic is very simple, I used minimum components, the lines between the "source" MCU and "destination" are not protected by 1K resistors and I also didn't use an external crystal for the "source". Powering the schematic and the "source" MCU is done via a simple LDO - LM78L05; I believe any 5V LDO given that it has the same pinout. I didn't bother with filtering, it's not quite important since the voltage noise is not (very) relevant for this circuit.

The AVR reset process is straight forward, after mounting the "destination" MCU in the IC2 socket, one has to power on the circuit. The LED will stay on until the Reset button is pressed; upon pressing the Reset button, the LED will go off and the default fuses will be burned on the "destination" MCU. When burning is complete, the LED will come on again. It will take few seconds to burn the default fuses, around 10 seconds, so don't panic.

The EAGLE files and HEX for the "source" MCU can be found here:
- EAGLE CAD files - both schematic and board

- EAGLE CAD prints - both top and bottom layers

- HEX file for the "source" - yes, one has to program it first and then use this MCU as "source"

PS: I didn't like the TO92 default pinout of the LDO so I've build a new library with the pins in line for ease of PCB design.One just has to copy it in the Eagle Lbr folder and load it in the software.

STEP 2: Overview

The schematic works well for me, it is doing what it's supposed to do. The LED color is not important, it's just something to let you know the circuit works. I tried to design the PCB with as less vias as possible and 5 vias seems reasonable. The end result may not look at its best, the surface soldering of the IC sockets could be a little difficult but it wasn't a big deal and definitely not a show-stopper. I'm sure it can be improved using SMD components but I didn't have any handy so I opted for through-hole. Anyone can customize the EAGLE files for their own use.

Cheers and have fun,

25 Comments

I'm begging someone to answer me.
Can I reset the ATmega 88 fuses with this device.
Thank you!
high-voltage programmer can reset lock bit of atmega328 without programe loss?
Hi !! Good project, have some Qs
-- guess you can attach to normal spi on a constructed board, (so you dont need the jigg)
-- could you possibly have a pdf of the scematics included ? (I use LT)
many thanks (my 3 bricks send their regards:)
Just an update on this great project! Clearing the Lock Bit Fuses......
By the way I'm not even close to being a programmer or profess to knowing anything about programming.
Please by all means correct my mistakes in this article and more importantly in the source code file. I have absolutely butchered it!
I was looking at the official Atmega8 datasheet , I found that there is a procedure to clear the Bit Lock Fuses on the Atmega8 AVR chip. Please see the attached images.

What I did was add a few lines of code including this ERASE CHIP code 10000000.
I basically just duplicated the set HFUSE and LFUSE lines of code substituting the AVR code 01000000 for 10000000.
I found this change in the source code allowed the chip to completely erase itself along with the FuseBits. I couldn't get it to work by just executing the sendcmd(0b10000000); on its own. Maybe it has something to do with the way the HFUSE and LFUSE routines access the Erase Chip programming function on the Atmega8 chip with the correct timing protocols.
If anybody can explain this it would be greatly appreciated.

You will be able to see the code additions in the source code file I have included in the download link. Again I will say I am not a programmer or know anything about computer languages. Please feel free to make this source code better for want of a better word.
I assume that this feature will be the same on the other Atmega 48/88/328 etc. I haven't been able to confirm this yet.
All the relevant files are stored here for you to access...

https://drive.google.com/open?id=1koC7HFV_QRap_BJE...

I found these files worked for me on an Atmega8 AVR chip.
I have also included a hex file and source code file for a version for an Atmega8 chip programming a Atmega 48/88/328 etc
Feel free to add to this already excellent project by mnedix.
Very nice project... I built my version on a Vero board.

I am very much a newbie with all things electronics. I do find it fascinating though.

I also recommend that one makes it on a PCB like yours. Mine took some time to put together. PCB would be much neater.

I have only tried it out programming the atmega8 at this point. I do eventually want to use it on fixing atmega88's that I have accumulated.

One thing I noticed with the atmega8 mnedix, is that if I set all the lock bits on my TL866 mini pro and then use it in your great HV programmer I can't clear the chip. That is to say I have the High fuse set to 0xD9 and the Low fuse is 0xE1 and the Lock fuse is 0xC0 .
Not being able to erase the chip is undoubtedly due to all the lock bits being set.

I am using a programmed atmega8 as the source chip incorporating your unaltered atmega88 hex file. Is the reason for non erasure due to me using an incompatible unmodified hex file?
I had a quick look at the source code you supplied. I couldn't see a section for changing the lock bits in the source code. How could we add a lock bits line of code.

Thank you very much for sharing this project. 😁
It worked for me, Thank you very much :)

I repaired my two pieces of ATmega8A, I used an ATmega328P to repair them.
I had only to change the fuse values to suite the ATmega8A, and change the settings of the Atmel Studio project to work on the ATmega328P.

Update:-
I also used ATmega8A to repair my ATmega328P this time :))
Glad found this guide, i try build on breadboard and bring my Atmega328p to life again :). Previously my Atmega328p went error while reading signature and bad fuse setting.


I'd like to ask , is HeX file (flash file that burn to atmega8) contained setting to reset for attiny family too?..

Could you please publish a pdf version of the schematic?

This is excellent, I don't want the bloatware AVR studio on my computer to drive an AVR dragon, but I'm building a collection of bricked 380's. The problem with no filtering on the 7805 is individuals can be very effective RF transmitters without a cap on the input, and one on the output. If you were doing a board it would have been worth adding.

Thanks again, I'll be putting this together.

sdk

Hello. I just etched the board. i use DipTrace and cant open the schematics. Was trying to solder parts anyway but: At first glance the first transistor looks like a PNP BJT; It's really a BJT PNP? If so... it's base is directly connected to power ground (so always saturated anyway?), and if it's a BJT: No resistor between base and ground, thats really very bad. So well maybe it's not a BJT, what part is that? I can see just a 2N3904 in the reference link http://denki.world3.net/avr_rescue.html . Thanks!

Alright. From reference link http://denki.world3.net/avr_rescue.html and board layout I conclude: The first transistor is a PNP, it's collector goes to atmega pin 7 (VCC). It's useless ad it's base is always grounded. It will be probably hot (and die occasionally), because there aren't any transistor driving its base. I will just change this PNP to a wire jumper pin7->VCC like in the reference link. Anyway, thanks for the layout! Going to try resurrecting some atmegas in some minutes.

Ugh no no. It's not a transistor. It must be a 7805 :/ Thats what happens... with a board in hands... without the schematics... plus not feature in the reference link. Anyway... solved!

Hey, glad you could make it work, I really apologize for the delay but I
completely forgot about this project and haven't checked out the
website for a while :)

it works with atmega8? Thank you

It should work, you have to pay attention to pin mapping.

will this work with 16 MHz crystal?

The schematic does not burn specific fuses, it resets the MCU to the default/factory settings. The entire thing is intended to do that so if you want to use a 16 Mhz crystal later on then you have to program the fuses separately and accordingly.

hi,

Can this be used for ATMGE32A.

Please mention the pin mappings as well

More Comments