Bit Banging SPI on Arduino’s FT232RL

The last thing to talk about is receiving. The receive routine was added on as a kind of a last-minute feature. It’s not really been debugged and has only proven to parse the data correctly when the MOSI pin is shorted directly to the MISO pin. This may end up being the wrong parsing for a true transaction, or the wrong parsing for your application.

So… If you’re working with the tool and getting bad receives, take a scope shot and send it to us. Or better yet – feel free to update the source code yourself and send that to us! We’ll post any improvements or bugfixes you guys make with credit to you and a link to your site if you have one.

Get the goods here:

Source Code and Executable for the Openschemes FT232 SPI demo tool

As discussed earlier, it’s a bit of a waste to implement SPI using bit-banging when the Arduino board already has a micro. Additionally, you only get 4 bit bang pins to work with so you’re limited by the Arduino’s setup. For serious bit-banging efforts you will probably want to build or buy a dedicated board with all the bit bang ports available. One low-cost board to consider is SparkFun’s FT232R breakout board, which gives you access to all 8 of the FT232 bit-bangable lines.

SparkFun's FT232RL Breakout Board

Fig 9 – The SparkFun FT232R Breakout Board offers all ports at a low cost

If you’re using the SparkFun (or other) FT232 board, you will need to set your CS, MOSI, MISO, and CLK lines accordingly. The FT232′s bitbang bits are pinned out on the following lines. On the SparkFun board, the pin names are printed on the underside of the PCB.

Bit Pin Name
D7 06 RI
D6 10 DCD
D5 09 DSR
D4 02 DTR
D3 11 CTS
D2 03 RTS
D1 05 RxD
D0 01 TxD

We hope you’ve enjoyed our latest tutorial and it inspires you to bit bang your own projects or protocols. We love hearing about what projects you’re working on, so drop us a line or add a comment with notes on the great things you’re creating. Until next time – Cheers!

This entry was posted in Hacks. Bookmark the permalink.

2 Responses to "Bit Banging SPI on Arduino’s FT232RL"

Leave a reply