Programming a microcontroller one bit at a time

Imagine you’re stuck on a desert island, hundreds of miles away from the nearest person, and you finally have time to finish that project you’re working on. You have a single microcontroller, but you’re lacking a computer and you need to program an ATtiny13. How do you do it? [androidruberoid] figured out how to manually flash a microcontroller (Russian, surprisingly good translation) using just three switches and a lot of patience.

[androidruberoid]‘s ATtiny13 – like nearly all Atmel microcontrollers – are programmed using an SPI interface. This interface requires four signals: SCK, a data clock, MOSI, the data line from master to slave, MISO, data from slave to master, and RESET. By connecting these data lines to buttons, [androidruberoid] is able to manually key in new firmware one byte at a time.

This technique of manually programming bits relies on the fact that there is no minimum speed for an SPI interface. In the video after the break, you can see [androidruberoid] manually programming an ATtiny13 with a simple program. It only lights up an LED, but with enough patience he could key in a simple ‘blink a LED’ program.

Comments

  1. slowJim says:

    Very geeky but very cool

  2. ChalkBored says:

    With a little more effort, he could make a card reader.

  3. Bill rowe says:

    Exceptional. I love spi but i would never have thought of this. Debouncing the clock would be critical!

  4. Dave says:

    Now that’s what I call bit-banging(!)

  5. Frank Cohen says:

    This is what McGyver would do.

  6. Alex Rossie says:

    He should have made a simple programmer, bootstrap that shizzle

  7. Eirinn says:

    So basically he finger banged a uC until it lit up?

  8. Coda says:

    One bit at a time, not one byte. SPI is a bitstream.

  9. Philippe says:

    That’s bit-banging… your head on the walls. Imagine if you make a mistake! :-)

  10. willrandship says:

    That’s even more error-prone than punchcards. :P

  11. ferdinand says:

    this is fun but it take a lot of time. to use this techniek or you have no live (even more than a WoW,er)or you in deadrow whit all time

  12. AussieTech says:

    Groovy! +1 (Ah, memories of when the Alpha-16 Mini “blew the boot” and 16 words had to be manually loaded via the front panel switches).

    Not to detract from this sweet hack, but might I respectfully suggest that bit-banging the control lines on a parallel or serial port on an old clunker PC could be more practically (and less frustratingly) employed by slightly less isolated hackers?

  13. Sixten says:

    He needs a Supercoder2000

    http://www.techeblog.com/index.php/tech-gadget/feature-funny-keyboards-supercoder-2000-

    It also reminds me of this Dilbert comic

  14. TacticalNinja says:

    It’s just a matter of interfacing a uC to interpret those signals and you can use just about any device to program a chip. I mean, send data to a bluetooth enabled arduino from an Android to bit bang those data, and you’ve got a wireless portable programmer of some sort.

  15. ApexLogic says:

    He’s on a metaphorical island people. Once he flashes his ATtiny he will proceed to make a coconut radio.

  16. Arm-eee of 1 says:

    Ok so the appropriate upgrade would be a robotic arm that does the bit-banging?
    With appropriate processor, would be an arm for an arm — costing an arm depends on which source one uses :D

  17. saimhe says:

    Now this is a truly DIY-friendly programming interface that makes such things possible. Way to go, Atmel!

  18. RaMu says:

    I made a similar project to this, but I used one pic to program another pic, it has similar working prensip, I have gave my all codes and schematics in microcip site If there were anyone who wanna see or build may look at this link http://www.microchip.com/forums/f162.aspx and if hackaday wants to publish it in the site I may also added a working video of it.

  19. Greenaum says:

    Would be nice to semi-automate the clock line, have 2 buttons, “0” and “1” (made of palm tree leaves), and have the clocking do itself on each keypress. A couple of gates or something could handle that. Then he could put the bits in slightly easier. Tho I suppose it’s not supposed to be easy.

  20. Azariah says:

    Hi I need someone to program me a microcontroller (looks like ATtiny13) running on this board

    http://dx.com/p/8-mode-p7-led-driver-circuit-board-for-flashlight-dc-2-8-4-2v-106799#.UxomUPl_tsg

    or another board here

    http://www.lightscastle.com/product/17mm-2800ma-5-mode-memory-regulated-led-driver-circuit-board-for-flashlight-dc-3~4.5v-530026

    I want to have kind of pulse mode instead of strobe to use with bike light. The matter is I don’t have time to understand programming these chips etc, just wanted to buld some bike lights. I can supply these boards and chips to you and pay for putting code onto them. Can you help?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 96,695 other followers