SlideShare ist ein Scribd-Unternehmen logo
1 von 21
I2C Bus

      Author:
      Varun Mahajan
      <varunmahajan06@gmail.com>
Contents
 ●
     I2C Bus concept
 ●
     Communication Protocol
 ●
     Bus Terminology
 ●
     General characteristics
 ●
     I2C Communication
       ●
           Data Validity
       ●
           START & STOP Conditions
       ●
           Byte Format
       ●
           Acknowledgment
       ●
           Synchronization
       ●
           Arbitration
       ●
           7-Bit Addressing
       ●
           10-Bit Addressing
I2C Bus concept
 ●
     Two bi-directional lines – SDA and SCL

 ●
  Each device is recognized by a unique address and can operate as a transmitter or
 receiver

 ●
  A master is the device which initiates the data transfer on the bus and generates
 the clock signals to permit the transfer. At that time any device addressed is
 considered a slave

 ●
     Multi-master bus
I2C Communication Protocol


     WRITE OPERATION


     START    CONTROL BYTE            ACK      Byte1      ACK     Byte2   ACK   STOP




     READ OPERATION


     START    CONTROL BYTE            ACK      Byte1      ACK     Byte2   ACK   STOP




      CONTROL BYTE                      7 bit slave address R/W


                     Sent by master

                     Sent by slave
I2C Bus Terminology
I2C Bus Terminology
 Microcontroller A wants to send information to Microcontroller B:

 ●
     MC A (master), addresses MC B (slave)
 ●
     MC A (master-transmitter), sends data to MC B (slave-receiver)
 ●
     MC A (master) terminates the transfer

 Microcontroller A wants to receive information from microcontroller B:

 ●
     MC A (master), addresses MC B (slave)
 ●
     MC A (master-receiver), receives data from MC B (slave-transmitter)
 ●
     MC A (master) terminates the transfer
H/W Connections
 All the I2C interfaces are connected to the I2C bus using the wired-AND
 connection




                          D1                     D2
                                          SDA2
                       SDA1                              SCL2
                                SCL1


                         AND logic           AND logic


               SDA


               SCL
I2C Bus: General Characteristics
 ●
     Transfer rates:
         - Standard mode   : up to 100 kbit/sec
         - Fast mode       : up to 400 kbit/sec
         - High Speed mode : up to 3.4 Mbit/sec

 ●
     7-Bit and 10-Bit addressing

 ●
     Bus Free: Both SCL and SDA lines are HIGH

 ●
  The number of interfaces connected to the bus is solely dependent on the bus
 capacitance limit of 400 pF
Data Validity
 The data on SDA line must be stable during the HIGH period of SCL. The HIGH or
 LOW state of SDA can change when the SCL is LOW.
START and STOP conditions
 • START condition: A HIGH to LOW transition on SDA line while SCL is HIGH
 • STOP condition: A LOW to HIGH transition on SDA line while SCL is HIGH

 The bus is considered to be busy after the START condition. The bus is considered to
 be free again after the STOP condition
Byte Format
 ●
     Each byte put on the SDA line must be 8-bits long
 ●
     The number of bytes that can be transmitted per transfer is unrestricted
 ●
     Data is transferred with the most significant bit (MSB) first
 ●
     Slave can force the master into a wait state by holding the SCL LOW
Acknowledgement
 ●
   Each transferred byte needs to be acknowledged by the receiver
 ●
   The acknowledge-related clock pulse is generated by the master
 ●
   The transmitter releases the SDA line (HIGH) during the acknowledge clock pulse.
 The receiver must pull down the SDA line during the acknowledge clock pulse so
 that it remains stable LOW during the HIGH period of this clock pulse
Synchronization
 ●
   Synchronization is performed using the wired-AND connection of I2C interfaces to
 the SCL line
 ●
   A synchronized clock is generated with its LOW period determined by the device
 with the longest clock LOW period, and its HIGH period determined by the one with
 the shortest clock HIGH period
Arbitration
 Arbitration takes place on the SDA line, while the SCL line is at HIGH level, in such a
 way that the master which transmits a HIGH level, while another master is
 transmitting LOW will switch off its DATA output stage because the level on the bus
 doesn’t correspond to its own level
7-Bit Addressing
 ●
   The first seven bits of the first byte make up the slave address
 ●
   The eighth bit (LSB) determines the direction of the message. 0 means that the
 master will write information to a selected device. 1 means that the master will read
 information from the slave
