hvfuse_fixed.sch

Arduino-based AVR High Voltage Programmer

Arduino-based AVR High Voltage Programmer

Update 01/02/09: A PCB version of this circuit is in the design stages – some preliminary information is here.

Update 03/11/09: Kits based on this design are now for sale!

Update 12/14/10: The original AVR HV Rescue Shield kit has been replaced by the new and improved HV Rescue Shield 2.  Visit the HV Rescue Shield 2 product page for information about the new kit!

As I mentioned earlier this week, I recently “lost” an ATmega168 due to flashing the configuration fuses to disable the RESET pin, without realizing that this makes the device impossible to reflash with SPI.  This is particularly frustrating because the device is still 100% functional, just completely deaf to ordinary serial programmers.  The only way to recover the device is using what Atmel calls “High Voltage Parallel Programming Mode” which very few programmers support, most importantly, not the USBtinyISP I otherwise love.

Fortunately, my trusty Arduino came to the rescue – I created an Arduino-based AVR programmer that uses the high voltage programming mode and can fix pesky fuses like RSTDISBL.

The Arduino has just enough IO to implement the entire HV protocol plus a “go” button.  So far I have only implemented setting LFUSE and HFUSE in software, but there is no reason why the code couldn’t be extended to support chip erase and programming the entire flash as well.

Overview:

The fuse programming process is simple:

  • Upload the HVFuse sketch to the Arduino, available for download here: HVFuse.pde
  • Install the shield and apply +12VDC to the terminals on the left
  • Wait for the red LED to turn on (if it isn’t already)
  • Install the ATmega to be repaired
  • Push the button
  • As soon as the LED turns back on, the AVR is fixed and ready to be put back into service!

Schematic:

Here is an Eagle schematic of the HV Programming shield (click to enlarge):

Update 12/17/08:  An observant reader pointed out that there were three errors in the way GND/AGND, AREF and VCC/AVCC were connected on the target AVR in the original schematic.  The errors have been fixed and the updated schematic is below.  Apologies for any confusion this caused.

hvfuse_fixed.sch

Parts list:

  • An Arduino NG, Diecimila, or compatible
  • A piece of perfboard cut to size
  • Header pins for the Arduino interface (note I had to drill some of the holes to get the headers to fit the nonstandard pin spacing for digital lines 8-13.
  • An LED which indicates when it is ok to insert/remove the AVR
  • A 2N3903 or similar NPN transistor (2N2222, etc.)
  • (20) 1k resistors – these protect the Arduino from short circuits in case something goes wrong
  • A pushbutton switch – this is the ‘go’ button
  • A 28 pin socket for the target AVR

Kits!

A kit version of this project is available.  Visit the HV Rescue Shield 2 product page for more information.

105 thoughts on “Arduino-based AVR High Voltage Programmer”

    1. Rui,

      It should work with the ATmega328P, but until recently I didn’t have any devices so I couldn’t test it. Now that I have a couple 328’s in the lab, I’ll stick them on the AVR HV Rescue Shield and let you know what I find.

  1. I re-fused two ATmega48s with no problem. I am designing a single side shield for my arduino duemilanove. Thanks very much for publishing this!

      1. I have a 12v 1amp plug pack I used. I just wired from RAW.

        You may have only saved me $12, but I am very grateful. Thanks very much for publishing this.

        I’ll email you the single sided copy when I’ve finished it if you want. I’ll make sure you get full credit!

        In my country kits would cost a bout $25. This seems like a great price, but when I pay for shipping this could easily go up to $40 – $50. I would love to buy a kit just to support you, but I can’t afford it. Sorry mate. I have all the parts I need to build a board from scratch. It will only cost me time =)

        Once again, thank you very much for posting this. My ATmega48s will go on into projects after all =D

        1. No worries, if I didn’t intend for people like yourself to experiment and build their own I wouldn’t publish detailed schematics and source code. :-)

    1. I have tested the AVR HV Rescue Shield with the ATmega328 and it works fine, so this circuit should work with the 328 as well.

  2. I have many of Atmega8, Atmega88, and Atmega168 and I used parallel port programmer cheap one successfully on all of them, reading fuses, programming and using ipprog software but over the sudden none of them read fuses other than 0xFF for the low, high, and ext fuses, it is wierd and please some one to help me, it cannot brand new, and used mcu same fuses of 0xFF, changed PC and installed fresh sw replaced 74ls08 that protects parallel port and the result is the same. Any hint please now I cannot even program any, and I do not have arduino so how I can fix this issue or debug it?

  3. Does this revive Attiny45, I have couple that I’m not sure if they are fried or configuration locked up, any savy could tell me how to tell. The programmer I use quit identify them. If I breadboard this schematic would it be useful for that?
    Please I need help srome someone..

    1. Not as-is, but it should be possible to support the Attiny45 by rewiring the socket to get the right pins to the AVR and adding HV serial mode programming support to the Arduino sketch.

  4. This worked very well for me on an Atmega2560. I only had it hooked up to my ICSP about 10 mins before I bricked it. I did not use any of the resistors on the data lines, just hooked it directly into the the Arduino and changed the fuse bit settings based on the fuse bit calculator you linked. Thank you very much! For those that don’t know, if you have a different chip (like I did) make sure you look at the FULL datasheet and search for parallel. It will tell you how the pins map to that particular processor. Then look at the source code for the Arduino Sketch and it will all make sense on what goes where.

    1. Ron,

      Based on a quick review of the datasheets, it should be possible to adapt the programmer to support the ATmega8A and 16A, with only minor, if any, modifications.

    1. It will set any valid HFUSE, LFUSE, and EFUSE value, so it can be used to recover from all sorts of bad fuse settings – wrong oscillator, reset disable, SPI programming disabled, etc.

    1. The ATmega64 supports HVPP, so there’s a good chance that it will work with the shield. If you try it, please report your findings in the forums.

  5. Hi, This project looks like exactly what i need to rework some Atmega 168 chips that i can’t get loaded with bootloaders, my question is this, I don’t have any 1K ohm resistors lying around and it takes 3 weeks to goe some from china would 1.5K ohm resistors work if not what other, if any, resistors would work with this. Thanks

  6. Hi! Thanks for the project, it’s like a cushion against the floor for many of us. I happened to get better results with an N-mosfet 2n7000 instead of the NPN transistor, as it was not being able to fully pull the RST pin to ground, but to a mere 7.3V or so.

  7. Hi Jeff, if I want to recover my ‘bricked’ Atmega8, where should I modified? Is it enough by changing the values of Hfuse and Lfuse in your given sketch according to the specs of Atmega8? Thanks for the project.

Comments are closed.