Introduction: 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,

Comments

author
cinderblock made it!(author)2017-03-29

Could you please publish a pdf version of the schematic?

author
rodrigonh made it!(author)2016-03-04

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!

author
rodrigonh made it!(author)2016-03-04

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.

author
rodrigonh made it!(author)2016-03-04

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!

author
rodrigonh made it!(author)2016-03-04

There we go

boar.jpg
author
mnedix made it!(author)2016-12-07

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 :)

author
realnomis made it!(author)2016-02-23

Hi there. I did a build of this and am using the atmega 328. If i look at your picture it looks like the BC338 is upside down compared to the schematic??
Should the collector be connected to Vin or should the Emitter?

Screen Shot 02-23-16 at 10.47 PM.PNGScreen Shot 02-23-16 at 10.49 PM.PNG
author
realnomis made it!(author)2016-02-24

Ok i got it working, and it's really great. I am resurrecting both Atmega328 and 328P processors, it takes like 2 seconds :-) Great!
Of course the emitter has to be tied to ground, it still looks like wrong orientation in your picture but maybe the picture is fooling me? BTW i am using a BC337 transistor which is almost the same as a 338. I guess it's just acting as a switch on the IC2 reset so about any bjt transistor should work.

I did the PCB on a milling machine and had to do my own modification to the board layout, it's quite impossible to solder ic socket on the top with a ground plane just 8mils from the pad :-D

I changed the fuse settings to match the default in Atmega 328P, the new values is:
HFUSE0xD9
LFUSE0x62
I found the values from the link in the code:
http://www.engbedded.com/cgi-bin/fc.cgi

Good simple project! Thank you.

author
mnedix made it!(author)2016-12-07

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 :)

author
mnedix made it!(author)2016-03-01

Hi, sorry for the late response. The build looks very nice and I'm glad you got it working. I don't remember what BC I used, it probably had a different pin orientation. As for the code part, I did not change it a bit, I'm not that skilled in programming :) My understanding is that the fuses are reset to a factory default after which you can set them up as you want.

What I forgot to mention, and I think I got this way after I built this, is that it is highly dependent on the crystal. In other words, since this schematic does not use a crystal, when you reset an MCU then you reset also the crystal settings; if you place it immediately in a programmer (with a crystal) and don't take this into consideration then you may end up with some errors.

I will probably design and build another version - SMD based (1206 most probably).

PS: thanks for building it :)

author
mnedix made it!(author)2016-03-01

Hi, sorry for the late response. The build looks very nice and I'm glad you got it working. I don't remember what BC I used, it probably had a different pin orientation. As for the code part, I did not change it a bit, I'm not that skilled in programming :) My understanding is that the fuses are reset to a factory default after which you can set them up as you want.

What I forgot to mention, and I think I got this way after I built this, is that it is highly dependent on the crystal. In other words, since this schematic does not use a crystal, when you reset an MCU then you reset also the crystal settings; if you place it immediately in a programmer (with a crystal) and don't take this into consideration then you may end up with some errors.

I will probably design and build another version - SMD based (1206 most probably).

PS: thanks for building it :)

author
realnomis made it!(author)2016-02-24

one more thing, i am using a Atmega 328 as IC1 (the programmer)
I compiled the c file in atmel studio to accomodate the 328 and uploaded the new hex file with an atmel ice programmer :-)

author
sidbyron made it!(author)2015-12-09

it works with atmega8? Thank you

author
mnedix made it!(author)2015-12-11

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

author
AviralV made it!(author)2015-09-23

will this work with 16 MHz crystal?

author
mnedix made it!(author)2015-12-08

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.

author
itsme_kathi made it!(author)2015-04-12

hi,

Can this be used for ATMGE32A.

Please mention the pin mappings as well

author
mnedix made it!(author)2015-04-15

It could work on ATmega32 since it is working on ATmega328; you will have to do the mapping by yourself:

http://www.atmel.com/Images/2503S.pdf

http://www.atmel.com/Images/Atmel-8271-8-bit-AVR-M...

Do pay attention to the RESET pin - its "position" depends on the MCU case.

author
DavidM417 made it!(author)2015-12-04

What fuses should use to burn the hex file for the atmega328.?

author
mnedix made it!(author)2015-12-08

The schematic doesn't burn specific fuses, it actually erases everything on the MCU and burns/resets default fuses

author
itsme_kathi made it!(author)2015-04-16

Thanks a lot.

just went through the data sheet of ATMEGA32, found the pin mappings.

author
itsme_kathi made it!(author)2015-04-16

Thanks a lot.

just went through the data sheet of ATMEGA32, found the pin mappings.

About This Instructable

21,419views

37favorites

License:

More by mnedix:Nixie PC Meter/MonitorAVR High voltage programming (Fuses rescue)
Add instructable to: