Pages: [1]   Go Down
Author Topic: What SPI modes should bit-bang SPI support?  (Read 1490 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Edison Member
*
Karma: 44
Posts: 1476
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
Quote
Mode  CPOL  CPHA
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?
Logged

0
Offline Offline
Shannon Member
****
Karma: 161
Posts: 10446
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is there a real cost to providing them all?
Logged

[ I won't respond to messages, use the forum please ]

0
Offline Offline
Edison Member
*
Karma: 44
Posts: 1476
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: December 25, 2011, 08:21:41 am by fat16lib » Logged

Pages: [1]   Go Up
Jump to: