Dick Cappels' project pages http://www.projects.cappels.org
return to HOME
ATtiny12 fuse restorer
This restores the fuses in an ATtiny12 via High Voltage Serial Programming.
Plug an ATtiny12 into the 8 pin socket and hold down "GO!" button. The LED will come on at the end of the programming process, which only takes a couple hundred millisecond. The fuses are now restored to their factory default states. This picture was taken before the voltage doubler, made with the 1N916 and 100 uf capacitor were added.
Note for a version that uses the ATTINY2313 instead of the AT90S1200 and shows a PCB layour can be found at http://www.edunet.souepl.cz/~weisz/dokuwiki/doku.php?id=mikroprocesory:attiny12:resetator
A restorer for ATTINY11, 12, 13, 25, 45, and 85 http://www.pe0fko.nl/Fuse-restore/
For an ATmega 48/88/168 http://denki.world3.net/avr_rescue.html
Or you can buy one http://www.microcontrollerprog.com/fuseprog.html
For the details of the programming algorithm, see the Atmel ATtiny12 data sheet. All of the necessary signals are generated by the AT90S1200A . which is clocked by its internal oscillator. If you wan to use an AT90S1200 (non-A) you will have to add a crystal or ceramic resonator and load capacitors. The +12v programming voltage is developed in the switched analog regulator made up of the 2N2907 and the 2N4401 that serves as the error amplifier. +17 Volts to supply the switched analog regulator is generated from a 9 volt power supply, in my case, a 8.4 volt Ni-MH transistor radio battery. The 100 uF capacitor charges to the battery voltage through the 1N916 and the internal circuitry inside the 7805. If you have any doubt the capacitor will charge fully, you can place a 1K resistor from the regulator's input to ground. When the "Go" button is pressed the charged 100 uf capacitor is placed in series with the 9v battery supply and the battery is applied to the 7805, thus providing +5V to the logic and +17 volts to the switched 12V supply simultaneously. Since the +12v is only on for a few milliseconds, the voltage on the capacitor does not droop enough during the programming period for the switched 12 volt regulator to go out of regulation.
The second 2N4401 -the one with the emitter grounded is only there to make sure that pin 1 of the ATtiny12 is pulled to ground when its supposed to be grounded. Note that D9 is set up with a weak pull-up of about 100 uA so that a base resistor is not needed in series with the 2N4401 base. I didn't use a 2N2907 as the PNP in the circuit I built because I have a bunch of similar transistors with a strange part number (if you have a data sheet for a 2NSA1020Y please contact me) so this aspect has not truly been tested, though the circuit was designed for a 2N2907.
ADJUST THE REGULATOR BEFORE YOU PLUG IN THE AT90S1200 OR THE ATtiny12.
1. The AT90S1200 and ATtiny12 sockets must be empy for this procedure. If there are parts in these scokets, remove them before startring this procedure.
2. Temporarily but securely jumper the "Go" button. (Do not try just holding it with your finger because to open and close the button during the procedure might cause excessive voltage to appear in the circuit.
3. Temporarily but securely jumper Pin 11 of the AT90S1200 socket to Pin 20 of the AT90S1200 socket (this puts + 5 volts on the base of the NPN transistor..
4. Apply between +15 and + 20 volts DC to the input of the circuit, by using a bench supply or two 9 volt transistor radio batteries in series.
5. Adjust he 10K pot to obtain + 12 volts DC on pin 1 of the ATtiny12 socket.
6. Seal the pot with fingernail polish or glue.
7. Remove the +15 to + 20 volt power supply.
8. Remove the jumper from Pin 11 of the AT90S1200 socket to pin 20 of the AT90S1200 socket.
9. Remove the jumper across the "GO" button.
My sincere thanks go to Pablo Miguel for finding and helping to correct errors in the above adjustment procedure.
The firmware reprograms the fuses to the factory default values using the High Voltage Serial Programming Algorithim described in the ATtiny11/12 datasheet.
Here is the Assembler source file, as assembeled on AVR Studio 3.x. In case its helpful, here is the hex file. This code can be modified to run on the AT90S2313 instead of the AT90S1200 by including stack initialization right after reset. Adapting to other chips is left as an exercize for the student, and is half the fun.
My thanks go to Peter Dannegger for clearing up an ambiguity in the data sheet.
This device does not verify that the fuses have been reset, so this would be a nice feature (if you add this, please send me a copy of the code). This circuit has a potential reliability risk in that there is a .001 uf capacitor from D4 to ground. Under some situation, such as when the capacitor is being repeatedly charged and discharged by the output pin, I would be concerned with metal migration and would then change the circuit to drive a switching device to control the power to the ATtiny12 socket. Since it will probably take tens of thousands of pulses before I have a problem, and the handmade board is likely to fall apart long before the output pin fails, I decided its a shortcut I can take for a device built for my personal use. In most circumstances it would be unwise to take this shortcut on a commercial product.
Use of information presented on this page is for personal, nonprofit educational
and noncommercial use only. This material (including object files) is copyrighted
by Richard Cappels and may not be republished or used directly for commercial
purposes without explicit permission. For commercial license, click HERE.
Please see the liability disclaimer on the HOME page.
Contents ¬©2002, 2004, 2012 Richard Cappels All Rights Reserved. www.projects.cappels.org/