I worry about the SDI/SDA line. With SPI, this pin must always be
input. Does the I2C lib change the direction of this pin?
The SPI lib does not set the pin direction within the init procedure,
the user must do it.
There is also the SSPSTAT register to worry about, so maybe a call to
the init procedures before switching would solve these problems. I
would like to find a proper solution for this as well. Any Idea's?
Matt
I was thinking about doing this a few months ago to save pins. I did
not bother to test this because on my pic 18f452, they will have to
share the pin RC3/SCK/SCL and RC4/SDI/SDA. Sharing the clock line (SCK/
SCL) should be ok since the direction is always an output.
I worry about the SDI/SDA line. With SPI, this pin must always be
input. Does the I2C lib change the direction of this pin?
The SPI lib does not set the pin direction within the init procedure,
the user must do it.
There is also the SSPSTAT register to worry about, so maybe a call to
the init procedures before switching would solve these problems. I
would like to find a proper solution for this as well. Any Idea's?
Matt
On Mar 9, 3:16 am, vasile surducan <vsurdu...@gmail.com> wrote:
> Hi all,
>
> It's been a long time since I used both SPI and I2C from MSSP. As far I
> remember there is no issue using alternately SPI and I2C as long the unused
> device on the bus is highZ.
> Does anyone tested this recently on PIC18 ?
>
> thx,
> Vasile
--
You received this message because you are subscribed to the Google Groups "jallib" group.
To post to this group, send email to jal...@googlegroups.com.
To unsubscribe from this group, send email to jallib+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jallib?hl=en.
Yes, this is true for SD Cards. The CS pin should be disabled on the
SD card before using the SPI port for anything else (in this case, the
MSSP port). If the sd card CS line is still active when sending via
I2C, the sd card may pick up some data. You could accidently write to
the SD card. Some SPI divices allow the CS line to be disabled during
a data transfer, such as sram_23k256.
As stated in the SD card lib, you must finnish your your sd card
transfer before changing the CS pin. So, this must be handled in your
code. Do sd_stop_read() before using MSSP for another purpose.
Matt.
2010/3/9 vasile surducan <vsur...@gmail.com>:
> Hi all,
> It's been a long time since I used both SPI and I2C from MSSP. As far I
> remember there is no issue using alternately SPI and I2C as long the unused
> device on the bus is highZ.
Why not use software i2c, on other pins?
Joep
Joep
Matt.
However if you gate the I2C clock line with the CS of the SDI device,
(using AND gate or 1/4 4066) then the I2C will not see any clocks
while the CS is low to enable the SD card.
You can even make gate from two Schottky diodes from pull up resistor
of I2C slave device clock pin to SCLK and SD card /CS if it is low to
active SD card.
2010/3/12 Mike@watty <watt...@gmail.com>:
>
>
> However if you gate the I2C clock line with the CS of the SDI device,
> (using AND gate or 1/4 4066) then the I2C will not see any clocks
> while the CS is low to enable the SD card.
>
> You can even make gate from two Schottky diodes from pull up resistor
> of I2C slave device clock pin to SCLK and SD card /CS if it is low to
> active SD card.
>
Matt is right and solving is not as straight forward as this, since
both clock and data are bidirectional in i2c. If you can spare one
pin, I'd suggest you use that as a dedicated i2c clk pin. i2c data can
be one of the pins that is output when used with spi. If you don't
have a spare pin or insist on use hardware i2c, use a 'gate' like 4066
to keep the i2c clk high during spi operation.
Joep
Joep
Will I2c change this pin to an input?
Matt.
Joep
I think another issue is that if a SPI device is in use, it will be
sending data to the pic on the SDI line, and at the same time, the clk
line will be running. If this occurs, I2C devices could pickup the
signal if addressed accidently via SDI.
So, maybe it's not possible to
use both on the same pins.
Matt.
--