On Jul 1, 2012, at 3:42 PM, Tony Duell wrote:
[SPI .vs. I2C]
I use both regularly. SPI is inferior in some
ways, but superior in
I did say 'IMHO' :-).
others. I personally prefer I2C, but there are
situation in which SPI
is a better choice. It is MUCH faster (I2C tops out at 400KHz, I've
One bvious tiem to use SPI is if the chip you want only has an SPI
interfce :-).
seen SPI up in the several-MHz range), and
I2C's transfer size is fixed
True. It depends -- a lot -- on what uou are using it for. Most of the time
I use I2C to transfer small amounts of data to display drivers, low-speed
DACs, etc. It weorks fine for that.
I'm late to this discussion because I've been out of town, but I thought
I'd at least throw my two cents in.
I don't understand why anyone would consider either I2C or SPI "superior"
to the other. They have distinct advantages in certain situations, and
distinct disadvantages in others. In my line of work (and I use both
extensively), I2C is used for low-bandwidth communications with minimal
pin count, and SPI is used for high-bandwidth or low-complexity
communications when you can sacrifice a few pins.
The fact that SPI can be implemented with basically just a few shift
registers (or even just one, if it's write-only) gives it a huge
advantage over I2C when resources are constrained; it's a lot easier
to build an SPI interface out of 74xx parts than it is to build an I2C
one. They also take up a lot less space on an FPGA. :-)
For the wireless sensor mote system I designed (which is really just a
backplane-based computer platform in miniature), I2C is used primarily
for maintenance communication between the processors on the stack, while
SPI is used for most data traffic (radio, most sensors, etc). The design
of the system reflects the constraints the bus gives you; you can have a
theoretical maximum of 127 boards in a system, but you can only have 4
SPI chip selects, so not all boards use the SPI (nor do they need to).
- Dave