Labels

Friday, 9 January 2015

Brief introduction about I2C, SPI and UART

I2C / SPI / UART

I2C is a 2-wire (SCL and SDA) half-duplex serial bus. SPI is 4-wire (SCLK, MOSI, MISO, and SS) full duplex serial bus. UART is point t0 point full duplex communication interface.
  • UART data rate – 0.3 Kbps to 1 Mbps
  • I2C speeds – 100 kHz, 400 kHz, 3.4 MHz 
  • SPI – Tens of MHz: Suitable for higher speed applications
 UART is asynchronous interface (i.e. sender and receiver use different clock source and embed the sync/clock information into data stream; re-sync is usually done through start and stop bits) while I2C and SPI are synchronous interfaces (dedicated receive/transmit clock signal, master device usually outputs clock signal).

UART is mostly used in communication between external devices via cables to bridge larger distances. I2C and SPI are used to connect peripheral devices on same circuit board and are suitable for relatively short distances.

Multi-Master Systems: I2C interface has built in arbitration to detect multiple devices sending on bus at same time. SPI uses dedicated slave select pin to detect request of devices to become master. Multi-master in UART requires software protocol implementation to handle bus arbitration as not supported by hardware.

I2C is bit complex compared to SPI, and requires mechanism to address devices (7/10 bit addressing). In case of SPI dedicated chip select signal is required for each device and hence pins increases with device.

I2C is more sensitive to noise and hence lower data integrity. I2C is level triggered and samples data during the high or low phase of a bit, noise could flip bit. SPI is edge triggered and less sensitive to noise.

No comments:

Post a Comment