7-Bit Addressing
 Definition of bits in the first byte
7-Bit Addressing
10-Bit Addressing
 ●
   The first seven bits of the first byte are the combination 11110XX of which the last
 two bits are the two MSBs of the 10-bit address
 ●
   The eighth bit (LSB) determines the direction of the message. 0 means that the
 master will write information to a selected device. 1 means that the master will read
 information from the slave
 ●
   If the eighth bit is 0, then the second byte contains the remaining 8 bits of the 10-
 bit address
 ●
   If the eighth bit is 1, then the next byte contains data transmitted from a slave to
 a master
10-Bit Addressing
References
 ●
     I2C Bus Specification version 2.1 January 2000
END…

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Uart
UartUart
Uart
 
I2 c protocol
I2 c protocolI2 c protocol
I2 c protocol
 
Serial Peripheral Interface
Serial Peripheral InterfaceSerial Peripheral Interface
Serial Peripheral Interface
 
I2C BUS PROTOCOL
I2C BUS PROTOCOLI2C BUS PROTOCOL
I2C BUS PROTOCOL
 
UART Communication
UART CommunicationUART Communication
UART Communication
 
I2C
I2CI2C
I2C
 
axi protocol
axi protocolaxi protocol
axi protocol
 
SPI introduction(Serial Peripheral Interface)
SPI introduction(Serial Peripheral Interface)SPI introduction(Serial Peripheral Interface)
SPI introduction(Serial Peripheral Interface)
 
APB protocol v1.0
APB protocol v1.0APB protocol v1.0
APB protocol v1.0
 
SPI Protocol in LPC2148
SPI  Protocol in LPC2148SPI  Protocol in LPC2148
SPI Protocol in LPC2148
 
8255 PPI
8255 PPI8255 PPI
8255 PPI
 
Spi master core verification
Spi master core verificationSpi master core verification
Spi master core verification
 
The I2C Interface
The I2C InterfaceThe I2C Interface
The I2C Interface
 
Introduction about APB Protocol
Introduction about APB ProtocolIntroduction about APB Protocol
Introduction about APB Protocol
 
AMBA Ahb 2.0
AMBA Ahb 2.0AMBA Ahb 2.0
AMBA Ahb 2.0
 
AHB To APB BRIDGE.pptx
AHB To APB BRIDGE.pptxAHB To APB BRIDGE.pptx
AHB To APB BRIDGE.pptx
 
dual-port RAM (DPRAM)
dual-port RAM (DPRAM)dual-port RAM (DPRAM)
dual-port RAM (DPRAM)
 
I2C And SPI Part-23
I2C And  SPI Part-23I2C And  SPI Part-23
I2C And SPI Part-23
 
AMBA AHB 5
AMBA AHB 5AMBA AHB 5
AMBA AHB 5
 
I2C-SPI-UART Basics || Embedded System || Hariharan K
I2C-SPI-UART Basics || Embedded System || Hariharan KI2C-SPI-UART Basics || Embedded System || Hariharan K
I2C-SPI-UART Basics || Embedded System || Hariharan K
 

Ähnlich wie I2C Bus Communication Protocol: A Concise Guide to the I2C Bus Concept, Terminology, Addressing Modes & Transfer Mechanisms

Raspberry Pi - Lecture 3 Embedded Communication Protocols
Raspberry Pi - Lecture 3 Embedded Communication ProtocolsRaspberry Pi - Lecture 3 Embedded Communication Protocols
Raspberry Pi - Lecture 3 Embedded Communication ProtocolsMohamed Abdallah
 
Peripherals and interfacing
Peripherals  and interfacingPeripherals  and interfacing
Peripherals and interfacingRAMPRAKASHT1
 
communication interfaces-Embedded real time systems
communication interfaces-Embedded real time systemscommunication interfaces-Embedded real time systems
communication interfaces-Embedded real time systemsRaghunath reddy
 
I2C-Bus Design and Verification Specs
I2C-Bus Design and Verification SpecsI2C-Bus Design and Verification Specs
I2C-Bus Design and Verification SpecsMostafa Khamis
 
I2C protocol and DS1307 RTC interfacing
I2C protocol and DS1307 RTC interfacingI2C protocol and DS1307 RTC interfacing
I2C protocol and DS1307 RTC interfacingBhargav Kakadiya
 
