I2C Basics:

Note:

This guide is purposefully simple and does not address some of the more intricate details of I2C (for now). For more information on I2C, please refer to the following: NXP UM10204 I2C-bus specification and user manual.

Another thing worth noting is that traditionally, electrical engineers used “master/slave” to refer to I2C devices and these terms are often found in reference materials. To avoid confusion when reading, please note that this document is aligned with the latest I2C specification (I2C v.7) which updated these terms to be “controller/target”.

What is I2C?

Protocol Details:

I2C Communication Modes:

I2C Mode: Speed (<=) Bus Direction
Standard Mode (SM) 100 Kbps Bidirectional
Fast Mode (FM) 400 Kbps Bidirectional
Fast Mode Plus (FM+) 1 Mbps Bidirectional
High Speed Mode (HS-Mode) 3.4 Mbps Bidirectional
Ultra-Fast Mode (UFM) 5 Mbps Unidirectional

Circuit Description:

Image of an I2C bus.

Pullup resistors pull SDA and SCL up to VDD. This is required for I2C since the protocol is designed to have open drain (CMOS) or open collector (BJT) devices on the bus. This way each device can easily pull the line low with one transistor instead of using two in a push pull configuration. Another benefit of this configuration is that the bus cannot be crowded by two devices trying to pull a line to opposite logic levels. This can result in indeterminate behavior and high currents flowing from high to low potential (see diagram).

Image of an open drain device pulling a line low.
Push-pull configuration with indeterminate behavior (bus gets pulled to vdd/2).

Basic I2C Communication Frame Structure:

In a system with multiple controllers, a controller may use a general call to identify themselves to other devices on the bus (See Reserved Addresses and section 3.1.13 of the I2C spec NXP UM10204).

Anatomy of an I2C Waveform:

Example I2C frame with two bytes of data transfer:

             S
             T                                                                                                           N   S
             A                               R   A                                   A                                   A   T
             R                               /   C                                   C                                   C   O
     FREE    T       A5  A4  A3  A2  A1  A0  !W  K   D7  D6  D5  D4  D3  D2  D1  D0  K   D7  D6  D5  D4  D3  D2  D1  D0  K   P   FREE
     ______      __  __  __  __  __  __  __  __      __  __  __  __  __  __  __  __      __  __  __  __  __  __  __  __  __      ____...
SDA:       \    /  \/  \/  \/  \/  \/  \/  \/  \    /  \/  \/  \/  \/  \/  \/  \/  \    /  \/  \/  \/  \/  \/  \/  \/  \/  \    /
            \__/\__/\__/\__/\__/\__/\__/\__/\__/\__/\__/\__/\__/\__/\__/\__/\__/\__/\__/\__/\__/\__/\__/\__/\__/\__/\__/    \__/

                 X   X   X   X   X   X   X   X   0   X   X   X   X   X   X   X   X   0   X   X   X   X   X   X   X   X   1

SCL: ──────────┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌───────...
               └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘

Reserved-Addresses:

I2C device addresses must not conflict with reserved addresses.

Target address R/!W bit Description
0000 000 0 General call
0000 000 1 START byte
0000 001 X CBUS address
0000 010 X Reserved for different bus formats on a shared bus
0000 011 X Reserved for future purposes
0000 1XX X Hs-mode controller code
1111 1XX 1 Device ID
1111 0XX X 10-bit target addressing

End!

There are still some concepts in I2C that still need to be covered and will probably be added later. In the interim if you need more details, the I2C specification is the most accurate source of information. Hopefully this overview helped you in some form or another!!