ATtiny85 Fuse Restorer and Memory Erase Tool
Have
you 'bricked' your ATtiny85? Did you accidentally set the Lock fuses?
Do you need to reset your ATtiny85 fuses before you can reprogram the
flash and EEPROM memory? Here's a low-cost easy to build tool to
restore the memory and fuses of an ATtiny13, ATtiny25, ATtiny45 or
ATtiny85 back to factory default condition. It doesn't require a
collection of power supplies or a special battery or an LCD. One
pushbutton does the job! 
Introduction
A
number of my ATtiny85-based designs make use of all 8 pins on the chip.
This requires the internal ‘fuses’ in the ATtiny85 to be programmed
such that the function of Pin 1 changes from its factory-default
"Reset" input mode into a semi-standard I/O pin mode.
Figure 1 : My prototype CEFR uses a single-sided PCB along
with a small handful of cheap widely available parts
However,
if I need to change the software programmed in that chip at some later
date, those fuses must first be changed in order to return Pin 1 to its
original "Reset" mode. But that’s not possible because Pin 1 no longer
has the necessary Reset functionality to allow it to be done! It’s a
“Catch-22” situation.
For those unfamiliar with the term, a
"Catch-22" situation is one where you are trapped by two
contradictory conditions. For example, if you are looking for your
first job and all the job adverts say you need work experience. But to
get work experience, you need to have had a job! The term comes
from the famous book of the same name written by Joseph Heller in 1961.
Reprogramming Options
Fortunately, there is a way around this problem! It requires a specialized High Voltage Serial Programmer (HVSP) or a less complex HVSP fuse resetting tool.
These use a short pulse of +12V along with a specialized serial
signaling protocol carried over four pins on the affected chip to
restore those fuse bits.
I
realized that builders of my SugarCube VFOs, for example, would
probably require one of these to allow them to calibrate the Si5351a
frequency or to reprogram the frequencies and settings in the EEPROM
for the SC+4, SC+16 or SC+99 channel-based SugarCube designs.These
can be relatively expensive to buy. Since most users might only require
such a device perhaps once every few years, or maybe only once, it’s
very hard to justify such a purchase.
One way to solve this problem is to build a less complex HVSP fuse resetting device. These
‘fuse resetters’ are used to restore a 'bricked' chip which no longer responds
to a low cost programmer like the USBasp due to incorrect fuse settings including incorrect clock settings. Most such DIY designs are reasonably cheap to make.
Existing DIY Fuse Resetter Designs
I
thought I would simply create a link to an existing design and the job
would be done. Unfortunately, as I searched for a suitable design, most
of those I found seemed to have limited functionality or features that
were completely unnecessary or were difficult to use.
For
example, while many of these simple fuse reset tools could (usually)
reset the “bricked” chip’s fuses back to the original factory default
setting, many could not reset chips where the user had accidentally
programmed the Memory Lock fuses. Lock fuses are used to prevent
copying of software.
In order to restore those chips, it
is first necessary to erase the chip’s flash memory. This can also
result in the chip’s EEPROM being erased, by the way. Once that’s
done, the fuses can finally be restored. Relatively few DIY fuse
restorer designs published could do this yet, to my mind, that’s an
essential requirement.
Most
designs I encountered also required either a small 12VDC power supply,
or a 9V battery, or a combination of 12V and 5V power supplies. Such
arrangements are not always available or very convenient. It's fairly
easy to mix up these two power supplies with unfortunate and generally
destructive consequences.
A few designs also featured LCD
displays. These prompt the user on each step required to restore the
target AVR chip. They also display fuse settings before and after the
process. Some designs featured additional jumper settings ehich allowed
the user to restore fuses to specific non-factory-default settings.
All
of these features are rarely required in a device that only ever really
needs to do just one job – Restore the chip back to it’s
factory-default condition with fuses reset and memory erased.
Finally,
a further problem I routinely discovered was that the required software
for these designs was often only available in the form of a C-language
source file requiring compiling before it was ready to use. I'm not a
fan of C. I don't read Swahili or ancient Cuniform either, both
being orders of magnitude clearer and easier to understand.
Yes, it was a case of having to design and build one myself.
Description
Here
is my version of a Chip Eraser and Fuse Resetting tool (CEFR). It
focuses on doing just that one task. It has a red LED to show when
power is connected, a single pushbutton (‘START’) to do the job, and a
green LED to indicate the result.
It runs from a standard USB port or 5V USB ‘wall-wart’ power supply.
That’s it. Nothing difficult, expensive or hard to find.
A
low cost ATtiny2313 lies at the heart of the CEFR. It turns the various
power supply rails to the target device on and off, handles the HVSP
signaling protocol required with the target chip, and indicates the
result to the user with a simple green LED. The LED turns on
continuously (for about 20 seconds) to indicate success, or it blinks
briefly to indicate failure.
Everything
is operated from a USB 5V power supply. The PCB’s USB Type-B female
connector allows, for example, a spare printer cable to be used to
connect the CEFR to either a spare port on a nearby laptop or computer,
or to a standard USB-type ‘wall wart’.
A 12V low
current supply is required for the HVSP erase/fuse-reset process. Other
fuse restorer designs use special boost converter chips such as the
legacy MC34063, or parts like the MAX606, LT3464 or MT3608. However,
such chips are not always easy to obtain. I never seem to have the
right one in my parts bin. They can be costly, too.
To
avoid that problem, this design uses some commonly available
inexpensive discrete components to form a boost converter to generate
12V on the PCB.
A momentary START pushbutton controls the
device, and a pair of LEDs provide indications to the user about power
and operation. Press it briefly to erase the chip memory and
restore the fuses. All quite simple.
Schematic Details
Figure 2 shows the schematic for the CEFR.
Figure 2 : Schematic of the Chip Eraser and Fuse Restorer
The arrival of 5V from the USB connector is indicated with the red LED (D4).
The
majority of parts are used in the 5V to 12V boost converter. These are
all the parts around Q2, Q3 and Q4. Q2 is the main boost converter
switching device, turning on and off as a result of the feedback
provided by C3, Q4 and resistors R6 and R7. L1, an inexpensive 100uH
choke, boosts the incoming 5V rail via diode D2, a readily available
1N4148. The rectified output voltage is stored by C4.
The
boosted voltage is detected using a small 400mW 12V Zener diode D3
which turns on and off Q2 via its base-emitter junction. Q2, in turn,
controls the Q3/Q4 oscillator on/off ratio to keep the output of the
boost converter close to 12V.
This little boost converter is
not only surprisingly efficient, but it also achieves a very fast
turn-on time to give +12V in less than 5mS after the 5V supply is
applied.
The ATtiny2313 (IC1) switches this voltage supply
on and off to the Reset pin (Pin 1) of the target ATtiny85 via Q1. IC1
also turns on and off the 5V supply to the target chip (IC2), and
handles the signalling protocol for erasing and fuse reseting via four
further I/O lines (SCI, SDO, SII and SDI). A detailed description of
the protocol can be found in every AVR processor datasheet.
Finally, the result of the whole process is signaled to the user via the green LED (D1).
Construction
To
simplify building the CEFR, a single-sided PCB measuring 85 x 35 mm
(3.3” x 1.3”) has been designed for the unit. The overlay is shown in
Figure 3. A smaller PCB is possible, but this single-sided PCB layout
makes it easy to make the PCB at home. It also provides plenty of space
for the various components making it easier to build.
Figure 3 : The CEFR can be built using this single-sided PCB layout
which is available for in the Downloads section below
IC
sockets are used for IC1 and IC2. If your CEFR is likely to be used
frequently, then a “machine screw” IC socket is recommended for IC2.
That's the IC socket for the chip to be erased and restored. The price
difference between these higher quality 8-pin sockets and the least
expensive types is minimal. Similarly, if you are making one of these
for use
by an amateur radio club who are making a number of my SC+ VFOs,
then fitting an 8-pin DIL ZIF (zero insertion force) socket may be an
even better choice.
Build the boost converter section first and test it before going further. Once you've verified you have 12V (i.e. 11.5 - 12.5V) on the test point (TP), then
fit the sockets for IC1 and IC2, the two LEDs and related parts, and
the Start switch. Then complete the remainder of the PCB
construction.
Note the two wire links must be fitted. They are just below and run parallel to IC1
Software
The
ATtiny2313 should be programmed using the HEX file available in the
Download section below. This has been adapted from a variety of
existing software from other designs including those of Peter Fleury, Dick Cappel, Uri Shaked and PE0FKO.
The fuse settings for the ATtiny2313 (IC1) are:
LOW: &h64 HIGH: &hDF EXT’D: &hFF
These
are also the default fuse settings for an ATtiny2313 (8MHz internal RC
clock, Clock divided by 8) so it's quite possible you may not need to
program those fuses at all.
Operation
- Insert the ATtiny85 to be erased and restored into the TARGET 8-pin socket (IC2)
- Connect
USB power to J1 (Use a standard USB printer cable, for example, between
J1 and a USB port on a computer or 5V USB wall-wart power supply)
- Check the POWER LED (Red) is on
- Press the START button briefly
- The
STATUS (Green) LED should turn on and stay on (for about 20 seconds) to
indicate success, or it will blink slowly to indicate a problem
- Disconnect the power from J1
- Remove the ATtiny85 from the Target socket.
If the CEFR process was successful, the target ATtiny85 is now erased and ready for reprogramming with your usual programmer.
Downloads
Software: Click here to download the ZIP file containing the HEX file for programming of your ATtiny2313
PCB Layout: The Gerber files and JPG negative file are available here for the PCB.
Want to go back to the main page? Click
here to
return directly.