View previous topic :: View next topic |
Author |
Message |
40inD
Joined: 30 Jul 2007 Posts: 112 Location: Moscow, Russia
|
I2C and SPI on one chip |
Posted: Fri Nov 28, 2008 12:50 am |
|
|
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
|
|
Posted: Fri Nov 28, 2008 8:50 am |
|
|
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: 1635 Location: Perth, Australia
|
Re: I2C and SPI on one chip |
Posted: Fri Nov 28, 2008 10:26 am |
|
|
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
|
|
Posted: Fri Nov 28, 2008 5:10 pm |
|
|
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. |
|
|
|