Introduction: AVR HVSP Fuse Resetter

Picture of AVR HVSP Fuse Resetter


in working w/ 8 or 14 pin avr devices, i would sometimes want to use the RESET pin as io as the io pin count is low. but doing so will disable further programming via SPI. i do not need a full blown HV programmer, just a way to revert these devices to factory default fuse settings so that i can use SPI to flash them again. it is also handy as sometimes by mistake i may burn wrong fuse value and brick my devices.

this project is created so that if i could revert the RESET fuse change and flash via SPI again. it employs the high-voltage serial programming (hvsp) available for such devices. note that this is not to be confused w/ the high-voltage parallel programming used for 20pin+ devices (i.e. tiny2313, mega8, etc).


* reads device signature and hi-low fuses for hi-voltage serial programmable attinys
* reset hi-low fuses to factory default on target devices
* layout to drop-on attiny13, attiny25/45/85 8 pin devices targets
* attiny24/44/84 targets needs additional breadboard and jumper wires
* standalone operations, fuses values show on 7 segment display
* cannot reset fuse for attiny2313 and atmega devices as they requires hi-voltage parallel programming

Example Operation

Step 1: Design Notes

Picture of Design Notes

design notes

to minimise project component count, the 4 digit led module is directly driven by the 2313's io pins. neither transistors nor current limiting resistors are used. for more detail implementation notes, please see my digital alarm clock project. the led driving takes up 12 io pins (4 digits + 7 segments + decimal point).

for hvsp purpose, we need to have 6 io pins from t 2313. we need to supply 5V Vcc, 12V to RESET, SCI (serial clock input), SII (serial instruction input), SDI (serial data input) and SDO (serial data out). for that we employ the rest of the free io pins from the 2313, plus some io pins are shared between led driving and hvsp control.

one single tactile button is used to accept input, this io pin is shared between button input and led driving.

upon attaching power firmware reads target mcu device signature via AVR's HVSP (High-Voltage Serial Programming) interface. it then look up the device name by matching the device signature. in turn, fuse values (hi, low and extended) are read from device.

fuse values can then be read by pressing the tactile button, which cycles thru device name and various fuse values in hexidecimal format.

pressing and holding the tactile button for about one second will instruct firmware to write the factory default fuse value to the target mcu device. after writing, firmware re-reads the new fuse values for display.

at all times a timer interrupt is used to perform led multiplexing. brightness can only be adjusted by source code change.

i had included the more common device types, source code is provided so that different / additional device can be added to the firmware. please note that only devices with HVSP support can be used.

the circuit requires a main power of 12V supply, a 78L05 voltage regulator brings a 5V Vcc for the 2313 to operate. a 2n2222 is used to switch on 12V towards the target device's RESET pin when HVSP read / writes are being commenced.

Step 2: Parts List

Picture of Parts List

parts list

* attiny2313
* 4x7 segment LED display
* 1k resistor x 2
* 2n2222 NPN transistor or equivalent
* 78L05
* mini breadboard 170 tiepoints
* +12V battery source

project fuse setting

avrdude -c usbtiny -p t2313 -V -U lfuse:w:0xe4:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m

Step 3: Operation

Picture of Operation


* place 8 pin target device on breadboard
* for 14 pin targets, jumper wire to breadboard
* apply 12V power
* display shows device name upon identification
* press and release button to cycle display content
* displays device name, fuse hi bits, fuse low bits and fuse extended bits
* long press and release button to reset fuse to factory default

Step 4: Breadboard Layout and Schematic

Picture of Breadboard Layout and Schematic

[2016-11-29] I had replace the schematic w/ a correct one done by a builder R. Schenk. Thanks R.

* some components shown above are restricted by drawing software (fritzing), see actual photo, the physical layout fits a lot nicer
* the two green pins are to be connected to a 12V power source. i use an A23 12V battery but i can only find a 2xA23 battery holder. you may use whatever is available to you.
* the six red pins are approximate locations for an ISP programmer hookup, you will need to connect the 2nd pin (from left) to pin 1 (RESET, blue wire) of the tiny2313 during programming. in-circuit programming is a hit and miss, as our programming pins are connected to many devices. for the least, you need to remove the led module before attempting to program isp fashion. if fails, you need to remove 2313 and have it programmed off circuit.

Step 5: Assembly

Picture of Assembly

* follow breadboard layout
* place 2313 first, then layout wires
* i use ethernet cat-5 wires, more than one wire can share a single tie-point
* layout tactile button, transistor, voltage regulator and two resistors as directed
* the 4x7 segment led module goes in last, on one side the pins shares the same tie-points that the 2313 also occupies
* since most io pins are share-purposed, you will have trouble programming the 2313 in circuit. i would program it off circuit and put it back on the breadboard

Step 6: Source Code

Picture of Source Code

click to download fuse.c
click to download makefile

