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

I2C and SPI on one chip

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
40inD



Joined: 30 Jul 2007
Posts: 112
Location: Moscow, Russia

View user's profile Send private message

I2C and SPI on one chip
PostPosted: Fri Nov 28, 2008 12:50 am     Reply with quote

Is it possible to implement SPI and i2c on one chip? I want to read and write several devices on I2C bus and log data to MMC card. I think that in this case SPI can be software?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Nov 28, 2008 8:50 am     Reply with quote

The MMC card is SPI. It's better to use hardware SPI with it.
Use another pair of general purpose i/o pins to do software i2c for the
i2c chips.

Use setup_spi(), spi_write(), spi_read(), etc., for the hardware SPI.

Use a #use i2c() statement to define the software i2c channel.
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

Re: I2C and SPI on one chip
PostPosted: Fri Nov 28, 2008 10:26 am     Reply with quote

40inD wrote:
Is it possible to implement SPI and i2c on one chip? I want to read and write several devices on I2C bus and log data to MMC card. I think that in this case SPI can be software?


If you have external logic available then they could share a common bus. Use the MMC chip select line to disable the clock line to the I2C bus. When the MMC card is selected no I2C clock is fed to the I2C peripherals.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Franck26



Joined: 29 Dec 2007
Posts: 122
Location: Ireland

View user's profile Send private message

PostPosted: Fri Nov 28, 2008 5:10 pm     Reply with quote

Or you can use a pic with 2 MSSP so you will be able to use the SPI and I2C hardware at the same time.

Good luck,
Franck.
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