What is I2C

The online magazine for electronic circuits for PARTICIPATE

The I2C bus - what is it?

01.11.2007     08.04.2008     mborchers (beginners) i2cbus introduction

introduction

Many have probably heard of this bus before, but don't even know what it is. I asked myself this question too, so I took a look on the internet. The information literally overwhelmed me.

Luckily I saw a report in the computer club about the Lallus. In this project (by Wolfgang Back) the I2C bus was used because the C-Control only had a few free I / O ports.
The PCF 8574 was used there as the central component. So I took a look at Philips' homepage and downloaded the data sheet.

Well, that was the beginning and I started.

But now to the actual topic: What is the I2C bus?

In many modern electronic systems, communication between the individual components is often required. But you don't want to put umpteen lines through the whole system either, so one goal was to use as few lines as possible.

I2C-Bus is called Inter IC-Bus, in English: A bus that enables or should provide communication between different integrated circuits.

Philips is the mother of this bus, which has become the quasi-standard. Sometimes it is also called a 2-wire bus, which is not unreasonable, since the bus actually only needs 2 bidirectional lines (ground and supply voltage not included).

The first line is called SDA (= serial data). The actual data is transmitted serially via these lines.

The second line is called SCL (= serial clock). The clock pulses are sent here.

The original specifications stipulated a maximum bus speed of 100 kHz. For today's applications, however, this is sometimes no longer sufficient, so the specifications have been revised. But more on that later.

Each I2C base unit can be selected via a 7-bit wide address "byte" (this has also been revised, see 10-bit addresses). The 8th bit of the address byte indicates whether read or write access is to be made to the block. The following bytes then depend on the respective block.

Communication always takes place between a so-called master and a so-called slave. There are also multi-master modes, but I won't go into those in this article.
The master now sends a so-called start condition. As a result, all slaves on the bus are now listening and compare their address with the address requested by the master.
Now these two blocks can exchange data. When this is done, the master sends a stop condition. This frees the bus again and the game can start over.

Read access to a PCF 8574 looks like this:

 addressDevice sub-addressR / W Data 
begin0100xxx1ACKxxxxxxxxstop

The first four bits depend on the respective block and cannot be changed. The three following bits depend on the block itself, i.e. you can change this address as you wish (pins on the block are brought out for this purpose). This means that a total of 8 identical modules can be operated on one bus.
The eighth address bit now also indicates whether it is to be read or written.
Now the slave has to send an acknowledge to the master to confirm that it is present and ready. The master can now read out the actual data. If the master wants to read further data, it must send an acknowledge to the slave. If he does not need any further data, this does not happen and the stop condition is sent.

More details (timing, etc.) can be found in every data sheet, regardless of the I2C base.

An important feature should also be mentioned: It does not matter (upwards, i.e. slower) in which time interval these transmissions take place. I.e. a microcontroller does not have to adhere to precise timings in order to speak to its slave!

That's it for the basic stuff, I hope it's now clearer what the I2C bus is and what it's good for.

Fast fashion

In the meantime, the I2C bus has become a quasi-standard and more and more components have been developed. Originally it was only intended to exchange status information, but today text and data are transmitted. The 100kbit / s was soon no longer sufficient for this. Tim Taylor would say: "The bus needs more power, HOR HOR HOR!".
And that's how it was. Philips extended its specifications and now 400kbit / s could be transmitted. All of today's building blocks should support this.

High-speed mode

The high-speed mode was introduced for special RAM modules that required even higher transfer rates. Fast or normal mode devices CANNOT be connected to the same lines (if high-speed mode is to be used). In this case, two additional pins are brought out on a master with high-speed mode support for normal speeds. The master then takes over the conversion.

For further information I can unfortunately only refer to the specifications ...

10-bit addresses

Over time there were more and more devices and there was already overlapping of addresses. Fortunately, Philips has marked the slave addresses 11111xxx as "reserved", so it was now possible to introduce an extension of the addressing without disturbing the 7-bit devices. On the contrary, you can attach 7-bit devices and 10-bit devices to a bus!

With a 10-bit address, the transmission looks like this:

 reserved addressaddressR / W Address, part 2Device sub-address 
begin11110xx1ACKxxxxxxxxACK

The first 5 bits are the reserved address "11110" (Philips still reserves the address "11111" for further expansions). Then come the last 2 bits (i.e. the MSB) of the 10-bit address and the read / write bit. Several slaves now send their acknowledge. The master now transmits the last 8 bits of the address (i.e. LSB). Now only one slave reports with an acknowledge and the rest of the transmission can be carried out as with 7-bit addressing.


Comment written by ohne Name on March 20th, 2008 at 11:35 am:

Components? I don't know now whether you are referring to an I2C bus subscriber as a whole, or whether you want to use these "components" to address the schematic structure within a subscriber.
If your question relates to the former, there are a considerable number of components that can be networked with this bus. You can already see a small selection in the first graphic for this article, such as microcontrollers [with integrated "I2C-UART" or otherwise simply "simulated" in software on two I / O pins], various memory modules [mainly EEPROM], I / O extensions [if the controller has too few ports, or if you have to / want to simplify the layout on a large circuit board], AD converters, special interface modules [e.g. an LCD], various sensors [temperature, pressure and other environmental parameters], timers [RTC, Real Time Clock], digitally adjustable resistors [DigiPot, ...], etc ...
There really is one thing in different areas of application.
The "neighbor" of I2C, the so-called SMBus, is also used, for example, in every commercially available PC to collect certain data. (Fan speeds, voltage values, temperatures, etc.) The SMBus is even directed to the PCI Express slots, although I think it is rarely actually used because the data is more likely to be hunted via the fast differential bus.

Hope that helps a little ...


The comment function is only released for registered users.