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!

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.

Tags: , ,

105 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

    • Jeff says:

      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.

    • Jeff says:

      Yes, it should work with the ATmega328.

  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

    • Jeff says:

      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.

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

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

  13. [...] on work by Jeff Keyzer. var addthis_brand = 'Rickety';var addthis_language = 'en';var addthis_options = 'email, [...]

  14. Shuvro says:

    from where i can get the arduino codes? please let me know.

    thanks

  15. Jeff Karney says:

    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.

  16. Ron says:

    Hi,

    Will this work on ATMega8 and ATMega16?

    TIA

    • Jeff says:

      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.

  17. piorekf says:

    Does this help with all fuse problems or only when the problem is RSTDISBL set incorectly?

    • Jeff says:

      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.

  18. lucilanga says:

    Works like a charm. Just rescued an ATMega8.
    Many thanks!

  19. narpat says:

    Can it recover the ATMega64 fuses by connecting wires from the arduino board to ATMega64 ?

    • Jeff says:

      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.

  20. MostlyHarmless says:

    Many thanks for this Arduino-based HVP! Just resurrected 3 ATMega328P with this.

  21. Robotjam says:

    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

  22. Luis says:

    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.

  23. faudzee says:

    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.


www.flickr.com
mightyohm More of mightyohm

%d bloggers like this: