I2C interface: description in Russian

Table of contents:

I2C interface: description in Russian
I2C interface: description in Russian
Anonim

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

  • certain "smart" control node, which in most cases is a single-chip microcomputer;
  • general purpose components such as LCD buffers, RAM, I/O ports, EEPROM or dedicated data converters;
  • specific components including digital tuning and signal processing circuits for video and radio systems.

How to optimize their application?

brief description of uart spi i2c interfaces
brief description of uart spi i2c interfaces

To make the most of these common solutions for the benefit of designers and manufacturers, as well as to improve the overall performance of various hardware and simplify the applied circuitry components, Philips set out to develop the simplest two-wire bidirectional bus that provides the most productive inter-chipcontrol. This bus provides data transfer via the I2C interface.

Today, the manufacturer's product range includes more than 150 CMOS, as well as bipolar devices compatible with I2C and designed to work in any of the categories listed. It should be noted 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. Due to the use of such a design solution, it was possible to solve a fairly large number of problems of interfacing various equipment, which is quite typical for the development of digital systems.

Key Benefits

i2c interface
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 then be programmatically addressed to a completely unique address. At any given time, there is a simple relation that allows the masters to act as master-transmitter or master-receiver.
  • This bus provides the ability to have several masters at once, providing all the necessary means for determining collisions, as well as arbitration to prevent data corruption in the event that two or more masters begin to transmit information simultaneously. In standard modeonly serial 8-bit data transmission is provided at a speed of no more than 100 kbps, and in fast mode this threshold can be increased four times.
  • The chips use a special built-in filter that effectively suppresses surges and ensures maximum data integrity.
  • The maximum possible number of chips that can be connected to one bus is limited only by its maximum possible capacity of 400 pF.

Benefits for Constructors

i2c interface lcd1602
i2c interface lcd1602

The I2C interface, as well as all compatible chips, can significantly speed up the development process, from a functional diagram to its final prototype. At the same time, it should be noted that due to the possibility of connecting such microcircuits directly to the bus without using all kinds of additional circuits, space is provided for further modernization and modification of the prototype system by disconnecting and connecting various devices from the bus.

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

  • The blocks on the functional diagram fully correspond to microcircuits, and at the same time, a fairly quick transition from functional to fundamental is provided.
  • There is no need to develop bus interfaces because the bus is already natively integrated into dedicated chips.
  • Integrated communication protocols anddevice addressing allows the system to be completely software-defined.
  • The same types of microcircuits, if necessary, can be used in completely different applications.
  • Total development time is significantly reduced due to the fact that designers can quickly become familiar with the most commonly used functional blocks, as well as various microcircuits.
  • If desired, you can add or remove chips from the system, and at the same time not have much effect on other equipment connected to the same bus.
  • Total software development time can be significantly reduced by allowing a library of reusable software modules.

Among other things, it is worth noting the extremely simple procedure for diagnosing the failures that have occurred and further debugging, which the I2C interface differs from. The description suggests that, if necessary, even minor deviations in the operation of such equipment can be instantly monitored without any difficulty and, accordingly, appropriate measures can be taken. It is also worth noting that designers get 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 allows you to provide the following important advantages:

  • Sufficiently high degree of resistance to any emerging interference.
  • Ultimatelylow power consumption.
  • Widest supply voltage range.
  • Wide temperature range.

Benefits for technologists

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

  • A standard two-wire serial bus with this interface minimizes interconnects between ICs, meaning there are fewer pins and fewer tracks required, making PCBs less expensive and much smaller.
  • A fully integrated I2C interface LCD1602 or some other option completely eliminates the need for address decoders and other external small logic.
  • It is possible to use several masters on such a bus at the same time, which significantly speeds up testing and subsequent equipment setup, since the bus can be connected to an assembly line computer.
  • The availability of ICs compatible with this interface in VSO, SO, and custom DIL packages can significantly reduce device size requirements.

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

Further modernization of equipment and expansion of its functions can be carried out by means of a standard connection to the bus of the corresponding microcircuit using the Arduino 2C interface or any other from the available list. If a larger ROM is required, then it will only be enough to select another microcontroller with an increased ROM. Since updated chips can completely replace old ones if necessary, you can easily add new features to equipment or increase its overall performance by simply disconnecting obsolete 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 program addressing, one of the most ideal platforms for ACCESS.bus is 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
i2c interface description in Russian