I2 c and mpu6050 basics
I2 c and mpu6050 basicsI2 c and mpu6050 basics
I2 c and mpu6050 basicsironstein1994
 
Part-2: Mastering microcontroller with embedded driver development
Part-2: Mastering microcontroller with embedded driver developmentPart-2: Mastering microcontroller with embedded driver development
Part-2: Mastering microcontroller with embedded driver developmentFastBit Embedded Brain Academy
 
Inter intergrated circuits-communication protocol
Inter intergrated circuits-communication protocolInter intergrated circuits-communication protocol
Inter intergrated circuits-communication protocolRevathi Subramaniam
 
Implementation of I2C Master Bus Protocol on FPGA
Implementation of I2C Master Bus Protocol on FPGAImplementation of I2C Master Bus Protocol on FPGA
Implementation of I2C Master Bus Protocol on FPGAIJERA Editor
 
Slow peripheral interfaces (i2 c spi uart)
Slow peripheral interfaces (i2 c  spi uart)Slow peripheral interfaces (i2 c  spi uart)
Slow peripheral interfaces (i2 c spi uart)PREMAL GAJJAR
 
Application Report On Stellaris To Dac5571(I2c)
Application Report On Stellaris To Dac5571(I2c)Application Report On Stellaris To Dac5571(I2c)
Application Report On Stellaris To Dac5571(I2c)Chiu-Hao Chen (Ted)
 
Universal synchronous asynchronous receiver transmitter(usart) and AtoD Coverter
Universal synchronous asynchronous receiver transmitter(usart) and AtoD CoverterUniversal synchronous asynchronous receiver transmitter(usart) and AtoD Coverter
Universal synchronous asynchronous receiver transmitter(usart) and AtoD CoverterTejas Shetye
 
UNI T 6- SPI_I2C_Lecture8.pptx
UNI                    T 6- SPI_I2C_Lecture8.pptxUNI                    T 6- SPI_I2C_Lecture8.pptx
UNI T 6- SPI_I2C_Lecture8.pptxnaveen088888
 

Ähnlich wie I2C Bus Communication Protocol: A Concise Guide to the I2C Bus Concept, Terminology, Addressing Modes & Transfer Mechanisms (20)

Raspberry Pi - Lecture 3 Embedded Communication Protocols
Raspberry Pi - Lecture 3 Embedded Communication ProtocolsRaspberry Pi - Lecture 3 Embedded Communication Protocols
Raspberry Pi - Lecture 3 Embedded Communication Protocols
 
Lpc2148 i2c
Lpc2148 i2cLpc2148 i2c
Lpc2148 i2c
 
Peripherals and interfacing
Peripherals  and interfacingPeripherals  and interfacing
Peripherals and interfacing
 
communication interfaces-Embedded real time systems
communication interfaces-Embedded real time systemscommunication interfaces-Embedded real time systems
communication interfaces-Embedded real time systems
 
I2C-Bus Design and Verification Specs
I2C-Bus Design and Verification SpecsI2C-Bus Design and Verification Specs
I2C-Bus Design and Verification Specs
 
I2C protocol and DS1307 RTC interfacing
I2C protocol and DS1307 RTC interfacingI2C protocol and DS1307 RTC interfacing
I2C protocol and DS1307 RTC interfacing
 
I2C PRESENTATION.PPT
I2C PRESENTATION.PPTI2C PRESENTATION.PPT
I2C PRESENTATION.PPT
 
COM_BASIC.pptx
COM_BASIC.pptxCOM_BASIC.pptx
COM_BASIC.pptx
 
I2 c and mpu6050 basics
I2 c and mpu6050 basicsI2 c and mpu6050 basics
I2 c and mpu6050 basics
 
Serial Communication in 8051
Serial Communication in 8051Serial Communication in 8051
Serial Communication in 8051
 
Part-2: Mastering microcontroller with embedded driver development
Part-2: Mastering microcontroller with embedded driver developmentPart-2: Mastering microcontroller with embedded driver development
Part-2: Mastering microcontroller with embedded driver development
 
Communication protocols - Embedded Systems
Communication protocols - Embedded SystemsCommunication protocols - Embedded Systems
Communication protocols - Embedded Systems
 
Inter intergrated circuits-communication protocol
Inter intergrated circuits-communication protocolInter intergrated circuits-communication protocol
Inter intergrated circuits-communication protocol
 
