STK200 Pocket Change Programmer

A common complaints of beginners to microcontroller programming is the availability of DIY tools that do not require a parallel port.  Using not much more than a couple of 74xx series chips and some protoboard, [Rue] was able to create an AVR programmer for less than the cost of some chips it can program – giving parallel programmers a run for thier money. [Rue] used Linux treat the ubiquitous PATA/IDE port as a parallel port. By having avrdude treat the programmer as an Atmel STK200, [Rue] was able to upload a blinky program to his AVR microcontroller through ISP. If anybody can think of an even lower cost unconventional solution give us a shout.

48 thoughts on “STK200 Pocket Change Programmer

  1. Fantastic. Especially the part where he fooled Linux into thinking the IDE port was a parport. That was really weird. I was reading through and half expected he had done something to avrdude, so it would do some fancy IDE commands instead of parport talk. This guy has a great understanding of both Linux, PC chipset and hardware in general.

  2. Why not build a serial one and simply get a cheap USB-> rs232 adapter? I mean come on guys this was 10X more work than any of the serial programmer designs, and if you are a hardware hacker of any type you have a serial port.

  3. @fartface: Did you try that yourself? I think you’ll find it doesn’t work or else works very very slowly.

    This is awesome. I wonder if it’ll work through a eSATA to IDE adapter too.

  4. @fartface

    Isn’t the purpose of this site to showcase the ways various users have used hardware for purposes other than they were designed for? Stop knocking his methods of obtaining the end result he was looking for. Move on with your day, and do something constructive.

  5. @fartface: because the USB->serial adapter provides acceptable 5V logic levels, but that’s as much voltage as an USB port can provide; and, AFAIK, most serial or parallel programmers rely on there being 7-10V on some pins of the port they’re connected to.

  6. By the way, can anyone point out some IDE specs with nice register description for PATA PIO mode. Looks like google banned me =).
    I have an old 486dx2 rig with 4 uarts and 3 LPTs and I really want to use all the scrap IDEs I have via soundcards and extension boards.

  7. Nice work by Rue. Not the most direct route ever to make an AVR programmer but still interesting. Extra credit for using IDE as its not often people directly interface to it.

    The original IDE was basically a cut down ISA bus which implemented mainly the IO port functionality and the original parallel port just a couple IO port. You’re only able to do this if you leave the IDE controller in the basic PIO modes which does limit the throughput and cause high CPU usage though.

    Most of the original PC hardware interfaces were just simple extensions of the x86 bus which is why it used to be extremely easy to add custom hardware to your PC. You didn’t need special interface chips like for PCI, PCIe or USB.

    I’ve seen odd hardware attached to PCs and embedded devices which all used the IDE bus to talk to the CPU. The most unusual one I’ve seen is a composite video output board for a car stereo which stored MP3s on a hard disk. The stereo didn’t have any exposed expansion bus so the designer connected it to the secondary IDE port.

  8. @egasimus

    They design a step-up converter circuit into the programmer which generates the higher voltages necessary. You’re not going to get much current out of it but generally most of these devices don’t need that much to program anyway.

    The RS232 spec is that the serial port lines should swing from -12V to 12V and that the receiver should work with a minimum of -3V to 3V. The TTL->RS232 level converter chips like MAX232 give you -10 to 10V. Most modern serial ports are willing to accept a minimum voltage swing of around 0V to ~2V which isn’t standard. Serial ports which don’t follow the specs properly are the reason why sometimes serial devices just don’t work properly on certain machines.

  9. @GotNoTime: Do you have a link to that IDE to composite video device? That sounds very interesting.

    I think fartface might have been referring to the ‘dumb’ serial programmers which typically bit bang the data over DTR/RTS rather than use the UART hardware. Older PICs require +12VPP which might be derived from TXD and as egasimus says, many of the cheaper USB RS232 adapters don’t bother stepping the signals all the way up to 12V. Atmel programmers only require 5V signalling so these might work (if the software can cope with talking to the HAL instead of direct to the IO ports), but as it’s a USB packet per edge (3 per data bit), it’s mega slow.

  10. Nice hack.

    This is probably cheaper than my HUB ISP hack, but it probably all comes down to how much you pay for the chips, building materials, cables and/or USB hub. Then again, if you have “free” computer parts (and wires and building supplies… and time), probably 1 logic chip is cheaper than 3?

    Someday I’m going to revisit HUB ISP and do with with the root hub on the motherboard, and with realtime scheduling so the pulses can be lined up without the 74HC00. Then it’d be just 3 USB cables and 3 resistors!

  11. First I’d like to say this is an awesome hack. I am very impressed that someone managed to use an IDE port in this way.

    But I’d like to ask… why is there so much hate for parallel ports these days? Even if you can’t find a motherboard which already has one I see parallel port expansion cards going for $10 on Ebay and USB ones for as little as $2 including shipping.

    Besides being an easy way to hook up a programmer they are great any time you want 8 input and 8 output lines to/from your PC. It’s an easy way to get PC control without adding a microcontroller in between.

    A bit O/T but I for one don’t like USB solutions because this time it might be ttyUSB0 but next time its plugged in it’s ttyUSB1 and I have to go edit my settings. Also, writing udev rules to fix this just sucks.

    1. Well, back in the day you had to use those interfaces. But why keep them around when you can slap USB, Ethernet and WiFi on basically anything? Which applications do really require you to bitbang directly from the PC to your custom stuff?

  12. @Leif – KC8RWR

    I’ve no idea how it’ll work for Linux but if you’re using FTDI based adapters then use the FT_Prog (Windows based) to program a serial number into it. The default seems to be that the chip doesn’t have a unique USB device serial number assigned. Its a part of the USB spec so should be recognised by any modern OS and helps with keeping the port assignments sane.

    If Linux can recognise that serial number then it should be able to always assign a specific port to a specific adapter (Which may still involve udev but it should be once per adapter)

  13. USB parallel port adapters, for some reason, only work with printers. Probably, one cannot directly access the registers in it. If you want to use a programmer or security dongle or anything of that nature, you need a “real” parallel port in your machine. PCI and PCIe Parallel cards are only $10-20, but PCMCIA and ExpressCard Parallel adapters are a low-volume niche item and will set you back around $100.

    When I got a PCMCIA Parallel card for my laptop, I also had to disable the motherboard’s internal parallel port (which is provided through the docking station connector on the bottom), so the PCMCIA card could use the addresses and appear as LPT1 instead of LPT2 or LPT3.

  14. @mi6_x3m

    The progress is too furious. The ISA bus which also was homebrew-friendly, was similarly murdered almost ten years ago. Last time I looked for a recent motherboard, it didn’t have LPT, there wasn’t even a COM port routed to on-board header (which would require an optional bracket with DE9 plug). But it still had one IDE socket which in my case would be totally unemployed – therefore no problem with PIO mode. When I’ll upgrade in a year or two, the customary ground for these good, dirt cheap, old programmers will vanish.

    Will it? I still haven’t found any promises that USB3 allows software-defined bit-banging at some 40 kHz like a native LPT. There is no revolutionary talk on the FTDI website. Their MPSSE engine isn’t meant to execute my existing crude x86 code that fiddles with ports directly :)

    Now, if there would ever be a way to similarly hack a laptop…

  15. There’s something funny about AVR ISP hacks that really gets some people riled up!

    When I published HUB ISP, I too got several extremely hateful responses. Why I still don’t really understand? The page started with a pretty reasonable explanation it’s only a hack and not intended to replace commercial programmers, and got edited as several people really strongly objected.

    The only rational objection I could see, buried in all that anger, was that a hack is less reliable, slower, or involves more work than buying a ready-made ISP programmer. Or maybe than ready-made ISP programmers are sold so cheaply that even attempting a creative hack is somehow morally wrong? But if the hack doesn’t perform as well as a commercially available off-the-shelf programmer, that where the huge moral objections come into play! It’s as if they hate us because we’re somehow trying to lure naive unsuspecting newbies away from a solid well-performing solution.

    Then again, lots of people did seem to appreciate the creativity and “out of the box” thinking behind AVR ISP hacks.

    For those tiny number of people who get so angry, all I can say is they really ought to find something more worthwhile to worry about. Or perhaps actually do something constructive instead of angrily trashing creative people and ideas. Or get laid….

  16. @tyco

    A few months ago I bought a ExpressCard Parallel adapter for about $50 — the only model offered in our country, wholesalers including. Guess what, it also is printer-only! The main reason: ExpressCard contains USB signals so manufacturers are eagerly exploiting that. Try-before-buy is my only hope but no local retailer is offering that.

  17. @saimhe

    Yeah. The current ExpressCard is PCIe 1x + USB 2.0 together on a connector and the card manufacturer is free to use either connection. The CardBus adapters to insert an ExpressCard card into an old laptop are just USB host controllers and don’t handle the PCIe part at all.

  18. @ Paul:

    Angry replies towards a hack? That is horrible, of all the things you can get angry about…

    @ hack:

    Pretty nifty stuff!

    @ saimhe:

    Thats why I selected this mainboard mostly for the legacy ports it still has. It is a P45 mainboard with a C2Duo on board.

  19. @saimhe
    I got an expresscard parallel port adapter that is NOT usb, and allows bitbanging for about $100 from
    They offer solid products, no-nonsense.
    They are extremely responsive to customer support, and they don’t spam your inbox.
    They do sell the usb type “parallel port” printer adapters (in both usb and expresscard format) But last I checked, they did say upfront that they only work for printers.

    I am not a paid for this, this is just one person’s experience with a good company in a niche market.

  20. For easy (for certain values of easy) interfacing, I’ve had some success with connecting FPGAs to the LPC bus on motherboards. You can tap into it easily on any motherboard that supports an addon TPM as they all seem to be LPC bus based.


    I think your HUB ISP is interesting and a great hack but also crazy :)

  21. As for price, I think I did something close: an EPROM programmer (yes the big ones, with a lens for clearing by UV-light) using a couple of 74xx series shift registers, connected to the keyboard caps-lock LED, via a photo-resistor.
    scroll-lock used for lock signal, and num-lock for the program pulse.

    As for speed, the maximum speed at which the keyboard status LEDs could be send to the keyboard was similar to the maximum bios key repeat rate. Programming a ~4K bootloader took hours, but it worked, and solved the chicken and egg problem of programming microcontrolers using microcontrolers.

    After booting the microcontroler, I dumped its EPROM data over the serial cable, and found a single byte that failed to program correctly. This was fixed by re-programming that single byte.

  22. @GotNoTime

    A nice idea! As I’m against DRM, that header is now empty and will be empty in my future mobos.

    Found the LPC bus specification on Intel website. They talk about some legacy address decoding that allow transactions to be routed to LPC instead of PCI. Which addresses did you use?


    Just.. wow. Among with the photoresistor, that might be even crazier than the HUB ISP.

  23. a few resistors on the parallel port are the cheapest programmer I’ve ever seen on AVR, and it worked. Anyway, parallel port programmers (and certainly this one) are VERY slow to program a chip.

    I respect the challenge but it’s not really a solution for everyday programming.

    Also, for those who think a high voltage is necesary, tell me where you put it on an AVR. AVR can be programmed only with TTL logic levels without any fancy voltage converters like that fu…ing JDM PIC programmer

  24. Isn’t the point that this solves the chicken-and-egg problem? I don’t think it’s meant to be ‘a solution for everyday programming.’
    You could easily use it to program up a mega48 with the usbasp firmware, add a few discretes and an xtal and there you go, a high speed ISP programmer.

  25. @ftorama: 12V goes to the reset pin on an AVR… if you’re programming in HV mode that is. This is completely different from ISP, but it’s the only way to recover if you’ve accidentally touched the RSTDISBL fuse.

    @jwstolk: That’s mental. Love it! Several steps up from attaching toggle switches to each pin.

  26. @B

    that’s the programmer I mentioned above you….and it works ^^


    I hope it’s not a everyday programmer but I’m not sure it’s cheaper than a chinese USB programmer that you can get for 10 dollars on Ebay, for another using comfort.

  27. Cant believe that “modprobe parport_pc io=0x170 irq=none,none,none” just works. I remember reading about ideflasher (google the name for link), IDE EEPROM programmer using 8255 for extra IO lines. It required custom software. Just fooling parport_pc module into using IDE port is so crazy O.o Im really surprised it worked

    ps: HUB ISP is also crazy, I love it :)

  28. Wow, this is really a nice hack. I’ve heard of writing to the ISA bus directly in linux, but I never thought it would be that easy to send data to the ATA ports. If I ever need a high-speed data interface for cheap, I know where I’ll start..

  29. I’m thrilled you all (most all) like this! I’d like to say its NOT really as much about making an isp programmer as siezing usage of the last means of direct cpu io there is on a pc! (and yes, because I can) There are 3 address lines on the pata cable, and 16 data bits, thats ontop of the fact you get a chip select thats already address decoded for you. From a single pata channel, you can do 128 bits of input + 128 of output. AVRs are fully programmable at 5v. Granted, there are few reasons to use this when usb interfaces are as accessable as they are now. Using modprobe was a way around recoding avrdude, which was one of my origional ideas. I would be thrilled if someone tried with with an sata adapter, I can provide minimal schematics and software to set up control of an LED. I love the idea of the keyboard led eprom programmer! I think Model Ms rock. I was not able to get an 8255 to work on the pata bus, I suspect its cause they are only 5Mhz bus rated. I’m assembling an ata->PWM+DIR+ for controlling the lawn mowing robot I’m building from a disability scooter ;) I too loved the hub-isp project.

  30. This guy just needs to admit that this wasn’t about saving money, since time is money, and he obviously has a lot of time in to this. Programmers are so damn cheap to build. You can’t justify this monstrosity. No way!

  31. @Jake

    Unique hacks are based on lots of trial and error, therefore cost a lot more than simply reproducing them. Everything up to the final solution can be classified as research, which is always costly.

    Now everybody can build a programmer from few common parts and in rather short time — again. The days where such a simple task as programming a bootloader will require significant investment were just postponed for another few years. That justifies all the effort.

    Indeed, building a programmer on top of a FTDI-based RS232 adapter (when you don’t own one yet) will cost more.

  32. This hack works because both a parallel port and IDE interface are little more than extensions of the ISA bus. Reloading the parallel port driver at the IDE I/O address range is clever, as it allows the unmodified parallel port driver code to use the IDE pins and a few chips as a parallel port.

    So no, this would not work through any sort of adapters (USB or eSATA to IDE).

    Quite a nice hack all together!

  33. Amazing. Especially the part where Linux was fooled into thinking the IDE port was a parport. That was really perlexing of course. I was reading through and kind of expected he had done something to avrdude.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.