For modern applications8-bit control, which uses microcontrollers, it is possible to set some design criteria:

  • complete system mostly includes one microcontroller and other peripherals, including memory and various I/O ports;
  • total cost of combining different devices within one system should be minimized as much as possible;
  • the system that controls the functions does not provide for the need to provide high-speed information transfer;
  • total efficiency is directly dependent on the equipment chosen as well as the nature of the connecting bus.

To design a system that fully meets the listed criteria, you need to use a bus that will use the I2C serial interface. Although the serial bus does not have the bandwidth of the parallel bus, it requires fewer connections and fewer chip pins. 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 communicate using software emulation of the I2C interface or the corresponding bus must have a specific protocol that allows you to prevent various possibilities of collisions, loss or blocking of information. Fast devices should be able to communicate with slow ones, and the system should not depend onfrom the equipment connected to it, as otherwise all improvements and modifications will not be able to be used. It is also necessary to develop a procedure with the help of which it is realistic to establish which particular device is currently providing bus control and at what point in time. In addition, if different devices with different clock frequencies are connected to the same bus, you need to decide on the source of its synchronization. All these criteria are met by the I2C interface for the AVR and any others from this list.

Main Concept

i2c interface specification description in Russian
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 its unique address, regardless of whether it is an LCD buffer, microcontroller, memory or keyboard interface, and can act as a receiver or transmitter, depending on what it is for. intended for this equipment.

In the vast 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, according to the process of moving information, devices can be classified as slave and master.

In this case, the master is the device that initiates the data transfer, and also generatessynchronization 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 able to connect to it. The ability to use more than one microcontroller on the same bus means that more than one master can be forwarded at any given time. To eliminate the potential chaos that risks appearing when such a situation arises, a specialized arbitration procedure has been developed that uses the I2C interface. Expanders and other devices provide for connecting devices to the bus according to the so-called wiring rule.

Generating the clock signal is the responsibility of the master, and each master generates its own signal during data transfer, and it can only change later if it is "pulled" by a slow slave or another master when a collision occurs.

General parameters

Both SCL and SDA are bi-directional lines that connect to a positive power supply with a pull-up resistor. When the tire is absolutely 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 wired AND function can be provided. Information through the I2C interface can be transmitted at a speed of no more than 400 kbpsfast mode, while the standard speed does not exceed 100 kbps. The total number of devices that can be simultaneously connected to the bus depends on only one parameter. This is the line capacitance, which is no more than 400 pf.

Confirmation

i2c interface description
i2c interface description

Confirmation is a mandatory procedure in the data transfer process. The master generates the appropriate sync pulse while the transmitter releases the SDA line during this sync pulse as an acknowledgment. After that, the receiver must ensure that the SDA line is held stable during the clock high state in a stable low state. In this case, be sure to take setup and hold times into account.

In the vast majority of cases, it is mandatory for the addressed receiver to generate an acknowledgment after each byte received, with the only exception being when the start of the transmission includes a CBUS address.

If the receiver-slave has no way to send confirmation of its own address, the data line should be left high, and then the master will be able to issue a "Stop" signal, which will interrupt the sending of all information. If the address has been confirmed, but the slave cannot receive any more data for a long time, the master must also interrupt the sending. To do this, the slave does not acknowledge the next byte received and simply leaves the linehigh, causing the master to generate a stop signal.

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

To check if the equipment is working, you can try to enter standard examples of sketches for the I2C interface in Arduino, as in the photo above.

Arbitration

2c arduino interface
2c arduino interface

Masters can start sending information only after the bus is completely free, but two or more masters can generate a start signal at the minimum hold time. This eventually results in a specific "Start" signal on the bus.

Arbitration works on the SDA bus while the SCL bus is high. If one of the masters starts transmitting a low level on the data line, but at the same time the other one is high, then the latter is completely disconnected from it, because the SDL state is not corresponding to the high state of its internal line.

Arbitrage may continue over several bits. Due to the fact that the address is transmitted first, and then the data, arbitration can last until the end of the address, and if the masters will addressthe same device, then different data will also participate in the arbitration. Due to this arbitration scheme, no data will be lost if any collision occurs.

If the master loses the arbitration, then it can issue clock pulses in SCL until the end of the byte, during which access was lost.

Recommended: