I2C Notes
I²C(Inter-Integrated Circuit)是一种支持多Master、多Slave、单端的串行总线,由Philips Semiconductor(现在是NXP Semiconductors开发),主要用于将低速外围IC连接到处理器和微控制器。I²C Slave需要向NXP缴纳一定的费用来获得唯一的地址。
这里还需要提一下SMBus总线,它由Intel定义,是I²C的一个子集,相较于I²C更严格,提升了健壮性和可交互性。现代的I²C系统都采用了SMBus定义的策略和规则,有时候会同时支持I²C和SMBus,只需要简单的配置即可。
I²C只需要两个双向的open-drain连线,分别是Serial Data Line (SDA)和Serial Clock Line (SCL),使用电阻上拉。典型的电压是+5 V或者+3.3 V,但是其他的电压也是可以用的。
I²C的参考设计使用7-bit或10-bit(依赖于所用的设备)的地址空间。常见的I²C总线速度为,Standard Mode下100 kbit/s,Low-speed Mode下10 kbit/s,但是规范也允许使用更低的时钟频率。最近的规范修订可以支持更多的节点和更高的速度(Fast Mode下400 kbit/s、Fast Mode Plus下1 Mbit/s、High Speed Mode下3.4 Mbit/s)。These speeds are more widely used on embedded systems than on PCs. There are also other features, such as 16-bit addressing.
Note the bit rates are quoted for the transactions between master and slave without clock stretching or other hardware overhead. Protocol overheads include a slave address and perhaps a register address within the slave device as well as per-byte ACK/NACK bits. Thus the actual transfer rate of user data is lower than those peak bit rates alone would imply. For example, if each interaction with a slave inefficiently allows only 1 byte of data to be transferred, the data rate will be less than half the peak bit rate.
The maximum number of nodes is limited by the address space, and also by the total bus capacitance of 400 pF, which restricts practical communication distances to a few meters.