i am not detailing the development enviroment here. my setup is avr-gcc under linux. if you have trouble you can also use the following hex files and skip the build

click to download fuse.hex
click to download


LouieZ (author)2016-02-28

Hi there,

Did the wiring based on the source code and also changed the hex assignment of the characters since I'm using common cathode 4x7 segment LED instead of common anode as per suggestion but still can't get it right. In fact, I'm actually wondering how does assigning SEG_D_PD to _BV(7) actually maps it to PA1 in the attiny? This is also true for SEG_d_PD_BV(6) as per definitions. Is there anything else I need to change in the code to match the operation to a common cathode 4x7 seg LED? Looking forward to your insight, thanks!

simpleavr (author)LouieZ2016-02-29

I have unlearned AVR for more than 4 years so I may not be able to help on this old project.

For SEG_D_PD and SEG_d_PD, the comments d.7 maps a.1 and d.6 maps a.0. This is virtual mapping. As shown in the schematic, PORTD 6 and 7 are not connected to the LED module, instead it is PORTA 0 and 1 that connects to segment D and decimal point. I used virtual mapping to simplify the logic and save space. You can see later in the code the porta values are from portd variable....

uint8_t porta = portd >> 6;

portd &= 0x3f;

It should be enough to just comment / uncomment this line

//#define _REVERSE

to change CC or CA led modules.

If you are still not getting anywhere, try and comment out blocks of code until just the display left and see if it can show. You can also write very simple blinky program just to turn on one digit / segment at a time to debug.

LouieZ (author)simpleavr2016-02-29

Hi there :)

Thanks for the quick response! Your explanation about the mapping was very helpful to understand by the code. Also, I tried commenting #define _REVERSE with having the same setup for the characters for common cathode LED but to no avail. I'm only getting the first digit all lit up and pushing the button doesn't light up anything. Pushing it long to reset gives a dash at the last digit. I guess it must be the display problem. Haven't tried commenting other blocks but will try to understand first how to display in LED by debugging it through Blinky. Thanks a lot for your help!

simpleavr (author)LouieZ2016-03-01

Did you set the fuse accordingly? Looks like the multiplexing is not working. It is done by the timer interrupt and since we are not using crystal, the fuse must be set to use internal oscillator (if I remember correctly).

LouieZ (author)simpleavr2016-03-01

Yes I set the fuse as per instruction. In that case, I might have to learn how to fix the multiplexing in the code :)

arkjudy (author)2014-01-15

it is very useful product. what can i do for you. If you need I can provide you with the 7 segment LED digital display. because we are 7 segment LED digital display manufacturer,Wuxi ARK Technology Electronic co.,Ltd. in China .My name is

dzervas (author)2013-12-22


Can I combine the VUSBTiny project with this?
Also, I want to omit the LED display and show the needed data via serial (vusb)
Is this possible?

Thank you.

necko (author)2013-07-06

sorry, I meant Good project.

necko (author)2013-07-06

God project.
Use it to reset ATTINY85 in vusbtiny project.
Left the LED portion out I was not able to get the same LED display with same pinout.
Just insert target and do a long press, remove target and check ATTINY85 with programmer.

lols (author)2013-06-29

If is common cathode how to change, I am a noob in avr.

Wally Ao (author)2012-03-14

Whether the 7 segment led display is common cathode type? The schematic shows
the pin 5 of the 2313 connect to the pin 3 (DP) of the display. Whether it should be connected to the pin 2 (segment D)?

simpleavr (author)Wally Ao2012-03-14

the led is of common cathode type, pinout is the same as the one in this project
looking at the schematic, i understand it is wrong. both the breadboard and the schematic are generated by a very early version of fritzing.
I start out by using the breadboard layout 1st. and it appears to be more correct.
pin 4 (not 5) is actually connected to pin2 of led. since the led module is layout directly on top of the 2313, all pins should be aligned like so
2313 pin 3,4,5,6,7,8 tied to led pin 1,2,3,4,5,6.. and
2313 pin 13,14,15,16,17,18 to led pin 7,8,9,10,11,12

the schematic here is a little bit bigger, but still wrong.

please also compare the pictures and breadboard layout if needed.
guess u are the 1st trying to build this, thinks for your input.

simpleavr (author)simpleavr2012-09-04

the LED are of COMMON ANODE, not common cathode. my bad. I mistake this as most of my led projects uses CC. this one is CA. but u can change the code to use CC. please dig thru the comments to see now.

Wally Ao (author)simpleavr2012-03-29

Dear SimpleAVR,

I have no luck that my fuse resetter didn't work. I have checked many times and would not find out what was wrong. I would like to ask for your help to double check my schematic. The hex file and the eepom file were built by AVRstudio 4 using youe c file without any modification. Thanks in advance.

simpleavr (author)Wally Ao2012-03-30

