What exactly does bit banging mean?

ipatch asks:

I recently watched this series of videos on Youtube, and the presenter refers to bit banging in one of the videos. He says specifically he had to bit bang 64MB of RAM in a 16MB window. How is this important, and could the bus pirate have been used for this sort of procedure?

There’s a chip and he has to get data in and out of it with another chip. There are two ways to do it. One is special hardware inside a microcontroller: you give it some data and it automatically moves output/input pins in the right way to talk to the chip. If your controller doesn’t have special hardware, you can write software that moves the pins instead. Software is usually much slower, and it is refereed to as bit banging because code is manipulating (banging) the pins instead of hardware.

It is the method of moving pins up and down, not the data, that differs in bit banging. To bitbang means that you do whatever protocol in software, instead of with specialized hardware.

The Bus Pirate I2C and raw2- and 3- wire modes are all bitbanged, they are done with software routines and not specialized hardware.

Join the Conversation

2 Comments

  1. An older connotation to ‘bit banging’ is something hand-written in assembler and (theoretically, anyway) as fully optimized for performance as possible. Usually reserved for operations that were under very tight time constraints and/or that had to be as fast/efficient as possible.

    As opposed to code written in a higher level language and then compiled.

    So “back in the day” anyway, the difference between “programming” and “bit banging” was the level of abstraction involved…

  2. No, the Bus Pirate cannot be used to bit bang 64 MB of RAM in 16 MB banks. I don’t have an hour to watch that entire YouTube presentation, but he is surely referring to parallel memory if he’s talking about console hacking. RAM would need at least 8 pins for data, 24 pins for the 16 MB address (or maybe 12 pins for row and column if DRAM plus 2 more pins for the row select and column select), 4 bank select pins to build 64 MB from 16 MB, plus 2 pins for the Read/Write timing control. The Bus Pirate does not have 38 I/O pins (or even 28 I/O pins).

    The Bus Pirate excels at serial protocols which have a single bit clock, 1 or 2 data lines, and maybe a word clock. In other words, 1-wire, SPI, I2C, etc. There are quite a lot of modern parts which are serial, especially in today’s compact, portable devices, so the Bus Pirate is quite useful.

    Hacking old school consoles would require parallel connections and therefore many more I/O pins. One such parallel hacking “platform” is the printer port on older PC clones. I’ve never used that one since I had the expansion card bus on the Apple ][, but there are 8 data pins and a number of extra control pins. You could even adapt the Bus Pirate to old school hacking by building an I/O expansion board with 4 or 5 serial-to-parallel 8-bit latch chips and then you’d have 32 to 40 I/O pins. It would be slower to update all of those I/O pins, but it could work.

    Hey, maybe there’s a breakout board idea for the Bus Pirate! The PCB could have room for as many a 8 latches and builders could populate as many latch chips as needed (or as many as they have available).

Leave a comment

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.