The Celtic Engineer is a weekly newsletter produced by Celtic Engineering Solutions. We hope you enjoy it. If you have any suggestions for topics, would like to give feedback or want your email added to the distribution list please send an email to [email protected].
I2C was designed by Philips in 1982 to communicate between components that were on a single printed circuit board. This communication between chips or Inter chip communication or Inter IC became IIC and then I2C. The original transfer rate had a maximum of 100 kbits per second and a 7 bit address space. In 1998 the bus was expanded to 400 kbit/sec and 10-bit addressing mode. Over the years the speed has increased and in 2012 Version 4 was released, called Ultra Fast-mode(UFm), that has a transfer rate of 5 MHz and a 16 bit address space.
How does it work?
The bus is said to be a two wire communication bus, plus power and ground. The usual voltage level of the bus is either 5 volts or 3.3 volts. The two communications lines are called SDA (Serial Data line) and SCL (Serial Clock line). While the communication is between two devices, multiple devices may be attached, each with a unique address. The number of devices is limited by the address space (7 or 10 bit for conventional addressing, up to 16 bit for modern addressing). An additional constraint that limits the number of devices on a bus is the total bus capacitance cannot exceed 400 pF. Not only does this restrict the number of devices on the bus but it also restricts the distance between them to several meters at most.
Who is in charge of this bus anyway?
here are two types of devices on the bus. These devices are called nodes. There are master nodes and slave nodes. The protocol allows for multiple masters to be on a single bus, but only one can have control of the bus at a time. The master device is the one that provides the clock signal and while a given master can talk to all the slave devices, masters cannot communicate with another master device.
The outputs are open collects, not driven. The selection of pull up resistors is important. A good place to start is with 4.7 kΩ. Depending on the number of devices and bus capacitance, this value may have to be decreased. While there exists the possibility of collisions, requiring bus arbitration protocol, the open collector nature of the bus means these collisions cannot cause damage to either device as could happen if a push pull configuration were used.
There are 4 possible modes of communication: 1) master transmit – the master sends data to the slave, 2) master receive – master receives data from the slave, 3) slave transmit – slave sends data to the master and 4) slave receive – slave receives data from the master. Regardless of the mode the master is the device that produces the clock pulses on the SCL line.
I’ve been Framed
There are two types of frames in I2C communications. One is called the address frame and it is always the first frame sent when initiating communications. The other frame is the data frame. There can be multiple data frames in a given communication exchange.
September 29, 2016
A communication exchange starts with a start condition. This is when the master pulls the SDA line low while the SCL is left high. This lets all the slave devices know that a transmission is about to take place. The first piece of information transmitted is the address frame. All the slaves receive this frame and evaluate it. If the address that is sent matches the address in its receive buffer it knows the message is directed at them. Otherwise, it is not and they ignore the rest of the transmission.
One at a time please
Since more than one master can be on a bus, an arbitration protocol must be set up to deal with collisions. Individual masters will monitor the SDA and SCL lines and will not begin a communication exchange if the bus is busy. However, it is possible that two master start communicating at the same time. As they transmit their messages, they are also reading back what is on the bus. The open collector nature of the bus means that if one master sends a high while a second sends a low, the low will win. The first master will see the bus went low when it wanted it high. It will realize that another master must be communicating and will immediately stop its transmission and wait until the bus is free. This process is called arbitration.
When do I use I2C?
This bus was initially intended to communicate on a single board, but as long as the overall transmission length is short, it can be transmitted to adjacent boards. It is very common to use this type of communication between a microcontroller (MCU), and a peripheral such as a real time clock (RTC), flash memory or EEPROM, another MCU, DAC’s and ADC’s, OLED and LED displays and a whole host of sensors.
his newsletter is sponsored by Celtic Engineering Solutions LLC, a design engineering firm based out of West Jordan, Utah, which can be found on the web at www.celticengineeringsolutions.com. You can find the newsletter on the company blog, LinkedIn or by subscribing. Send your emails to The Celtic Engineer at [email protected].