HV Rescue Simple

About: These Arduinos are driving me up the wall.

Intro: HV Rescue Simple

High voltage programming of ATmega328P and other Atmel chips on a breadboard

This procedure shows how to set up an Arduino as a high voltage programmer using a very small number of components: transistor, small inexpensive 12V battery, a paper clip, three resistors, LED, and assorted wire and breadboard. It works with just about any Arduino you may have handy, including Uno or older, Leonardo, Micro, Pro Mini, Nano, Mega2560, etc. The sketch has an easy-to-use menu with simple commands you send to it via Serial Monitor to read or set fuses on the target chip.

If you set this up and become comfortable with using the programmer, you can exploit features of the ATmega328P that you may have not used before, because prior to today most people think they've hopelessly bricked their processors once they set wrong fuse bits. Well, the fuse bits aren't wrong, they are available for use. For example, you can disable the reset pin and start using the reset pin as a general-purpose digital pin. You can disable ISP programming, if you have the need for that. You can set the 128K internal oscillator and experiment with the processor. You can now easily restore factory fuse settings or Uno fuse settings, or whatever fuse settings you want, whenever you have experimented with fuse settings that make your processor unrecoverable via the usual ICSP programming.

I recommend uploading the sketch to the Arduino before connecting the Arduino to the breadboard. The sketch was originally started by Jeff Keyzer for version 2 of his HV Rescue Shield (mightyohm.com/hvrescue2), and I have done extensive reorganization and alterations and simplification, to include giving it a user-friendly menu, changing some of the wiring, making it compatible with various Arduinos, and simplifying the reset circuit for breadboard use.

I recommend becoming familiar with the datasheet for your target processor before using high voltage programming.

Step 1: Wiring a Pro Mini As HV Programmer

The pictures show the progress I made as I wired the breadboard, and finally it was completed and my FTDI-like adapter connected with the sketch running.

