meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
com:basic_i2c [2024/05/30 23:04] – [Open-Drain Connection] vamsancom:basic_i2c [2025/05/31 22:45] (current) vamsan
Line 1: Line 1:
 ====== lamaPLC Communication: I²C ====== ====== lamaPLC Communication: I²C ======
 {{ :com:i2c:logo_i2c.png?150|}} {{ :com:i2c:logo_i2c.png?150|}}
-**I²C** (//Inter-Integrated Circuit//; pronounced as “eye-squared-C”), alternatively known as I2C, I²C or IIC, is a synchronous, multi-master/multi-slave (controller/target), packet switched, single-ended, serial communication bus invented in 1982 by Philips Semiconductors. It is widely used for attaching lower-speed peripheral ICs to processors and microcontrollers in short-distanceintra-board communication.\\ +**I²C** (//Inter-Integrated Circuit//; pronounced as “eye-squared-C”), alternatively known as I2C, I²C or IIC, is a synchronous, multi-master/multi-slave (controller/target), packet switched, single-ended, serial communication bus invented in 1982 by Philips Semiconductors.  
-\\+ 
 +I²C is a common digital communication standard used in various products. The protocol uses a two-wire communication interface, allowing multiple controllers and target peripheral devices. This application note describes many important protocol aspects as a guide to using I²C to communicate with controller devices. 
 + 
 +This application note discusses the protocol and the physical layer for I²C communications. Because I²C is often used with data converter devices, examples of communications were provided for a DAC and an ADC to write and read from registers. 
 + 
 +Several competitors, such as Siemens, NEC, Texas Instruments, STMicroelectronics, Motorola, Nordic Semiconductor, and Intersil, have introduced compatible I²C products to the market since the mid-1990s. 
 + 
 +**Protocols Similar to I²C** 
 + 
 +The I²C specification discusses several other communications protocols based on I²C. These other protocols can be similar and compatible with I²C communication and can be used for specific applications. Some protocols also have defined commands and application-specific extensions for their systems. This section briefly describes the applications for these other protocols, but their systems, applications, and uses are found in 
 +elsewhere. 
 + 
 +The first of these similar protocols is the Two-Wire Interface, or TWI, which is the same as I²C. 
 + 
 +However, there are some minor differences. TWI does not support a START byte and does not support high-speed modes. Generally, TWI-compatible devices are expected to be compatible with I²C, and the protocol can be seen with the same logic analyzers. 
 + 
 +The System Management Bus, or SMBus®, is a protocol similar to I²C that is tailored to a specific function. It is commonly used in servers and computer motherboards for power source management. The protocol is very similar to I²C in the communication protocol and can be understood by an I²C controller. 
 + 
 +The SMBus protocol has some additional features in comparison to I²C. The SMBus can dynamically set addresses, allowing for quick communications at the start-up of a system. Alsothe bus has a 35-ms timeout, which prevents one device from indefinitely tying up the bus. The protocol also has a packet error checking for error detection in data communication. There is an additional line called SMBAlert that is used by target devices 
 +as an interrupt to tell the controller about certain events detected by the target device. 
 + 
 +The Power Management bus, or PMBus®, is a variant of SMBus defined by Intel. It is used in the digital management of power supplies. This protocol also defines specific commands to retrieve data about the system's voltage, current, and power. 
 + 
 +Intelligent Platform Management Interface IPMI is another I²C-based protocol. This protocol is used by baseboard management controllers (BMCs) for autonomous computer subsystems to monitor and manage the system CPU, firmware, and operating system. The protocol uses a standardized message-based interface for a computer motherboard or server. The BMC is always running even when the central system is off, allowing for operation, measurement, and remote management of a system. 
 + 
 +There are several other similar protocols discussed in the I²C specifications. Advanced Telecommunications Computing Architecture (ATCA) is a follow-on to Compact PCI used in rack-mounted telecom hardware. 
 + 
 +Display Data Channel (DDC) is a monitor or display information protocol that hosts use to control display functions. Finally, C-Bus is another protocol derived from I²C. As mentioned in the reserved address section, this protocol is used in some parts of the world for home and building automation. 
 I²C is similar in concept to [[com:basic_1wire|1-Wire]].\\ I²C is similar in concept to [[com:basic_1wire|1-Wire]].\\
-\\ 
-Several competitors, such as Siemens, NEC, Texas Instruments, STMicroelectronics, Motorola, Nordic Semiconductor and Intersil, have introduced compatible I²C products to the market since the mid-1990s.\\ 
-\\ 
-System Management Bus (**SMBus**), defined by Intel in 1995, is a subset of I²C, defining a stricter usage. One purpose of SMBus is to promote robustness and interoperability. Accordingly, modern I²C systems incorporate some policies and rules from SMBus, sometimes supporting both I2C and SMBus, requiring only minimal reconfiguration either by commanding or output pin use.\\ 
-\\ 
 ===== I²C specifications ===== ===== I²C specifications =====
   * In the most common case, the I²C bus contains only one master, but the possibility of a multimaster is also not excluded   * In the most common case, the I²C bus contains only one master, but the possibility of a multimaster is also not excluded
-  * I²C uses an open-ended pair of wires for data transferthe serial data line (SDA) and the serial clock signal (SCL). The two wires must be pulled to the operating voltage with resistors, the wires typically operate with a voltage of 5V or 3.3V, but a different voltage specification is also not excluded.+  * I²C uses an open-ended pair of wires for data transferthe serial data line (SDA) and the serial clock signal (SCL). The two wires must be pulled to the operating voltage with resistors. The wires typically operate with a voltage of 5V or 3.3V, but a different voltage specification is also not excluded.
  
 {{ :com:i2c_diagram.png?500 |I²C specifications}} {{ :com:i2c_diagram.png?500 |I²C specifications}}
Line 29: Line 52:
  
 ===== Open-Drain Connection ===== ===== Open-Drain Connection =====
-The open-drain connections are used on both SDA and SCL lines and connect to an NMOS transistor. This open-drain connection controls the I2C communication line and pulls the line low or releases the line high. The open-drain refers to the NMOS bus connection when the NMOS is turned OFF. Next pics shows the open-drain connection as the NMOS is turned on:+The open-drain connections are used on both SDA and SCL lines and connect to an NMOS transistor. This open-drain connection controls the I2C communication line and pulls the line low or releases the line high. The open-drain refers to the NMOS bus connection when the NMOS is turned OFF. The next pic shows the open-drain connection as the NMOS is turned on:
  
 {{ :com:i2c_1.png |Open-Drain Connection Pulls Line Low When NMOS is Turned On}} {{ :com:i2c_1.png |Open-Drain Connection Pulls Line Low When NMOS is Turned On}}
  
-To set the voltage level of the SDA or SCL line, the NMOS is set on or off. When the NMOS is on, the device pulls current through the resistor to ground. This pulls the open-drain line low. Typically, the transition from high to low for I²C is fast transition as the NMOS pulls down on SDA or SCL. The speed of the transition is determined by the NMOS drive strength and any bus capacitance on SDA or SCL.+The NMOS is set on or off to set the voltage level of the SDA or SCL line. When the NMOS is on, the device pulls current through the resistor to ground, pulling the open-drain line low. Typically, the transition from high to low for I²C is as fast as the NMOS pulls down on SDA or SCL. The NMOS drive strength and any bus capacitance on SDA or SCL determine the transition speed.
  
-When the NMOS turns off, the device stops pulling current, and the pullup resistor pulls the SDA or SCL line to VDD. Next pics shows an open-drain line as the NMOS is turned off. The pullup resistor pulls the line high. The transition of the open-drain line is slower because line is pulled up against the bus capacitanceand is not actively driven.+When the NMOS turns off, the device stops pulling current, and the pull-up resistor pulls the SDA or SCL line to VDD. The next picture shows an open-drain line as the NMOS is turned off. The pull-up resistor pulls the line high. The transition of the open-drain line is slower because the line is pulled up against the bus capacitance and is not actively driven.
  
 {{ :com:i2c_2.png |Pullup Resistor Pulls Line High When NMOS is Turned Off}} {{ :com:i2c_2.png |Pullup Resistor Pulls Line High When NMOS is Turned Off}}
Line 41: Line 64:
  
 ===== I²C addresses ===== ===== I²C addresses =====
-Different manufacturers' applications and addresses with different lengths (7, 8 or 10 bits) significantly limit the usable address range, which is practically **0x08 .. 0x77**.+Different manufacturers' applications and addresses with different lengths (7, 8or 10 bits) significantly limit the usable address range, which is practically **0x08 .. 0x77**.
  
  
 ===== I²C Arduino ===== ===== I²C Arduino =====
-The I²C protocol involves using two lines to send and receive data: a serial clock pin (SCL) that the Arduino Controller board pulses at a regular interval, and a serial data pin (SDA) over which data is sent between the two devices.+The I²C protocol uses two lines to send and receive data: a serial clock pin (SCL) that the Arduino Controller board pulses regularly, and a serial data pin (SDA) over which data is sent between the two devices.
  
-In I²C, there is one controller device, with one or more peripheral devices connected to the controllers SCL and SDA lines.+In I²C, one controller device has one or more peripheral devices connected to the controller'SCL and SDA lines.
  
-As the clock line changes from low to high (known as the rising edge of the clock pulse), a single bit of information is transferred from the board to the I²C device over the SDA line. As the clock line keeps pulsing, more and more bits are sent until a sequence of a 7 or 8 bit address, and a command or data is formed. When this information is sent - bit after bit -, the called upon device executes the request and transmits it'data back - if required - to the board over the same line using the clock signal still generated by the Controller on SCL as timing.+As the clock line changes from low to high (known as the rising edge of the clock pulse), a single bit of information is transferred from the board to the I²C device over the SDA line. As the clock line keeps pulsing, more and more bits are sent until a sequence of a 7 or 8-bit address, and a command or data is formed. When this information is sent - bit after bit -, the called upon device executes the request and transmits its data back - if required - to the board over the same line using the clock signal still generated by the Controller on SCL as timing.
  
 {{ :com:i2carduino.png |I²C Arduino}} {{ :com:i2carduino.png |I²C Arduino}}
Line 59: Line 82:
   * The controller sends out instructions through the I2C bus on the data pin (SDA), and the instructions are prefaced with the address, so that only the correct device listens.   * The controller sends out instructions through the I2C bus on the data pin (SDA), and the instructions are prefaced with the address, so that only the correct device listens.
   * Then there is a bit signifying whether the controller wants to read or write.   * Then there is a bit signifying whether the controller wants to read or write.
-  * Every message needs to be acknowledgedto combat unexpected results, once the receiver has acknowledged the previous information it lets the controller knowso it can move on to the next set of bits.+  * Every message needs to be acknowledged to combat unexpected results. Once the receiver has acknowledged the previous informationit lets the controller know so it can move on to the next set of bits.
   * 8 bits of data   * 8 bits of data
   * Another acknowledgement bit   * Another acknowledgement bit
Line 69: Line 92:
 ==== Arduino applications with I²C communication ==== ==== Arduino applications with I²C communication ====
   * [[arduino:display_lcd#i_c_lcd_adapter|Arduino LCD display]]   * [[arduino:display_lcd#i_c_lcd_adapter|Arduino LCD display]]
 +  * [[sensor:energy#ina226|INA 226: 36V, 16-bit, ultra-precise i²c output current/voltage/power monitor]]
 +
  
 ===== I²C Arduino with 3.3V ===== ===== I²C Arduino with 3.3V =====
Line 76: Line 101:
 {{ :com:lamaconceptioni2c_1.png |I²C Arduino with 3.3V}} {{ :com:lamaconceptioni2c_1.png |I²C Arduino with 3.3V}}
  
-According to the analysis of Texas Instruments, the above solution does not work, because the HI voltage level does not match between 5V and 3.3V, since in the case of 5V, 3.5v is the high-level-pegel, see [[https://www.ti.com/lit/an/sbaa565/sbaa565.pdf|here]].+According to the analysis of Texas Instruments, the above solution does not work, because the HI voltage level does not match between 5V and 3.3V, since in the case of 5V, 3.5V is the high-level-pegel, see [[https://www.ti.com/lit/an/sbaa565/sbaa565.pdf|here]].
  
 {{ :sensor:i2c_3.png |PCA3906 I²C Voltage Level Translator}} {{ :sensor:i2c_3.png |PCA3906 I²C Voltage Level Translator}}
  
-For this case, they recommend using the [[:sensor:level_converter#pca3906_i_c_voltage_level_translator|PCA9306 IC]].+They recommend using the [[:sensor:level_converter#pca3906_i_c_voltage_level_translator|PCA9306 IC]] for this case.
  
  
Line 91: Line 116:
 {{topic>i2c}} {{topic>i2c}}
 \\ \\
-{{tag>I2c I²C SMBus Philips bus communication}}+{{tag>I2c I²C SMBus Philips bus communication Arduino }}
 \\ \\
 This page has been accessed for: Today: {{counter|today}}, Until now: {{counter|total}} This page has been accessed for: Today: {{counter|today}}, Until now: {{counter|total}}