i haven't touched avr's for > 1yr. now playing w/ msp430.
can't really read out your schematic as it's small.
from the pcb layout everything looks good.
w/ no target mcu attached, the system should show "0000" upon power up. if otherwise. i would check
. 2313 fuse, make sure chip is not locked. is set internal osc, 8mhz, etc.
. use multi-meter, check power to 2313.
. u also rely on the push-button to pass Gnd, check if that's good.
. use diode test setting on your led module, make sure the pin-out is what we want (also cathode / anode), they should light up fadely upon probing.

if that doesn't work, please PM me w/ detail diagnosis results. I will find my project (must be somewhere in my drawers) and trace from there.

* it's also good to try burn a simple led blinker firmware on your 2313 to make sure chip is good and fuse is ok.

Wally Ao (author)simpleavr2012-03-30

Hi SimpleAVR,

I could not find the PM link in instructables nor I would like to contact you here.
. LED module did not light up upon power up.
. HEX code write to MCU is OK. 8MHz and set L fuse 0XE4, H fuse 0XDF, E fuse 0XFF.
. Pin 20 Vcc voltage is 5.05V.
. Push switch checked OK.
. Apply V- to led module pin 12, 9, 8, 6 and V+ to other pins. The module light up normally.
. The voltage of the transistor at B 0.76V at C 0.05V. It should be saturated.

simpleavr (author)Wally Ao2012-03-31

text getting big, i started my response at top, please see.

Wally Ao (author)simpleavr2012-03-31

Many thanks Simpleavr. The hardware problem has been solved. As soon as I swapped the Led module to a common anode type, the resetter was operating.
It reset the Attiny 85 to defaule setting 0x62, 0xDF, 0xFF. But it can not reset
Attiny 25. It read t25, 437d, FF00. I am an AVR programing dummy. Would you please help me to include the resetting of Attiny 25.

simpleavr (author)Wally Ao2012-04-02

i never had a tiny25 to really try it (tiny45/85 all cost the almost the same). but all 25/45/85 have the same spec and i use the same datasheet to workout the timing, instructions etc. so it should work the same.
i think u should 1st try 25 and 85 alternatively a few times and ensure that the problem in the 25 is consistent (may be even try a few 25s if u have more than one).
if result is not consistent (i.e. 25/45/85 all can mess-up), u should try and look at your HV voltage from the transistor switch (I used a 3904, 2222 should work, not really know if the switch time can / will make a difference)
i also had not tried many varieties, i.e. i tried 13, 13v, 44, 45, 85 only. if u had 25a, 25v i don't know they are the same.
u could also try to increase the timing when clocking HVSP instructions.
u can do so by altering the _delay_ms() commands, may be add 10% more to them. it appears that u are reading something for the tiny25 but they are out of sync.
good luck and happy hacking.

Wally Ao (author)simpleavr2012-04-11

Dear simpleavr,

The tiny that I have resetted is Attiny25V-10SU. I found that it was successfully resetted. The problem was I have written the ISP frequeency of the programmer too high at 125KHz. When I reset the ISP at 64.8KHz, the chip can be written as usual. Now, I have tested 13A, 25V, 85V are being resetted successfully.
Thank you very much for your help.

simpleavr (author)2012-03-31

@Wally Ao,

I took out my original build and compare your test results.
. transistor voltage is right.
. correction, the start-up display should be "t00" if not target present.
. same result probing the led module. (multimeter diode test, pin 12,9,8,6 w/ RED probe, BLACK probe on others, segment light up.
. fuse correct.

. i used avrgcc to build, if under windows, try turn off any optimization flags, compiler may "play smart" and optimize some code away.
. if not sure about the cathode / anode, try comment in/out
#define _REVERSE
and see
. may want to comment out the "read_chip()" inside main() and instead do
seg2port(0x12, 0x40); seg2port(0x34, 0x42);
this will force loading and displaying "1234" on led module.
. if physically possible, remove transistor and leave circuit to just led module and try.
. may be write a simple firmware that just blinks a led segment (pin12 + pin11, reversing output every second). just to verify your build and burn procedure.

computurwizard (author)2011-11-07

Can you use an Atmega8 in place of the 2313? Just wondering as I do not have any 2313's on hand :/

Excellent Instructable BTW, thanks for sharing!

simpleavr (author)computurwizard2011-11-09

u will need to change some register and may be relocate the pins according to your schematic / layout. i recall the timer registers is different between the mega device and the tiny devices.
u could try and alter the makefile and change MCU=attiny2313 to MCU=atmega8 and try. fix any error the compiler has for u.
i haven't touch my avr's for many months now. i am spending time w/ ti's msp430 / launchpad.

NickYa (author)2011-08-13

Can it reset Atmega8 or any other Mega?

simpleavr (author)NickYa2011-08-15

@nickya sorry, this one can only do "serial" high-voltage protocol. atmega8 requires a "parallel" HV protocol. this reader / resetter can only do 8 pin or 14 pin AVR attiny devices.