Welcome to our third introductory article on bit-banging the FT232 USB chips. Hopefully you have read our first article and second article on this subject, and played around with the example software so you are already a resident expert on USB bit banging.
This will NOT be our last article on the FT232, but it will probably be the last time that we talk about using the FT232R that is populated on the Arduino board. The subject matter for today will be a discussion on implementing the SPI protocol using the FT232 synchronous bit bang mode.
Practically speaking, it is a little silly to bit bang an SPI interface on the Arduino board since the Arduino itself already has a full suite of SPI routines. So look at this article as a general-purpose discussion of implementing SPI with the FT232 bit chip.
Along these lines – The latest software tool starts up with the Arduino’s FT232 pin config already loaded, but it is easy to change any of the SPI signals to other FT232 ports so the tool will run on pretty much any FT232R board you have. But for now, we’ll stick to the 4 spare lines we have on Arduino’s FT232R. We’ll start with a screenshot of the SPI-updated software tool.
Fig 1- The FT232R SPI Bit-Bang Tool
And below, we see the output of the tool when sending an 8-bit, normal polarity transfer of the data “A5″. As a refresher, A5 is 1010 0101 in binary. In the following scope traces, Channel 1 (Yellow) is the CS line, Channel 2 (Blue) is the Data out/MOSI line, and Channel 3 (Purple) is the CLK line.
Fig 2 – FT232 Bit Banged SPI at 1uS per bit
A transfer starts with the CS line going low. Next, data is placed on the MOSI line and the CLK is strobed from low to high to latch the data. You can check the data yourself by looking at each rising edge of CLK. First one is 1, next one is 0, next one is 1… This continues for the number of bits specified in the transfer. Once the last data bit is latched: CS, MOSI, and CLK all return to their inactive states. This protocol should work for standard-polarity SPI as well as simple serial shifts into those 74HC595′s you’re using for your LED projects. Continue on to get more details of how this all works.
Continued on Next Page…