2008-05-03

ATtiny High Voltage Programmer

This project was meant to be a quick hack to unbrick an ATtiny13 I stuffed up performing an ill-advised programming kludge upon. It actually ended up taking me all damn day to debug the programmer hardware... Initially I thought I had software problems, but it turned out to be clock bounce from the cabling causing me grief.

I was too lazy to make the trip downstairs to get my Win32 laptop and look at the waveforms using my USB DSO, even when I eventually strongly suspected this was the cause. My laziness probably cost me hours of frustration, but I blindly added an RC low-pass in the clock line and everything started magically working. Don't you just hate that! Especially after you've spent most of the day wondering if the datasheet is wrong. (The ATtiny13 datasheet version I have actually does have several other errors I've noticed, but apart from a redundant address bit for reading the OSCCAL it appears the HVS protocol table is correct.)

HV Programmer Lash-up

Anyway, the programmer has some switching to control Vpp and Vcc via a few data pins on the PC parallel port, the rest of the signals are directly bit banged, with the exception of the SDO pin, which has a pull-down for the initial HV-programming mode assertion. I depended upon the status line pull-up in the parallel port, supplying none externally.

Adventures also included smoking a 2N7000 accidentally when I shorted out the drain resistor with the multimeter probe and the PNP above it delivered the full current the PSU's 4000 uF of storage at 15 volts could deliver through the EB diode drop. The 2N3906 was unharmed surprisingly, but the 2N7000 explosion was quite spectacular. Naturally this didn't help my frustration level with the project! I was almost about to give up and just dig another ATtiny13 out of the rail from Futurlec when that happened.

Some moments of desperation caused me to build a LED on 8-pin IC socket jig to physically watch the logic levels change at a very slowed down rate and verify my code wasn't completely wrong:

Pin State Display Jig

The code is very basic, it just reads all the fuses out of the device and then blindly does a chip erase and sets the fuses back to the factory default. It expects to be run in Linux with /dev/parport0 being the interface to use. Calling it "rescue-attiny13.c" might be more appropriate than "hv-programmer.c". In the end it worked nicely and unbricked my device - I was happy.

I should probably build this as a permanent circuit and finish the code, adding argument parsing and other niceties. I don't think I'll bother implementing flash/eeprom read/write, once you've fixed the fuses you can use SPI to do that. You can always use this programmer just to un-bugger a device you've bricked.

3 comments.

Attachments

title type size
The Circuit Diagram image/jpeg 64.603 kbytes