Go Down

Topic: What SPI modes should bit-bang SPI support? (Read 2153 times) previous topic - next topic


I am writing a library for fast digital I/O that includes bit-bang I2C and SPI.

What SPI modes, other than mode 0, would be useful?

Here is a definition of modes:

0        0       0
1        0       1
2        1       0
3        1       1

SD cards, the Ethernet shield, and many ADCs and DACs work with mode 0.  Many devices work with both mode 0 and 3.

Are there other devices that require a mode other than mode 0 and would benefit from bit-bang SPI?


Is there a real cost to providing them all?
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


Dec 25, 2011, 01:21 pm Last Edit: Dec 25, 2011, 02:21 pm by fat16lib Reason: 1
There are two problems with lots of options in bit-bang SPI.  The first is to maintain the highest possible speed with options.  There are eight cases for SPI, four modes and MSB first or LSB first.  The second is testing with real devices.

I am starting to understand how to implement the options without impacting speed.

For testing, I only have devices with MSB first and only ones that work with mode zero or three.  I can look at send on a scope but I can't test receive very well.

I think I will implement all cases and warn users about what has been tested with real devices.

Edit: I just found that the DS3234 RTC uses SPI mode one so I now have mode 0, 1, and 3 devices.

Go Up