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.



Filed under: Microcontrollers


Leave a Reply