I2C interface: description in Russian
In modern household appliances, industrialelectronics and various telecommunications equipment, you can often find similar solutions, although products can be virtually unrelated. For example, almost every system includes the following:
- a certain "smart" control node, which in the majority of cases is a single-chip microcomputer;
- nodes of general purpose, such as LCD buffers, RAM, I / O ports, EPROM or specialized data converters;
- specific nodes, including schemes for digital adjustment and signal processing for video and radio systems.
How to optimize their application?
To ensure the most effectivethe use of such common solutions for the benefit of designers and manufacturers themselves, as well as for improving the overall performance of various equipment and simplifying the circuitry used, Philips aimed to develop an extremely simple two-wire bi-directional bus providing the most productive inter-microcircuit control. This bus provides data transfer via the I2C interface.
To date, the assortment ofThe manufacturer includes more than 150 CMOS, as well as bipolar devices that are compatible with I2C and designed to operate in any of the listed categories. It should be noted that the I2C interface is initially built-in to all compatible devices, due to which they can without any difficulties keep in touch with each other when using a special bus. Due to the use of such a design solution, it has been possible to solve a sufficiently large number of problems of interfacing various equipment, which is quite typical for the development of digital systems.
Main advantages
Even if you look briefly at the description of UART, SPI, I2C interfaces, you can distinguish the following advantages of the latter:
- To work, you need only two lines - synchronizationand data. Any device that connects to such a bus, in the future can be programmed to address a completely unique address. At any time, there is a simple relationship that allows the master to work as a master transmitter or master receiver.
- This bus provides an opportunity to haveat once several leading ones, providing all necessary means for determining collisions, as well as arbitration, which allows to prevent data corruption in the event that two or more leaders start simultaneously transmitting information. In the standard mode, only serial eight-bit data is transmitted at a speed of no more than 100 kbit / s, and in fast mode this threshold can be increased fourfold.
- The chips use a special built-in filter that effectively suppresses bursts 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.
Advantages for designers
Interface I2C, and also all compatible microcircuitsallow significantly accelerate the development procedure, from the functional scheme to its final prototype. It should be noted that due to the possibility of connecting such chips directly to the bus without the use of all possible 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 a lot of advantages that distinguish the I2C interface. 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 thus a sufficiently rapid transition from functional to principal is ensured.
- There is no need to develop bus interfaces, because the bus is already integrated into special chips.
- Integrated protocols for the transfer of information and addressing devices allow the system to be fully programmable.
- The same chip types can be used in completely different applications if necessary.
- Total development time is significantly reduced foran account of the fact that designers can quickly get acquainted with the most frequently used functional blocks, as well as all kinds of microcircuits.
- If desired, you can add or remove chips from the system, and at the same time do not have much influence on other equipment connected to the same bus.
- The total time of software development can be significantly reduced due to the fact that a library of reusable software modules is allowed here.
Among other things, it is worth notinga simple procedure for diagnosing the failures and further debugging, which is different I2C interface. The description shows that, if necessary, it is possible without any difficulty to immediately monitor even minor deviations in the operation of such equipment and, accordingly, take appropriate measures. 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 makes it possible to provide the following important advantages:
- A sufficiently high degree of resistance to any arising interference.
- Extremely low energy consumption.
- Wide range of supply voltage.
- Wide temperature range.
Advantages for technologists
It is worth noting that not only designers, but alsotechnologists quite often recently began to use a specialized I2C interface. The description in Russian indicates a rather wide range of merits, which are provided to this category of specialists:
- Standard two-wire serial bus withThis interface allows to minimize the connections between the microcircuits, that is, they have fewer contacts and fewer tracks, so that the printed circuit boards become less expensive and have much smaller dimensions.
- Fully integrated I2C interface LCD1602 or some other option completely eliminates the need for using address decoders, as well as other external fine logic.
- It is envisaged to usesimultaneously leading several on such a bus, which significantly speeds up the testing and subsequent configuration of the equipment, since the bus can be connected to the computer of the assembly line.
- The availability of interfaces compatible with this interface in VSO, SO and specialized DIL-package allows to significantly reduce the requirements for the size of the device.
This is only a short list of the benefits thatdifferent I2C interface LCD1602 and others. In addition, compatible chips allow you to 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 the modern level. Thus, it is possible to develop a whole family of different equipment, using as a basis a certain basic model.
Further equipment modernization and expansionits functions can be carried out by means of a standard connection to the bus of the corresponding microcircuit using the Arduino 2C interface or some other of the available list. If you require the provision of a larger ROM, then in this case it will be sufficient only to select another microcontroller having an increased ROM capacity. 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 means of the usual disconnection of the obsolete chips and their further replacement with newer equipment.
ACCESS.bus
Due to the fact that the bus has a two-wirenature, and also the possibility of program addressing, for ACCESS.bus one of the most ideal platforms is the I2C interface. Specification (the description in Russian is presented in the article) of this device makes it a much cheaper alternative to the actively used RS-232C interface for connecting various peripherals to computers using a standard four-pin connector.
Introduction to the specification
For modern 8-bit control applications that use microcontrollers, it is possible to set some design criteria:
- the full system mainly includes one microcontroller and other peripheral devices, including memory and all kinds of I / O ports;
- the total cost of combining various devices within one system should be extremely minimized;
- the system entrusted with the management functions does not imply the need for high-speed information transfer;
- The overall efficiency depends directly on the equipment chosen, as well as on the nature of the connecting bus.
To develop a system that is fully compliantlisted criteria, you need to use the bus, which will use the serial interface I2C. Despite the fact that the serial bus does not have parallel bandwidth, it requires fewer connections, as well as fewer microcircuit contacts. In this case, you should not forget that the bus includes not only connecting wires, but also various procedures and formats necessary to ensure communication within the system.
Devices for which communication is usedSoftware emulation of the I2C interface or the corresponding bus must have a specific protocol that allows you to preempt various possibilities of collision, loss or blocking of information Fast devices must be able to communicate with slow ones and the system should not depend on the equipment connected to it, 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 specific device currently controls the bus and at which point in time. In addition, if different 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 the AVR and any other of this list.
Basic concept
I2C bus can support any usedtechnology manufacturing chips. The LabVIEW I2C interface and others similar to it provide for the use of two lines to transfer information — data and synchronization. Any device connected in this way is recognized by a unique address, regardless of whether it is a LCD buffer, microcontroller, memory, or keyboard interface, and it can work as a receiver or transmitter depending on what exactly this equipment is intended.
In the majority of cases LCD-bufferIt is a standard receiver, and the memory can not only receive, but also transmit various data. In addition, according to the process of moving information devices can be classified as driven and leading.
In this case, the master is the device,which initiates data transfer, and also generates synchronization signals. In this case, any addressable devices will be considered slave with respect to it.
The I2C communication interface provides for immediate availability.several leaders, that is, more than one device capable of controlling the bus, is able to connect to it. The possibility of using more than one microcontroller on one bus suggests that more than one master can be sent at a certain point in time. To eliminate the potential chaos that risks to arise when such a situation arises, a specialized arbitration procedure has been developed, which the I2C interface uses. Expanders and other devices provide for the connection of devices to the bus according to the so-called installation rule I.
The generation of the clock signal isthe master's duty, and each of them generates its own signal in the data transfer process, and in the future it can be changed only if it is “pulled out” by a slow slave device or another master when a collision occurs.
Common parameters
Both SCL and SDA arebi-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 installation I function can be provided. Information via the I2C interface can be transmitted at a speed of no more than 400 kbps in fast mode, while in standard mode 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 a line capacity of not more than 400 pf.
the confirmation
Acknowledgment is a requiredprocedure in the data transfer process. The master generates a corresponding synchronization pulse, while the transmitter releases the SDA line during this sync pulse as confirmation. After this, the receiver must ensure stable retention of the SDA line during the high state of the sync pulse in a consistently low state. In this case, it is necessary to take into account the time of installation and retention.
In most casesThe addressed receiver must generate an acknowledgment after each byte received, and the only exception here is when the starting point includes a CBUS address.
If the slave-receiver is not possiblesend confirmation of your own address, you need to leave the data line in a high state, and after that the presenter will have the possibility of issuing a "Stop" signal, which will stop sending all the information. If the address has been confirmed, but the slave cannot receive any data for a longer time, the package must also be interrupted by the master. To do this, the slave does not confirm the next received byte 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 shipment procedure providesthe presence of the master receiver, in which case he must inform the slave about the end of the transfer, and this is done by not confirming the last byte received. At the same time, the slave-transmitter immediately releases the data line so that the master can give a "Stop" signal or repeat the "Start" signal again.
To check the equipment performance, you can try to enter standard examples of sketches for the I2C interface in Arduino, as in the photo above.
Arbitration
Leading can start sending informationonly after the tire is completely released, but two or more leaders can generate a start signal at the minimum retention time. This ultimately leads to a specific “Start” signal on the bus.
The work of arbitration is carried out on the SDA bus in thosemoments while the SCL bus is in high condition. If one of the leaders starts to transmit a low level to the data line, but the other is high, then the latter completely disconnects from it, because the SDL state is not corresponding to the high state of its internal line.
Arbitration may be continued onover several bits. Due to the fact that the address is transmitted first, and then the data, the arbitration can have a duration until the end of the address, and if the same device is addressed to the leading ones, then different data will take part in the arbitration. Due to this arbitration scheme, if there are any collisions, the data will not be lost.
If the master loses the arbitration, then he can issue synchronization pulses in the SCL until the end of the byte, during which access was lost.