Implementation of I2C Master Bus Protocol on FPGA
Implementation of I2C Master Bus Protocol on FPGAImplementation of I2C Master Bus Protocol on FPGA
Implementation of I2C Master Bus Protocol on FPGA
 
Slow peripheral interfaces (i2 c spi uart)
Slow peripheral interfaces (i2 c  spi uart)Slow peripheral interfaces (i2 c  spi uart)
Slow peripheral interfaces (i2 c spi uart)
 
I2c buses
I2c busesI2c buses
I2c buses
 
Application Report On Stellaris To Dac5571(I2c)
Application Report On Stellaris To Dac5571(I2c)Application Report On Stellaris To Dac5571(I2c)
Application Report On Stellaris To Dac5571(I2c)
 
Universal synchronous asynchronous receiver transmitter(usart) and AtoD Coverter
Universal synchronous asynchronous receiver transmitter(usart) and AtoD CoverterUniversal synchronous asynchronous receiver transmitter(usart) and AtoD Coverter
Universal synchronous asynchronous receiver transmitter(usart) and AtoD Coverter
 
I2 c communication protocol
I2 c communication protocolI2 c communication protocol
I2 c communication protocol
 
UNI T 6- SPI_I2C_Lecture8.pptx
UNI                    T 6- SPI_I2C_Lecture8.pptxUNI                    T 6- SPI_I2C_Lecture8.pptx
UNI T 6- SPI_I2C_Lecture8.pptx
 

Mehr von Varun Mahajan

I2C Subsystem In Linux-2.6.24
I2C Subsystem In Linux-2.6.24I2C Subsystem In Linux-2.6.24
I2C Subsystem In Linux-2.6.24Varun Mahajan
 
Hibernation in Linux 2.6.29
Hibernation in Linux 2.6.29Hibernation in Linux 2.6.29
Hibernation in Linux 2.6.29Varun Mahajan
 
Process' Virtual Address Space in GNU/Linux
Process' Virtual Address Space in GNU/LinuxProcess' Virtual Address Space in GNU/Linux
Process' Virtual Address Space in GNU/LinuxVarun Mahajan
 
Program Structure in GNU/Linux (ELF Format)
Program Structure in GNU/Linux (ELF Format)Program Structure in GNU/Linux (ELF Format)
Program Structure in GNU/Linux (ELF Format)Varun Mahajan
 
Introduction to GNU/Linux, Free Software, Open Source Software, FSF, FSM, OSI
Introduction to GNU/Linux, Free Software, Open Source Software, FSF, FSM, OSIIntroduction to GNU/Linux, Free Software, Open Source Software, FSF, FSM, OSI
Introduction to GNU/Linux, Free Software, Open Source Software, FSF, FSM, OSIVarun Mahajan
 

Mehr von Varun Mahajan (6)

Red Black Trees
Red Black TreesRed Black Trees
Red Black Trees
 
I2C Subsystem In Linux-2.6.24
I2C Subsystem In Linux-2.6.24I2C Subsystem In Linux-2.6.24
I2C Subsystem In Linux-2.6.24
 
Hibernation in Linux 2.6.29
Hibernation in Linux 2.6.29Hibernation in Linux 2.6.29
Hibernation in Linux 2.6.29
 
Process' Virtual Address Space in GNU/Linux
Process' Virtual Address Space in GNU/LinuxProcess' Virtual Address Space in GNU/Linux
Process' Virtual Address Space in GNU/Linux
 
Program Structure in GNU/Linux (ELF Format)
Program Structure in GNU/Linux (ELF Format)Program Structure in GNU/Linux (ELF Format)
Program Structure in GNU/Linux (ELF Format)
 
Introduction to GNU/Linux, Free Software, Open Source Software, FSF, FSM, OSI
Introduction to GNU/Linux, Free Software, Open Source Software, FSF, FSM, OSIIntroduction to GNU/Linux, Free Software, Open Source Software, FSF, FSM, OSI
Introduction to GNU/Linux, Free Software, Open Source Software, FSF, FSM, OSI
 

