CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Can I mix I2C and SPI using hardware SCL, SDA, SDO

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Joe EE
Guest







Can I mix I2C and SPI using hardware SCL, SDA, SDO
PostPosted: Wed Jan 22, 2003 11:51 am     Reply with quote

Just to save on pins this would seem to be possible.

But scanning the message board the impression I got was
maybe it is not.

It seems to me that since SPI requires an additional CS line,
which I would allow for, that I could init for I2C comunications
do that, then un-init or re-init for SPI and then switch to
SPI while both would share the SCL and SDA lines, (SDO only
used by SPI)

Lets just say my favorite 12 bit ADC uses SPI but I also desire
to use I2C for a serial eeprom.

As a fall back position:

It looks like I could use software I2C - It appears that the
CCS compiler gives you a choice of hardware I2C or software
I2C where the software I2C could use pins other than the
dedicated SCL and SDA, is this true ??

Best regards,

Joe
___________________________
This message was ported from CCS's old forum
Original Post ID: 10892
Felix Althaus



Joined: 09 Sep 2003
Posts: 67
Location: Winterthur, Switzerland

View user's profile Send private message

Re: Can I mix I2C and SPI using hardware SCL, SDA, SDO
PostPosted: Wed Jan 22, 2003 12:43 pm     Reply with quote

:=Lets just say my favorite 12 bit ADC uses SPI but I also desire
:=to use I2C for a serial eeprom.
:=
:=As a fall back position:
:=
:=It looks like I could use software I2C - It appears that the
:=CCS compiler gives you a choice of hardware I2C or software
:=I2C where the software I2C could use pins other than the
:=dedicated SCL and SDA, is this true ??

A few time ago I tried to connect a SPI ADC and a ser.EEPROM to the same address and data lines. I had to use a separate CS line for the ADC. But with software I2C and hand-build SPI code it did work.

mfg
Felix
___________________________
This message was ported from CCS's old forum
Original Post ID: 10893
Joe EE
Guest







Re: Can I mix I2C and SPI using hardware SCL, SDA, SDO
PostPosted: Thu Jan 23, 2003 9:44 am     Reply with quote

According to Microchip applications Engineering:

QUOTE:

You can have I2C and SPI connections to a PIC if the lines are not shared.If you share the bus lines with the I2C bus as with the SPI bus, then the I2C devices will become confused when you transmit SPI data. The SS line prevents the SPI devices from getting I2C data, but the I2C devices have no such protection. As long as one of these is done in software and the buses
are not merged together, this sort of thing usually works fine. If you had 2 MSSP ports and connected one type to each port, it would also work, but at this time we do not make a device with 2 MSSP ports.

One other quick note, consider migrating to a PIC16F877A, its newer, lower cost and has comparators added as well. If you need to turn of the comparators, write to the CMCON register (its much like writing to ADCON1). Note that if you migrate, it is recommended that you requalify the design for the new device.

:UN-QUOTE


:=:=Lets just say my favorite 12 bit ADC uses SPI but I also desire
:=:=to use I2C for a serial eeprom.
:=:=
:=:=As a fall back position:
:=:=
:=:=It looks like I could use software I2C - It appears that the
:=:=CCS compiler gives you a choice of hardware I2C or software
:=:=I2C where the software I2C could use pins other than the
:=:=dedicated SCL and SDA, is this true ??
:=
:=A few time ago I tried to connect a SPI ADC and a ser.EEPROM to the same address and data lines. I had to use a separate CS line for the ADC. But with software I2C and hand-build SPI code it did work.
:=
:=mfg
:=Felix
___________________________
This message was ported from CCS's old forum
Original Post ID: 10933
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group