Description
In working with 8 or 14 pin Atmel 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).
Features
- 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
Design notes
To minimize 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. 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.
Project fuse setting
avrdude -c usbtiny -p t2313 -V -U lfuse:w:0xe4:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m
Parts list
- attiny2313
- 4x7 segment LED display
- 1k resistor x 2
- 2n2222 NPN transistor or equivalent
- 78L05
- mini breadboard 170 tiepoints
- +12V battery source
Opearation
- 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
breadboard layout
- some components shown above are restricted by drawing software (fritzing), see actual photo, the phyical 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.
schematic
The npn switch transistor has collector and emitter swapped. Please observe that the emitter should be grounded and collector should be connected to the RESET pin of the target device. The following schematic has not been fixed yet.
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 4×7 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
Demonstration Video
Downloads
Source Code (avr-gcc) - download
hex for programming Flash ATtiny2313 - download
hex for programming EEPROM ATtiny2313 - download