Searching \ for '[OT] I2C vs. SPI question' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: piclist.com/techref/i2cs.htm?key=i2c
Search entire site for: 'I2C vs. SPI question'.

Exact match. Not showing close matches.
PICList Thread
'[OT] I2C vs. SPI question'
1999\09\28@165449 by Nick Taylor

picon face
Hello All:

I use the 68HC11 and PICs at the hobbyist level and want to move
from RS-232 to either I2C or SPI for serial comm. between devices.
I've been playing with using I2C with a Microchip 2LC01 with good
results, but would like some input about deciding on I2C or SPI
as my "standard" method.  Obviously the I2C is a 2-wire interface,
and SPI is 3-wire.

I'm looking for input, advice, ideas, etc. in these areas:  ease
of coding (I've only been doing assembler on these MCUs for a few
months), reliability, noise immunity, code size, availability of
compatible devices, system limitations, and anything else that might
be pertinent.

Thanks,
- Nick -

1999\09\29@121755 by Barry King

flavicon
face
Nick Wrote:

> I use the 68HC11 and PICs at the hobbyist level and want to move
> from RS-232 to either I2C or SPI for serial comm. between devices.

Why?  Given that the devices have a common ground, one way
comms is one wire, two way is two wires with serial.  And is dead
easy to debug becuase you can tap it with an unmodified PC and
minimal hardware.

If you've more than two devices on the bus, THEN serial is more
complex, and the arbitration and addressing of I2C are great.

> I've been playing with using I2C with a Microchip 2LC01 with good
> results, but would like some input about deciding on I2C or SPI
> as my "standard" method.  Obviously the I2C is a 2-wire interface,
> and SPI is 3-wire.

And that third wire is the select, which implies a wire PER DEVICE
to a master which puts them on and off the SPI.

> I'm looking for input, advice, ideas, etc. in these areas:  ease
> of coding (I've only been doing assembler on these MCUs for a few
> months),
Doesn't the HC11 have built in SPI support?  That plus the (at least
3/4 vast) support for SPI in the mid-range PICs might make your
code simpler.

I've not used SPI myself, I decided to go the I2C route so I could do
a complex multi-master bus without additional wires.

> reliability, noise immunity,
Both SPI and I2C are intended for very short run inside some piece
of equipment, preferably on one PCB.  On I2C, the noise immunity
is sensitive to good engineering tradeoffs on power, pull up resistor
values, and bus capacitance, and speed.

I'm using the slow, low power, 5V swing mode myself.  I've not seen
any bus problems except the ones I cause by shorting the bus with
tweezers to test my error handling!

>code size
A good bullet-proof master I2C implementation for the PIC is hard.
My boss has paid me a lot to do the driver were using now.

I hear that the App Note code is pretty good, though, so for hobby
level reliability, that might be OK.  Maybe someone using the App
Note I2C code could comment

> availability of compatible devices

Seems to be manufacturer dependant.  The auto industry seems to
love Motorola, and therefore SPI, so parts attractive to them often
appear first in SPI models.  Serial Flash memory is an example.

I don't know for sure but it seems that SPI is a wider line than for
I2C.

That's my 2 cents.

------------
Barry King, KA1NLH
Engineering Manager
NRG Systems "Measuring the Wind's Energy"
Hinesburg, Vermont, USA
http://www.nrgsystems.com

1999\09\29@160603 by Paul Brown

flavicon
face
I have also been considering I2C vs SPI.

>> reliability, noise immunity,
>Both SPI and I2C are intended for very short run inside some piece
>of equipment, preferably on one PCB.  On I2C, the noise immunity
>is sensitive to good engineering tradeoffs on power, pull up resistor
>values, and bus capacitance, and speed.

I'd like to connect a string of 5-10 PICs together over a distance of about
5 feet.  There will be connectors on the cable between the PICs.  The cable
will be going past 5-10 small (1" dia) brushless DC motors.  I was
considering I2C because of the addressing, etc. built into the protocol.  I
want to use as few wires as possible, so I didn't want to run the SPI
enable wires.  What are the chances I2C will work in this application?

>A good bullet-proof master I2C implementation for the PIC is hard.
>My boss has paid me a lot to do the driver were using now.

>I hear that the App Note code is pretty good, though, so for hobby
>level reliability, that might be OK.  Maybe someone using the App
>Note I2C code could comment

I am using mid range PICs of the 16F87x variety.  I have heard from several
sources that agree with the above sentiment.  However, the datasheet for
these devices claims that I2C is fully implemented (it doesn't make such a
claim for the 16C7x chips).  Will these new features make the Master I2C
implementation easier, or will have to spend a serious amount of effort
just to implement it?

Paul A. Brown

More... (looser matching)
- Last day of these posts
- In 1999 , 2000 only
- Today
- New search...