I2C interface: description in Russian

In modern household appliances, industrial electronics and various telecommunications equipment, quite often you can find similar solutions, although the products can be practically unrelated. For example, almost every system includes the following:

  • a certain “smart” control unit, which in the predominant majority of cases is a single-crystal microcomputer;
  • general purpose nodes such as LCD buffers, RAM, I / O ports, EEPROM, or specialized data converters;
  • specific nodes, including digital tuning and signal processing circuits for video and radio systems.

How to optimize their application?

a brief description of the interfaces uart spi i2c

To ensure the most efficient use of such common solutions for the benefit of designers and manufacturers themselves, as well as to increase the overall degree of performance of various equipment and simplify the circuitry used, Philips set out to develop an extremely simple two-wire bi-directional bus that provides the most productive inter-microcircuit control. This bus provides data transfer through the I2C interface.

To date, the range of the specified manufacturer includes more than 150 CMOS, as well as bipolar devices compatible with I2C and designed to operate in any of the above categories. It is worth noting that the I2C interface is initially built into all compatible devices, due to which they can easily communicate with each other using a special bus. Through the use of such a design solution, it was possible to solve a fairly large number of problems in pairing various equipment, which is quite typical for the development of digital systems.

Main advantages

i2c interface

Even if you look at a brief description of the UART, SPI, I2C interfaces, you can highlight the following advantages of the latter:

  • To work, you need only two lines - synchronization and data. Any device that connects to such a bus can subsequently be programmatically addressed to a completely unique address. At any time, there is a simple relationship that allows facilitators to act as master-transmitter or master-receiver.
  • This bus provides for the possibility of having several leaders at once, providing all the necessary tools for determining conflicts, as well as arbitration, which helps prevent data corruption in the event that two or more leaders begin to transmit information simultaneously. In standard mode, only eight-bit serial data transmission is provided at a speed of not more than 100 kbit / s, and in fast mode this threshold can be increased four times.
  • The chips use a special built-in filter that effectively suppresses bursts and ensures maximum data integrity.
  • The maximum possible number of microcircuits that can be connected to one bus is limited only by its maximum possible capacity of 400 pF.

Benefits for Designers

i2c interface lcd1602

The I2C interface, as well as all compatible microcircuits, can significantly accelerate the development process, from the functional diagram to its final prototype. It is worth noting that due to the possibility of connecting such microcircuits directly to the bus without using all kinds of additional circuits, there is room for further modernization and modification of the prototype system by disconnecting and connecting various devices from the bus.

There are tons of benefits that make the I2C interface stand out. The description, in particular, allows you to see the following advantages for designers:

  • The blocks on the functional diagram fully correspond to the microcircuits, and at the same time, a fairly quick transition from functional to fundamental is ensured.
  • There is no need to develop bus interfaces, because the bus is already initially integrated into special microcircuits.
  • Integrated information transfer protocols and device addressing enable the system to be fully software-defined.
  • The same types of chips, if necessary, can be used in completely different applications.
  • The total development time is significantly reduced due to the fact that designers can quickly get acquainted with the most commonly used function blocks, as well as all kinds of microcircuits.
  • If desired, you can add or remove microcircuits from the system, and at the same time do not have a special effect on other equipment connected to one bus.
  • The total software development time can be significantly reduced due to the fact that a library of reusable software modules is allowed here.

Among other things, it is worth noting the extremely simple procedure for diagnosing failures and further debugging, which distinguishes the I2C interface. The description suggests that, if necessary, without any difficulty, even minor deviations in the operation of such equipment can be instantly tracked without any difficulty and, accordingly, appropriate measures can be taken. It is also worth noting that designers receive special solutions, which, in particular, are quite attractive for various portable equipment and systems that provide battery power using the I2C interface. The description in Russian also indicates that its use provides the following important advantages:

  • A sufficiently high degree of resistance to any interference.
  • Extremely low energy consumption.
  • The widest range of supply voltage.
  • Wide temperature range.

Benefits for Technologists

It is worth noting that not only designers, but also technologists quite often recently began to use a specialized I2C interface. The description in Russian indicates a fairly wide range of advantages that are provided by this category of specialists:

  • A standard two-wire serial bus with such an interface allows minimizing connections between microcircuits, that is, they have fewer contacts and fewer tracks, so PCBs are not so expensive and have much smaller dimensions.
  • Fully integrated I2C interface LCD1602 or some other option completely eliminates the need for address decoders, as well as other external small logic.
  • It is possible to use several hosts simultaneously on such a bus, which greatly speeds up testing and subsequent equipment setup, as the bus can be connected to an assembly line computer.
  • The availability of integrated circuits compatible with this interface in VSO, SO, and a specialized DIL package can significantly reduce the size requirements of the device.

This is only a short list of advantages that distinguish the I2C interface LCD1602 and others. In addition, compatible microcircuits can significantly increase the flexibility of the system used, providing extremely simple design of various equipment options, as well as relatively easy upgrades to further support development at a modern level. Thus, it is possible to develop a whole family of different equipment, using as a basis a specific basic model.

Further equipment modernization and expansion of its functions can be carried out by standard connection to the bus of the corresponding microcircuit using the Arduino 2C interface or some other available list. If you need to provide more ROM, then in this case it will be enough only to choose another microcontroller having an increased amount of ROM. Since the updated chips, if necessary, can completely replace the old ones, you can easily add new properties to the equipment or increase its overall performance by simply disconnecting the outdated chips and then replacing them with newer equipment.

ACCESS.bus

