SPI and I2C protocols...

Status
Not open for further replies.

martinisonline

Member level 2
Joined
Apr 24, 2005
Messages
47
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
Portugal
Activity points
1,792
Some questions about these protocols:

It is possible to connect 2 diferent devices on the same line SPI or I²C?

It is possible to work with both the protocols with 16F877A on the same circuit, connecting to diferent devices?

The figure shows my idea. IC1, IC2, IC3, IC4, IC5 are diferent devices...
 

Not sure if you can connect more than one device on spi.
But I do know you can on I2C
You can research the subject more at this web site **broken link removed**

Philips invinted the I2C protocol
 

On both interfaces you can connect more than one "slave" device (see pictures below) ..
The difference is that in SPI each slave device requires a dedicated Slave Select (SS) signal, which is created by the master using standard I/O pins ..

The other thing is that you have to solve the problem with priority, otherwise you will start "loosing" bytes; in other words you should not try to transmit and receive data through both interfaces at the same time ..

Regards,
IanP
 
Thanks about your answers.

IanP, it's all that...

Just a few question:

The pic 16F877A use the same pin (RC4) SDA to (I2C) and SDI to (SPI). It is possible to use both the interfaces, not simultaneously, but sequencialy?
 

It may be tricky to re-configure from I2C to SPI and viceversa, and on top of that you may "confuse" I2C slaves as the number of clock pulses is different for both transmissions ..

If I were you I would forget about SPI features, just use standard pins for DI, DO, SCK and SS and write a subroutine to operate SPI using these standard pins .. This shouldn't be difficult as all what you need is to generate 8 closk pulse and send or dead 8 bits .. and clock pulses do not need to be of identical length ..

Regards,
IanP
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…