Embedded System - I2C Home : www.sharetechnote.com
I2C / TWI
I2C or I2C came from the term Inter Integrated Circuit. You see two 'I's and one 'C' here. That's how 'I2' or 'I2' came from. Then, what does it mean ? What does it do ?
Since I2C is implemented by only Two Wires (SDA, SCL), it is also called TWI (Two Wire Interface).
It is a kind of serial communication technology which is originally designed for exchanging data between multiple IC chips. This is very simple communication mechanism and I think very smartly designed. It requires only two lines as shown below. One of the line is used for sending Clock signal and the other line is to send/receive data. Also, these two lines can be shared by multiple devices. This communication works as Master-Slave mode. One Master can control / communicate multiple Slaves.
Another good (may be confusing sometimes) there can be multiple Master on the line as shown below.
Even though I said you need only two lines in I2C, in real application you would need a couple of more lines because we need to supply Power to each of the connected chipset and common ground as shown below. Because of this, you would see 4 wires attached to a device (small I2C modules) that use I2C.
Then your question is how a Master can send to /control data to a specific Slave. I think you can easily guess how. Each of the Slave device should have a unique address and Master specifies a unique slave address when it sends data or command as shown below.
<I2C Specification - Rev .6 - Fig 11. A master-transmitter addressing a slave receiver with a 7-bit address >
You may easily guess that I2C data rate may vary since it has its own clock line. Theoretically, you can achieve different data rate by changing clock rate. However, I2C is also a kind of hardware that is limited by various physical factors. So the data rate of I2C would be within a certain range.
Typical clock rate of I2C is a few hundred KHz. Since I2C data line works only two level (0 or 1), the data rate would also be a few hundred Kbps (should be a little bit lower than Clock cycle).
I haven't found any specific answer from I2C specification, but I have read through many pages on the web stating various numbers based on experience.
As it's name Inter Integrated Circuit, it was originally designed for communication between multiple ICs being placed not far away from each other. So I think it would be safe to say 'less than 1 m' as communication distance, but you would see many people states that they made it work over several meters or several tens of meters.
In most of the Embedded Board, you would find both I2C and SPI pins and then you would ask yourself which one to use.
The answer would be given partly by personal preference and partly by the nature of the application you want to implement. I think most important criteria you may think of would be as follows