Bit Banging SPI on Arduino’s FT232RL


The next section of the tool deals with the actual data to be transmitted/received. Your options are Data Length and MSB First/LSB First. Data Length should be pretty self explanatory – do you want to send 4 bits, 8, 16, 24? Please note that long transmissions will get fragmented by the USB subsystem. It should still work fine (the SPI chip doesn’t care!) but the scope shot will be ugly with pauses stuck in there randomly. It will not interfere with the transmission because the pins will stay in their present state during the pause.

Obviously, your data out length should match with the transmission length – 4 bit expects one hex char, 8-bit expects two, and so on. Running a 24 bit send with only one byte in the Data Out box will send two bytes worth of 0, then your expected byte. Sometimes that sort of action is needed, so that’s why it was implemented this way. Here’s a shot of a standard 16-bit transaction sending $AA55 (1010 1010 0101 0101)


Bit Banged 16 bit SPI sending $AA55


Fig 6 – 16-bit SPI Transaction Sending $AA55


The last config item is data order: Sending MSB first or MSB last. This works pretty much as you expect it to – you can see the effect in the scope shots below, where the byte $80 (1000 0000) is sent using standard polarity with both normal and reverse data order. In one case, the logic high appears on the first clock, and in the second case the logic high appears on the last clock. Got it? Killer.


SPI send of $80 with normal bit order SPI Send of $80 with reverse bit order

Fig 7 & 8 – SPI Send of $80 (1000 0000) with normal and reverse bit order


Continued on Next Page…

This entry was posted in Hacks. Bookmark the permalink.

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

Leave a reply