Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

spi & i2c

Status
Not open for further replies.

Dr_Doggy

Well-Known Member
I got several slaves that run on I2c and some that run on SPI and others on ESUART.....

but my SPI data input pin is the same pin as the I2C data I/O.......i wont be able to put them both on the same pin will i? The SPI is disabled with SS but will the I2C conflict when i do data on the other?
 
Can you just bitbang the SPI on other pins? Doing it in software is exceedingly trivial and swapping back and forth between hardware I2C and SPI makes bitbanging the SPI seem more of an advantage.
 
As long as these chips you have are supplied with an enable pin of some kind, there is no reason you can't have them all share the same data pin. But you'll have to come up with other processor pins to exercise these enable pins. Most enables are low-true, meaning that the chip is only usable while the ENable (AKA CS) pin is low. So if you have two slave chips, you'll have to use two of your I/O pins to select which you are using at the time. Pull the EN pin low of the chip you want to access and be DAMN sure the other EN pin is high.
BTW, which chips do you have?
HTH
kenjj
 
If the SPI clock and I2C clock are on different pins, then I think it might work. I'd make arrangements to move the SPI data line to another pin and bit bang it. As said before, bit banging SPI is pretty simple. If the I2C and SPI clocks are on the same pin, I'd be worried that when sending SPI data to a SPI device that an I2C device might be like, "HEY THATS MY ADDRESS!!!!" and then hold the data line low as an ACK while you think the processor is still sending out SPI data.
 
As long as these chips you have are supplied with an enable pin of some kind, there is no reason you can't have them all share the same data pin. But you'll have to come up with other processor pins to exercise these enable pins. Most enables are low-true, meaning that the chip is only usable while the ENable (AKA CS) pin is low. So if you have two slave chips, you'll have to use two of your I/O pins to select which you are using at the time. Pull the EN pin low of the chip you want to access and be DAMN sure the other EN pin is high.
BTW, which chips do you have?
HTH
kenjj
 
for now im using an 18f4620, Awesome, thats wat i was worried about but it is the data pin that is the same, so the clocks wont interfere.

thankx everyone for all the help@!
 
Status
Not open for further replies.

Latest threads

Back
Top