I2C Bus Communication Protocol: A Concise Guide to the I2C Bus Concept, Terminology, Addressing Modes & Transfer Mechanisms

  • 1. I2C Bus Author: Varun Mahajan <varunmahajan06@gmail.com>
  • 2. Contents ● I2C Bus concept ● Communication Protocol ● Bus Terminology ● General characteristics ● I2C Communication ● Data Validity ● START & STOP Conditions ● Byte Format ● Acknowledgment ● Synchronization ● Arbitration ● 7-Bit Addressing ● 10-Bit Addressing
  • 3. I2C Bus concept ● Two bi-directional lines – SDA and SCL ● Each device is recognized by a unique address and can operate as a transmitter or receiver ● A master is the device which initiates the data transfer on the bus and generates the clock signals to permit the transfer. At that time any device addressed is considered a slave ● Multi-master bus
  • 4. I2C Communication Protocol WRITE OPERATION START CONTROL BYTE ACK Byte1 ACK Byte2 ACK STOP READ OPERATION START CONTROL BYTE ACK Byte1 ACK Byte2 ACK STOP CONTROL BYTE 7 bit slave address R/W Sent by master Sent by slave
  • 6. I2C Bus Terminology Microcontroller A wants to send information to Microcontroller B: ● MC A (master), addresses MC B (slave) ● MC A (master-transmitter), sends data to MC B (slave-receiver) ● MC A (master) terminates the transfer Microcontroller A wants to receive information from microcontroller B: ● MC A (master), addresses MC B (slave) ● MC A (master-receiver), receives data from MC B (slave-transmitter) ● MC A (master) terminates the transfer
  • 7. H/W Connections All the I2C interfaces are connected to the I2C bus using the wired-AND connection D1 D2 SDA2 SDA1 SCL2 SCL1 AND logic AND logic SDA SCL
  • 8. I2C Bus: General Characteristics ● Transfer rates: - Standard mode : up to 100 kbit/sec - Fast mode : up to 400 kbit/sec - High Speed mode : up to 3.4 Mbit/sec ● 7-Bit and 10-Bit addressing ● Bus Free: Both SCL and SDA lines are HIGH ● The number of interfaces connected to the bus is solely dependent on the bus capacitance limit of 400 pF
  • 9. Data Validity The data on SDA line must be stable during the HIGH period of SCL. The HIGH or LOW state of SDA can change when the SCL is LOW.
  • 10. START and STOP conditions • START condition: A HIGH to LOW transition on SDA line while SCL is HIGH • STOP condition: A LOW to HIGH transition on SDA line while SCL is HIGH The bus is considered to be busy after the START condition. The bus is considered to be free again after the STOP condition
  • 11. Byte Format ● Each byte put on the SDA line must be 8-bits long ● The number of bytes that can be transmitted per transfer is unrestricted ● Data is transferred with the most significant bit (MSB) first ● Slave can force the master into a wait state by holding the SCL LOW
  • 12. Acknowledgement ● Each transferred byte needs to be acknowledged by the receiver ● The acknowledge-related clock pulse is generated by the master ● The transmitter releases the SDA line (HIGH) during the acknowledge clock pulse. The receiver must pull down the SDA line during the acknowledge clock pulse so that it remains stable LOW during the HIGH period of this clock pulse
  • 13. Synchronization ● Synchronization is performed using the wired-AND connection of I2C interfaces to the SCL line ● A synchronized clock is generated with its LOW period determined by the device with the longest clock LOW period, and its HIGH period determined by the one with the shortest clock HIGH period
  • 14. Arbitration Arbitration takes place on the SDA line, while the SCL line is at HIGH level, in such a way that the master which transmits a HIGH level, while another master is transmitting LOW will switch off its DATA output stage because the level on the bus doesn’t correspond to its own level
  • 15. 7-Bit Addressing ● The first seven bits of the first byte make up the slave address ● The eighth bit (LSB) determines the direction of the message. 0 means that the master will write information to a selected device. 1 means that the master will read information from the slave
  • 16. 7-Bit Addressing Definition of bits in the first byte
  • 18. 10-Bit Addressing ● The first seven bits of the first byte are the combination 11110XX of which the last two bits are the two MSBs of the 10-bit address ● The eighth bit (LSB) determines the direction of the message. 0 means that the master will write information to a selected device. 1 means that the master will read information from the slave ● If the eighth bit is 0, then the second byte contains the remaining 8 bits of the 10- bit address ● If the eighth bit is 1, then the next byte contains data transmitted from a slave to a master
  • 20. References ● I2C Bus Specification version 2.1 January 2000