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.
27 thoughts on “Programming A Microcontroller One Bit At A Time”
Very geeky but very cool
With a little more effort, he could make a card reader.
Exceptional. I love spi but i would never have thought of this. Debouncing the clock would be critical!
The big chip is what he uses to debounce the buttons, its a SR latch. The tiny chip on the RHS side of the bread board is the ATTiny itslef.
Now that’s what I call bit-banging(!)
This is what McGyver would do.
He should have made a simple programmer, bootstrap that shizzle
So basically he finger banged a uC until it lit up?
One bit at a time, not one byte. SPI is a bitstream.
Nevermind, you got the title right.
That’s bit-banging… your head on the walls. Imagine if you make a mistake! :-)
That’s even more error-prone than punchcards. :P
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
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?
That would be bit banged SPI.. which is easy to do (Linux has drivers for bit banged SPI master).
Several non-mcu based programmers exist that employ this approach.
He needs a Supercoder2000
It also reminds me of this Dilbert comic
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.
He’s on a metaphorical island people. Once he flashes his ATtiny he will proceed to make a coconut radio.
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
I dunno man, I bet you could automate this a lot cheaper using solenoids… XD
Now this is a truly DIY-friendly programming interface that makes such things possible. Way to go, Atmel!
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.
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.
Hi I need someone to program me a microcontroller (looks like ATtiny13) running on this board
or another board here
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?
Please be kind and respectful to help make the comments section excellent. (Comment Policy)