Due to the fact that the bus has a two-wire nature, as well as the possibility of software addressing, for ACCESS.bus one of the most ideal platforms is precisely the I2C interface. The specification (description in Russian is presented in the article) of this device makes it a much cheaper alternative to the previously actively used RS-232C interface for connecting various peripherals to computers using a standard four-pin connector.

Specification introduction

i2c interface description in Russian

For modern 8-bit control applications that use microcontrollers, it is possible to set some design criteria:

  • the complete system in the predominant majority of cases includes one microcontroller and other peripheral devices, including memory and all kinds of input / output ports;
  • the total cost of combining various devices within one system should be minimized to the maximum;
  • the system entrusted with the management functions does not require the provision of high-speed transmission of information;
  • overall efficiency directly depends on the equipment chosen, as well as on the nature of the connecting bus.

To develop a system that fully meets the above criteria, you need to use a bus in which the serial I2C interface will be used. Although the serial bus does not have parallel bandwidth, it requires fewer connections and fewer chip contacts. At the same time, do not forget that the bus includes not only connecting wires, but also various procedures and formats necessary to ensure communication within the system.

Devices that use I2C software emulation or an appropriate bus to communicate must have a specific protocol that allows them to preempt various collisions, loss or blocking of information. Fast devices should be able to communicate with slow ones, and the system should not depend on the equipment connected to it, since otherwise all improvements and modifications cannot be used. It is also necessary to develop a procedure by which it is possible to establish which specific device currently provides bus control and at what point in time. In addition, if various devices with different clock frequencies are connected to the same bus, you need to determine the source of its synchronization. All these criteria correspond to the I2C interface for AVR and any others from this list.

Basic concept

i2c interface specification description in Russian

The I2C bus can support any chip technology used. The I2C LabVIEW interface and others similar to it provide for the use of two lines for transferring information - data and synchronization. Any device connected in this way is recognized by a unique address, regardless of whether it is an LCD buffer, microcontroller, memory or keyboard interface, and at the same time can work as a receiver or transmitter, depending on what this equipment is intended.

In the predominant majority of cases, the LCD buffer is a standard receiver, and the memory can not only receive, but also transmit various data. Among other things, by the process of moving information, devices can be classified as slaves and masters.

In this case, the leader is the device that initiates the transfer of data, and also generates synchronization signals. In this case, any addressable devices will be considered as slaves in relation to it.

The I2C communication interface provides for the presence of several masters at once, that is, more than one device capable of controlling the bus, is capable of connecting to it. The possibility of using more than one microcontroller in one bus indicates that more than one master can be sent at a certain point in time. To eliminate the potential chaos that risks appearing in the event of such a situation, a specialized arbitration procedure has been developed that uses the I2C interface. Extenders and other devices provide for connecting devices to the bus according to the so-called mounting rule I.

Generating a clock signal is the responsibility of the master, and each of them generates its own signal in the process of sending data, and in the future it can only change if it is “pulled” by a slow slave or another master in the event of a collision.

Common parameters

Both SCL and SDA are bi-directional lines that connect to a positive power source using a pull-up resistor. When the tire is completely free, each line is in a high position. The output stages of devices that are connected to the bus must be open-drain or open-collector, so that the mounting I function can be provided. Information via the I2C interface can be transmitted at a speed of no more than 400 kbit / s in fast mode, while in standard mode does not exceed 100 kbit / s. The total number of devices that can be simultaneously connected to the bus depends on only one parameter. This is the line capacity of not more than 400 pF.

the confirmation

i2c interface description

Confirmation is a mandatory procedure in the data transfer process. The master generates the corresponding synchronization pulse, while the transmitter releases the SDA line during the given clock pulse as an acknowledgment. After that, the receiver must ensure that the SDA line is stably maintained for a high state of the clock in a stable low state. In this case, you must take into account the installation and retention time.

In the predominant majority of cases, the addressed receiver must necessarily generate a confirmation after each byte received, and the only exception here are only those situations when the beginning of the sending includes the CBUS address.

If the receiving slave does not have the opportunity to send a confirmation of its own address, you need to leave the data line in a high state, and after that the master will have the opportunity to issue a Stop signal that will interrupt the sending of all information. If the address has been confirmed, but at the same time the slave can no longer receive any data, the package must also be interrupted by the master. To do this, the slave does not confirm the next byte received and simply leaves the data line in a high state, as a result of which the stop signal is generated by the master.

If the transfer procedure provides for the presence of the master receiver, then in this case he must inform the slave about the end of the transmission, and this is done by not confirming the last received byte. In this case, the slave-transmitter immediately releases the data line, so that the master could give a Stop signal or repeat the Start signal again.

To check the equipment’s performance, you can try to introduce standard examples of sketches for the I2C interface in Arduino, as in the photo above.

Arbitration

2c arduino interface

The host can start sending information only after the bus is completely released, but two or more hosts can generate a start signal at the minimum holding time. This ultimately leads to a specific start signal on the bus.

Arbitration is performed on the SDA bus while the SCL bus is in a high state. If one of the presenters begins to transmit a low level to the data line, but the other is high, the latter is completely disconnected from it, because the SDL state is not consistent with the high state of its internal line.

The continuation of the arbitration may take several bits. Due to the fact that the address and then the data are transferred first, the arbitration can take up to the end of the address, and if the same device is addressed by the presenters, then in this case various data will also take part in the arbitration. Due to this arbitration scheme, in the event of any collisions, data will not be lost.

If the master loses the arbitration, then in this case he can give out synchronization pulses in the SCL until the end of the byte, during which access was lost.

Source: https://habr.com/ru/post/G11912/


All Articles