Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

spi and i2c compare difference

Status
Not open for further replies.
I2C and SPI are both industry standard interfaces for data exchange.
I2C : It has a 2 byte data transfer and receive capability and hence is quite slow. In order to operat at such slow pace it requires a slow clock.
The I2C bus peripheral has two pins used for data transfer. SCL is a serial clock, and SDA is a serial data pin. The pins are configured in a wired-AND format that allows arbitration in a multi master system.
A master device can be configured to generate the serial clock. The frequency is programmed by the user in the serial clock divisor register. The master channel can be set to operate in fast mode (400 kHz) or standard mode (100 kHz

SPI: This on the other hand as the name suggests -Serial programmable interface - transfers 8bytes of data and hence is faster. It can operate in full duplex i.e it can transmit and receive at the same time with a frequency of user_clk/2.
This will transmit a stream of 8bytes once it receives the clock and fulfills the requirements for the data to propagate.
Ithas modes like : continous transfer moe, burst mode etc.. which are configurable by the control registers.
 
  • Like
Reactions: pdude

    pdude

    Points: 2
    Helpful Answer Positive Rating
I2C and SPI are both industry standard interfaces for data exchange.


SPI: This on the other hand as the name suggests -Serial programmable interface - transfers 8bytes of data and hence is faster. It can operate in full duplex i.e it can transmit and receive at the same time with a frequency of user_clk/2.
This will transmit a stream of 8bytes once it receives the clock and fulfills the requirements for the data to propagate.
Ithas modes like : continous transfer moe, burst mode etc.. which are configurable by the control registers.

SPI means Serial Peripheral Interface... not programmable interface
Actually as u said, there is sending 8 bytes of data in SPI ,it is not possible.In SPI 1 byte of data shifting is possible.Please see the attachment. Capture.PNG
Sending 8 bytes of data is possible in CAN protocol.
I am not satisfied your answar. Please suggest me something new.
Thank you very much.
 
So much confusion...

Both protocol basically allow to transfer an arbitrary number of data bytes in a transaction. You can e.g. read or write a full page of an I2C memory between a start and stop command. Similary read or write many bytes after selecting a SPI slave device by the SS line. It completely depends on the application requirements and device capabilities.

The original question is about speed.

The main limitation of I2C transmission speed is imposed by the open drain bus structure. There's an optional I2C highspeed mode which switches the bus drivers to push-pull. But it's rarely used and almost unsupported by existing devices.

SPI knows no general speed specification, bus speed has to be selected according to master and slave capabiities and application needs. Push-pull bus lines allow up to 50 Mhz and more with recent devices. Most SPI devices are at least capable of several MHz, in so far it's usually faster than I2C.
 

dear FVM sir
Actually I have a answar but I am little bit confused about this.

My answar is-- In I2C there is a ack. but in SPI no ack. is present.In i2c due to ack. it is taken more time tan SPI.
So data rate of SPI is much faster than i2c.

please tell me is it right or wrong.
 

Main topic to discuss the difference is
1) speed is difference
in case of i2c is 100/400kbps in 7 bit mode max 400kbps
in case of spi speed is upto 1mbps

2)Connection wise: i2c require less pin then spi
as spi require slave select for individual device...

3)it is better to use i2c in case of if u want to connect more device to connect...

4)bus arbitration is possible in case of i2c... not in case of spi...

5)multi master is possible in i2c easily... difficult to implement in spi..due to bus arbitration is available in i2c..

6)noise sensitivity of i2c is high... there is chance to corrupt the r/w bit... then whole data is corrputed... but in case of spi.. chance is very less as whole word is trasmitted...

7) i2c is developed by philips while spi is developed by motorola..

8) it is easy to implement the spi...while i2c is little bit complex...

9) pcb point of view i2c is better then spi as it is require less pins only two pins SDA and SCL... software point of view aslo i2c is better.. common software for all device which v r going to connect...
 

Hi,

I2C:
.. with I2C you need pullups as said. The timing is limit by the value of the pullup resistor and the length (capacity) fo the whole cable. ( and the devices timing spec of course)
.. I2C is not goot for long cables, best to be on one PCB.
.. with I2C you need at least one extra addressing byte per frame
.. I2C is not easy to expand
.. I2C devices (mostely) have fixed addresses, so sometimes you get an address conflict by using different devices with same/overlapping address (especially with large EEPROMs)
.. I2C defines the speed, voltage levels and at least a part of the protocol..

SPI:
.. SPI datarate is not defined (i know SPI flash devices with 50MHz SPI clock speed)
.. you can use SPI with long cables by using level shifters like RS485
.. with SPI no addressing byte, but extra CS line is needed (With RS485 bus you need it to enable the RS485 driver)
.. No fixed adress, so from this point no limit of what device and how many devices you use...


.. no winner, every interface has its benefits...

hope this helps
Klaus
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top