Saturday, January 3, 2009

Atmel AVR High Voltage Fuse Reset

(Lesson Learned: Divots should face each other)


Parts:

1 - Breadboard
1 - Set of breadboard jumper wires
2 - ATmegas (one good one, and the one you're locked out of)
2 - Regulated power sources, 12vdc and 5vdc
1 - LED
1 - 2N3903 or 2N3904 transistor (available at Radio Shack)
1 - Tactile/Momentary Button (Omron B3F-1000 is a popular one, can be stuck into a breadboard)
20 - 1K Ohm Resistors, 1/4 watt is fine.




This tutorial is based off of the work of Jeff Keyzer at his website:

http://mightyohm.com/blog/2008/09/arduino-based-avr-high-voltage-programmer/

I have attached a hex file containing the code to 'fix' a locked ATmega8, If you want to use his code, you have to have the Arduino IDE installed and you have to compile it with that. Once you have the .hex file, you can upload it to your mcu via AVR Studio if you like.

http://mightyohm.com/blog/wp-content/uploads/2008/09/hvfuse.pde

Make sure before you compile it, that you change the high and low fuse values based on the ones listed on the AVR Fuse Calculator website:

http://palmavr.sourceforge.net/cgi-bin/fc.cgi

The schematics he provides are bit tricky without an actual Arduino if you are just using an ATmega on a breadboard.

http://mightyohm.com/blog/wp-content/uploads/2008/09/hvfuse_fixed.png

You can use an Arduino pin map to help:

http://www.arduino.cc/en/Hacking/PinMapping168

Otherwise I am providing the basic pin connections below (refer to the schematic for hooking up the transistor, led, and button):

Note: The form here is the pin number followed by the pin name.

Connections w/1k ohm resistor in series:

Good Atmega -> Bad Atmega

2PD0 -> 14PB0

3PD1 -> 15PB1

4PD2 -> 16PB2

5PD3 -> 17PB3

6PD4 -> 18PB4

11PD5 -> 19PB5

12PD6 -> 23PC0

13PD7 -> 24PC1

15PB1 -> 6PD4

16PB2 -> 5PD3

17PB3 -> 4PD2

18PB4 -> 3PD1

19PB5 -> 11PD5

23PC0 -> LED, Button

25PC2 -> 25PC2

26PC3 -> 9PB6

27PC4 -> 12PD6

28PC5 -> 13PD7

GND -> GND

Other connections (no resistor):

Good Atmega -> Bad Atmega

14PB0 -> 22AGND, 21AREF, 7VCC

24PC1 -> button

Just remember it will be easier to work with if you place the two ATmegas on the breadboard with the divots facing each other. I learned this from experience ;)

Once you get it all hooked up, here is how it goes:

  • Apply the voltages.
  • Wait for the red LED to turn on (if it isn’t already)
  • Push the 'Go' tactile button
  • As soon as the LED turns back on, the AVR is unlocked!

Any questions, feel free to contact me.


9 comments:

  1. Hi friend!
    Excelent Work! Can you help me with a Atmega128 solution? I disable ISP and JTAG by a test, and don´t have a HVProg. I can use some schematic? do you have some source example for this ? Regards!

    ReplyDelete
  2. Hey good question, I'll have to take a look at this closer and i'll get back to you in the next couple days!

    ReplyDelete
  3. Yes, you can use this to fix your ATmega128. Look on page 292 of your datasheet: http://www.atmel.com/dyn/resources/prod_documents/doc2467.pdf

    If you change the code using the Arduino IDE to suit your needs. It also tells you what pins to use.

    ReplyDelete
  4. how to unlock atmega16

    ReplyDelete
  5. I found an unlocker here:
    http://www.microcontrollerprog.com/fuseprog.html

    ReplyDelete
  6. Hi,
    about 2 years ago I search for more universal "fuse doctor". Unfortunately I did not found nothing as I want. So I made my own version: http://martin-stej.wz.cz/index.php?page_id=avr_unlocker&lang=en
    It auto detect target chip, support SPI, high voltage (parallel and srial) programming, power supply from USB (no any other power supply needed! DC/DC included ;) ) and of course with source codes and schematics for free.
    Martin

    ReplyDelete
  7. Cool and that i have a neat supply: Whole House Renovation Checklist Pdf house renovation quotation

    ReplyDelete