|
|
View previous topic :: View next topic |
Author |
Message |
nader
Joined: 29 Aug 2004 Posts: 12
|
switch between SPI & I2c in software |
Posted: Mon Sep 06, 2004 5:15 am |
|
|
i want use spi & i2c in time .i read datasheet & it wrote that only
one of them can be use at the time.
Can i switch between SPI & I2c in software?
is threre any thing wrong with the device that is i2c when i use spi? |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon Sep 06, 2004 5:30 am |
|
|
The PIC hardware supports only one of either SPI and I2C. The CCS software however contains a good software I2C driver.
So you can use both: SPI in hardware and at the same time I2C in software (ofcourse not on the same i/o pins). |
|
|
Ttelmah Guest
|
Re: switch between SPI & I2c in software |
Posted: Mon Sep 06, 2004 10:44 am |
|
|
nader wrote: | i want use spi & i2c in time .i read datasheet & it wrote that only
one of them can be use at the time.
Can i switch between SPI & I2c in software?
is threre any thing wrong with the device that is i2c when i use spi? |
Technically, there is nothing to stop you switching the hardware in the chip between SPI, and I2C modes, _but_ there are some significant external hardware problems externally. If the chips support a proper 'select' line, so you can ensure only one is listening at a time, then this should be do-able. Otherwise you would have to look through all possible states in each interface, and check these against the data sheets, to see what responses the chips would general. 95% of the possible problems would only lead to data problems, _but_ you have to remember that an I2C slave, can pull the data line low, when extending a transactiion, while on SPI, this line is only ever driven by the master. The potential would then exist for the drivers to be fighting...
Provided you have enough pins, you would be better off, using software I2C, on a seperate pair of pins. This was discussed recently on the forum, and in fine. For instance, I have a 18252, which functions as an SPI slave, using the hardware interface, and controls two other I2C devices using the software interface.
Best Wishes |
|
|
|
|
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
|