In order to stay organized and make sure the wiring has the best chance of being done right, print out labels that show what each pin is used for on the target chip and on the Arduino. Print them out on regular paper, cut the labels out, and run them through a Xyron Create-a-Sticker machine (which you may find in your better half's scrapbooking tools), or put double-sided tape on them. Then use them and start laying out the breadboard components and wire according to the schematic. Notice the sketch uses digital pins 1-13, and all of the analog pins A0-A5. Digital pin 0, which is the RX pin, is not used.

I have found the small Arduinos such as Pro Mini or Nano result in the neatest breadboard wiring. If you use a Pro Mini or Nano it is also easy to use a multimeter to check continuity of all the connections, to make sure you haven't missed any connections. Note that on Pro Mini the RX pin is marked RXI and TX pin is marked TXO. The TXO pin is pin 1 and RXI pin is pin 0 regardless of how confusing the labeling on the Pro Mini looks. Connect the TX pin to the DATA1 line of the target chip, and do not connect the RX pin to any pin of the target chip.

Use pieces of a paperclip for a battery holder and bend them to get a little spring tension. You can use a 27A or A23 or other similar 12V battery. I have also borrowed a sealed lead acid 12V battery from a UPS. EBay has listings for extremely inexpensive step up converters that are breadboard friendly and can provide 12V. I am contemplating ordering a MT3608 DC-DC Step Up, which costs between $1 and $3 USD postage included. Those modules have the interesting requirement of keeping peak current "no more than TV University." You do not require much 12V current for this, it is just a signal to indicate to the target processor it should enter parallel programming mode, it is not burning anything with high current. If you leave your 12V battery connected to the circuit for a long time, it will drain. So, it would be a good idea to insert it right before programming, and remove it when done.

Notes about the labels I suggest using for keeping your work organized:

Vsup represents the pin 12 of the Arduino supplying operating voltage to the target chip, and that should be connected to the pins labeled V on the target. 12VG represents the pin A0 of the Arduino which controls the 12V switch or gate, and that should be connected to the resistor leading to the base of the transistor.

Step 2: Using Different Arduinos As HV Programmers

Here are photos of completed wiring for Uno, Leonardo, and Mega2560 setting the fuses on ATmega328P.

Step 3: Using the Sketch

To use the sketch:

  • Attach the Arduino to the computer with the USB cable.
  • Insert the 12V battery.
  • Open the Serial Monitor and set for 115200 baud.
  • The menu should appear and show you the proposed new fuses.
  • Type r and click send to read the existing fuses on the target.
  • If you like the proposed fuses, type w and click send to write them to the target.
  • To set custom fuses, type l, h, or x followed by a number to set the low, high, or extended fuse value, and click send. Repeat for any of the fuses you want to change. Then type w and click send to write them to the target.
  • Remove and insert the next processor you want to work with, or remove the 12V battery and disconnect the Arduino from the computer.

If the fuse readings show 02, 00, or FF for all fuse values it is likely the target chip is not inserted properly, wiring is wrong, battery polarity is reversed, or the battery is not producing something near 12V. Check everything with a multimeter, make corrections, and try again.

Step 4: Other Targets and Miscellaneous Notes

The schematic and sketch also handle setting fuses on ATtiny2313, ATtiny85, ATmega168P, and other targets. I have also used this to set the fuses on an assembled Digispark tiny85 board. Read the sketch and schematic, and especially study the data sheet for your target chip, to figure out the wiring.

If your target is a chip soldered on a board, such as Uno SMD or Nano or something like that, you should temporarily remove the DTR-to-Reset 0.1uF capacitor, the pull-up resistor for the reset pin, and the diode connected to the reset pin (if your board has one). You can put them back when you are done using the HV Rescue procedure.

Some of the pin connections serve dual purposes when programming ATtiny2313. To clarify what you see in the schematic, the BS1 pin of the Arduino (analog pin A2), goes to PD4 physical pin 8 on the ATtiny2313 and you leave the Arduino PAGEL pin of the Arduino (digital pin 5) unconnected. The PAGEL signals are sent through the BS1 pin by the sketch. The same thing is true of XA1 pin. The XA1 pin of the Arduino (analog pin A4), goes to PD6 physical pin 11 on the ATtiny2313 and you leave the Arduino BS2 pin of the Arduino (digital pin 9) unconnected. The BS2 signals are sent through the XA1 pin by the sketch.

How does the transistor switch on and off 12V to the reset pin of the target chip? Explanation: 12V is applied to the target chip reset pin through a resistor. So, you could say normally 12V is just applied to the reset pin. The transistor is switched on when it receives a 5V high signal from one of the Arduino pins, through the resistor to the base pin of the transistor. When the transistor is switched on, it conducts between the collector and emitter pins. This shorts to ground the 12V which was going to the reset pin, making it effectively 0V at the reset pin. When the Arduino sends 0V low signal to the base of the transistor, it switches off the transistor, and it no longer conducts, essentially taking it out of the circuit. 12V is once again applied to the target chip reset pin.

This is called inverting, because a low signal is applied to make an output go high, and a high signal is applied to make the output go low.

The resistor attached to the base of the transistor is a current limiting resistor. The resistor attached to the 12V battery does double duty: it is a current limiting resistor when the transistor is switched on and shorting the 12V to ground, and it is a pull-up resistor for the reset pin when the transistor is switched off.

The programming happens very quickly, but if you insert a delay(5000); in the sketch before the two lines "digitalWrite(RST, HIGH); // exit programming mode", it would allow you enough time to observe with a multimeter the voltage at the reset pin of the target chip, and see that it goes to 12V during reading or writing of the fuses.

Step 5: Links

4 People Made This Project!

Recommendations

  • Fix It! Contest

    Fix It! Contest
  • Audio Contest 2018

    Audio Contest 2018
  • Furniture Contest 2018

    Furniture Contest 2018

18 Discussions

0
None
PaulB8

7 weeks ago

Thank you, this recovered a 328p that I accidentally set to run at 128khz..

I attempted to change the default to use the internal RC 8Mhz Oscillator but fat fingered the fuse settings. Difference between E2 and E3 can really mess you up.

Everything was working on the chip, just very slow...

1
None
mcitizen203UtkarshVerma

Reply 8 weeks ago

use correct fuse LF , HF to make it alright

i used LF=EF HF=C9

0
None
antoniom131

4 months ago

Hi

great project,

Do you know if this doctor fuse can be use to restore fuse factory from bricked fuse Mcu atmega8515 40dip pines? And shoukd i have any special consideration with that mcu?

Thank you

4 replies
0
None
dmjlambertantoniom131

Reply 4 months ago

Hi, I don't know about the atmega8515. It would probably work. Refer to the data sheet for the atmega8515 where it talks about parallel programming pin mapping, and fuses, connect it and try programming it. The brief look I had at the data sheet makes me think it would work fine.

0
None
antoniom131dmjlambert

Reply 4 months ago

i have tried with atmega8515 16pu 40pines, but i don´t get reset fuses,

the serial monitor read that:

Read Low Fuse hex: 3F bin: 00111111

Read High Fuse hex: 3F bin: 00111111

Read Ext Fuse hex: 3F bin: 00111111

but when i try to burn the fuse factory for this AVR with follow comand, not work:

L 0xe1

H 0xd9

w

on serial monitor appear frozen that order, -burning fuses, but not change then, and led on breadboard turn on but then not turn off, and i wait until a minute,

then that process i read fuses chip again and result is same as beginning

Read Low Fuse hex: 3F bin: 00111111

....

do you think that chip is damaged?

thank

0
None
dmjlambertantoniom131

Reply 4 months ago

It may be. This is fairly simple, but a lot of wiring that is easy to get mixed up, so it could also be your wiring. This project lets you rescue an MCU from a situation where you previously used fuse settings that prevent it from being programmed further, but not rescue an MCU from an unknown condition or accidental damage. So the best thing to do is prove the wiring by HV programming a known-good MCU.

0
None
EduardoK16

5 months ago

I'm trying to rescue an atmega8, wrong fuses, it works, after writting the fuses it reads correctly, but, i cant work with chip after it cant be programmed.

2 replies
0
None
dmjlambertEduardoK16

Reply 5 months ago

You can intentionally set fuses to unusual values including things like disabling reset or disabling ISP, and then use HV programming to set the fuses back to normal to allow further programming. But if something was done to actually damage the MCU, you probably can't recover from that, and must replace the MCU.

0
None
EduardoK16dmjlambert

Reply 5 months ago

Nevermind i forget to attach one wire. Now after writting the fuses again it worked. Thanks.

0
None
douggorgen

6 months ago

First off, thanks for a great Instructable. With just a few hours work for building and testing, I was able to rescue two Nanos that had their ISP interface bricked due to bad fuse settings. I was even able to rescue them without desoldering anything. I know this is not recommended, but since they were already bricked, I figured I had nothing to lose.

Since I was attempting to rescue them in-circuit, I made a few minor changes to your schematic. First, I changed the 1K resistor inline with the Bricked Nano Reset line to 150 ohms. This was to set up a voltage divider that would put 12 volts on the Reset pin if the supply was 13 volts. The Reset pin has a 1K pullup on the board that is tied to 5 volts. If I had left the 1K resistor in the rescue circuit, then the Bricked Reset pin would only have reached 9 volts ( (12 - 5) / 2 + 5 = 9). Going to 150 ohms with 13 volts on the high voltage supply, would yield approximately 12 volts on the Bricked Reset pin( 5 + (13 - 5) * (1000 / (1000 + 150) = 12 approximately ). As it turned out, the rescue actually worked fine with only a 12 volt supply.

Next, since the XTAL1 pin on the 328P is not brought out to the Nano pins, I needed to manually hold the tip of a wire from the XTAL1 output on the Rescue Nano to the XTAL1 pin on the Bricked Nano's chip pin 7. Pin 7 is the XTAL1 pin on a 328P 32 pin package.

Lastly, I used a slightly diffent level shifter than yours or Mightyohm. I made this using a couple of power Mosfets from my junk box (one N-channel and one P-channel). This level shiter does not drain the 12 volt source when the circuit is in idle. When the not-12v_en signal is high, both transistors are off. See attached drawing.

Thanks again for a great Instructable. (Sorry for the double posting. I'm new to this).

HV Fuse Rescue lowres.jpgLevel Shifter.jpg
0
None
ClausF2

7 months ago

Worked perfect for Atmega8.
I have just recovered fuses to default (low E1 high D9) with success.
Thanks a lot.

0
None
StefanT17

1 year ago

Thank you for your great tutorial that gives me a clue how to reset the fuses of an arduino with HV. I'm trying to rescue an arduino nano with chip on board. I've read your instructions to remove the capacitor and the pull-up resistor. Now I wonder how to connect the target arduino nano. Can you give me a hint?

2 replies
0
None
hakk3rStefanT17

Reply 9 months ago

Locked up my fuses fir 3 of my nanos with a Jtagice3 now I need a HV programmer to clear them. have you figured this out?

0
None
dmjlambertStefanT17

Reply 1 year ago

I have not yet programmed an SMD chip with HV programming, so I don't have experience to guide you. Besides just freeing up the reset lead on the chip, you may also need to remove the connection to the crystal, because I recall that one of the connections you need to make from the programmer to the chip is one of the XTAL pins. You should be able to put a soldering iron on the extra pins you need that are not already available around the perimeter of the board and lift the pin off the trace by inserting an X-acto knife under the pin and lift it carefully. Then solder a flying lead onto that pin. That is a wire that you solder directly to the pin of the chip. I believe you are in for some SMD work and may need a soldering iron with a sharp tip, a magnifying glass, and a steady hand.

0
None
nmohammad

1 year ago

do you have the schematic of the connection? can't really guess from the pictures

1 reply
0
None
dmjlambertnmohammad

Reply 12 months ago

Yes, at the bottom of step 1 is the download of zip file with the sketch and schematic.