Arduino-based AVR High Voltage Programmer

September 24th, 2008 by Jeff

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!

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

Related posts:

Tags: , ,

85 Responses to “Arduino-based AVR High Voltage Programmer”

  1. MoJo says:

    I made an ATmega8 version: http://denki.world3.net/avr_rescue.html

    I have rescued a couple of ATmega168s with it. Code converted to AVR-GCC, should work with almost any AVR is wired up right.

    Nice work Jeff.

  2. Rui says:

    Would this work with an ATmega328P?

    Regards,
    Rui

  3. Microman171 says:

    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!

    • Jeff says:

      You are welcome!

      PS: I have plenty of kits in stock, and they include a 5V to 12V converter so you don’t need an extra power supply to use them!

      http://www.mightyohm.com/blog/products/avr-hv-rescue-shield/

      • Microman171 says:

        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

        • Jeff says:

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

  4. abhishek says:

    hi
    can this programmer revive atmega32 controller.??
    thanks

  5. [...] mightyOhm » Blog Archive » Arduino-based AVR High Voltage Programmer [...]

  6. [...] power supply. A 13volt VPP supply is required to program PIC 12/16/18F microcontrollers, and clear the RESET fuse in [...]

  7. Gale says:

    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?

  8. matajumotors says:

    Hi, it worked for me with my “bricked” Atmega168, Thanks for publishing it!!!

  9. [...] power supply. A 13volt supply is needed to program PIC 12/16/18F microcontrollers, and clear the RESET fuse in AVRs. It’s doesn’t do much right now though, because there’s no support [...]

  10. Mojos says:

    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..

    • Jeff says:

      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.

  11. [...] VPP supply is required to program PIC 12/16/18F microcontrollers. We though it might be useful for clearing the RESET fuse in AVRs too, but that part isn’t going to work (it still has a handy 2×3 ISP [...]

  12. [...] VPP supply is required to program PIC 12/16/18F microcontrollers. We though it might be useful for clearing the RESET fuse in AVRs too, but that part isn’t going to work (it still has a handy 2×3 ISP [...]

Leave a Reply


www.flickr.com
mightyohm More of mightyohm