1、I2C 与 SMBus 的区别SMBus 是一种二线制串行总线,1996 年第一版规范开始商用。它大部分基于 I2C 总线规范。和 I2C 一样,SMBus 不需增加额外引脚,创建该总线主要是为了增加新的功能特性,但只工作在 100KHZ 且专门面向智能电池管理应用。它工作在主/从模式:主器件提供时钟,在其发起一次传输时提供一个起始位,在其终止一次传输时提供一个停止位;从器件拥有一个唯一的 7 或 10 位从器件地址。 SMBus 与 I2C 总线之间在时序特性上存在一些差别。首先,SMBus 需要一定数据保持时间,而 I2C 总线则是从内部延长数据保持时间。SMBus 具有超时功能,因此当
2、SCL 太低而超过 35 ms 时,从器件将复位正在进行的通信。相反,I 2C 采用硬件复位。SMBus 具有一种警报响应地址(ARA),因此当从器件产生一个中断时,它不会马上清除中断,而是一直保持到其收到一个由主器件发送的含有其地址的 ARA 为止。SMBus 只工作在从 10kHz 到最高 100KHZ。最低工作频率 10kHz 是由 SMBus 超时功能决定的。Comparing the I2C Bus to the SMBusAbstract: The I2C bus and the SMBus are popular 2-wire buses that are essentially
3、 compatible with each other. Normally devices, both masters and slaves, are freely interchangeable between both buses. Both buses feature addressable slaves (although specific address allocations can vary between the two). The buses operate at the same speed, up to 100kHz, but the I2C bus has both 4
4、00kHz and 2MHz versions. Complete compatibility between both buses is ensured only below 100kHz. This application note focuses on the significant differences between I2C and SMB. The I2C bus and the SMBus are popular 2-wire buses that are essentially compatible with each other. Normally devices, bot
5、h masters and slaves, are freely interchangeable between both buses. Both buses feature addressable slaves (although specific address allocations can vary between the two buses). The buses operate at the same speed, up to 100kHz, but the I2C bus has both 400kHz and 2MHz versions. Obviously, complete
6、 compatibility between both buses using all devices is ensured only below 100kHz.This application note focuses on the significant differences between the two buses. Although it is assumed that the reader has some knowledge of the I2C bus and/or the SMBus, lets first review some protocol basics: Star
7、t and Stop events. These are especially important in that they are ways of signaling to an interface that it needs to go to an initialized or reset state. Data and Clock must be high to generate Start and Stop. A master cant generate a Start or Stop unless both the Data (SDA for I2C and SMBData for
8、SMBus) and Clock (SCL for I2C and SMBClk for SMBus) lines are free (not pulled low). This is a consequence of being an open-collector bus. Start and Stop conditions are the only times there will be a transition on the Data line while Clock is high. Data can change state only when Clock is low during
9、 a communication. The data on Data must always be ready just prior to a high on Clock and be changed only after Clock has gone low (with the exception of Start and Stop). Figure 1. A typical communication, showing the Start and Stop conditions. Timeout and Clock SpeedTimeout and (as a consequence of
10、 timeout) minimum clock speed are the most important differences between the I2C bus and the SMBus.I2C Bus = DC (no timeout)SMBus = 10kHz (35mS timeout) Timeout is where a slave device resets its interface whenever Clock goes low for longer than the timeout, typically 35mSec. Use of a timeout also d
11、ictates a minimum speed for the clock, because it can never go static. Thus, the SMBus has a minimum-clock-speed specification. By comparison, the I2C bus can go static indefinitely. In the I2C bus, either a master or a slave can hold the clock low as long as necessary to process data.All of this co
12、mes about as a result of how the two buses deal with slave errors and recovering from those errors. To understand error recovery, consider that there are two states, Start and Stop, which on a properly designed I2C or SMBus slave dictate that the slave interface go to a specific state. In the case o
13、f a Start, the interface should initialize itself and be ready to receive a communication. This should occur regardless of what preceded the Start condition (for example, if the slave was in the middle of a communication in which the master got confused and had to start over). In the case of a Stop,
14、 an interface should again initialize itself, but should be expecting a Start prior to any new communication. Both Starts and Stops are the only Data transitions that take place when Clock is high. In order for the transitions on Data to take place, the Data line (and the Clock line) must be “free“
15、to allow the master to place highs and lows on the line as it needs.In the I2C bus, if the slave locks up and holds either Clock or Data low, error recovery is impossible. Very few slave devices actually have the ability to hold Clock. As a result, the most common bus error is slave devices that hav
16、e ended up in a state where Data (the data line) is low. In the I2C bus, a master accomplishes error recovery by clocking Clock until Data is high and then issuing a Start followed by a Stop.In contrast to the I2C bus, SMBus slaves are expected to reset their interface whenever Clock is low for long
17、er than the timeout specified in the SMBus specification of 35mS. As such, SMBus masters such as the Intel PIIX4 dont have any error recovery routine built in. In reality, slave devices need to examine both Clock and Data, even though the SMBus specification doesnt dictate that. This should be done,
18、 as experience has shown that slaves in an error state can hold Data low, even though Clock can be high. Implementing timeout exactly according to the SMBus specification doesnt address this error mode. Table 1. Considerations for Mixing Devices and Masters with Regard to TimeoutI2C Slave SMB SlaveI
19、2C Master Clock must be 10kHz SMB Master Potential for bus lockup The SMBus is limited to a clock speed of 100kHz, whereas I2C permits speeds up to 400kHz. Logic LevelsDespite differences in logic-level specifications between the two buses, generally devices can be mixed and matched with abandon. It
20、 has proven rare that either an SMBus or an I2C bus has had a fault due to level differences. This may come as a surprise when we compare the respective level specifications as shown in Figure 1.Figure 2. This is a comparison of level specifications between the I2C bus and the SMBus. I2C-VDD-related
21、 high and low value ranges are shown for power supplies from 3 volts to 5 volts.For further comparison, Table 2 lists the specifications together.Table 2. Level Specifications for the I2C Bus and the SMBusVDD is typically expected to be between 3 volts and 5 volts. High I2C VDD Dependent 0.7 * VDDI2
22、C Fixed 3.0 V SMBus 2.1 V Low I2C VDD Dependent 0.3 * VDD I2C Fixed 1.5 V SMBus 0.8 V Although there may seem to be quite a bit of difference between level specifications, device interchangeability has not been shown to be a problem in this regard. This is because masters and slaves virtually always
23、 have output-voltage swings close to the full supply voltage. Pullup Resistors and Current LevelsWhat wasnt readily evident in the discussion of voltage levels is that these levels are also specified with different currents between the buses. The SMBus specifies a minimum sink current of 100A, and a
24、 maximum of 350A, compared to 3mA for the I2C bus. This in turn would determine the lowest acceptable value of the pullup resistor, examples of which are shown in the table below.Table 3. Minimum Pullup Resistor Values per Bus Specifications3V VDD 5V VDD I2C Bus 1k 1.6k SMBus 8.5k 14k In reality, it
25、 is not unusual to encounter pullup resistor values in SMBus systems, which violate this specification by being lower than recommended. A very popular range for pullup resistor values, even in some SMBus systems, seems to be 2.4k to 3.9k. General Call and Alert ResponseThe I2C bus has an address cal
26、led General Call, which is 0000 000, and all slaves designed to respond to the General Call will act accordingly. This is a means by which several devices on the system can be communicated with simultaneously.The SMBus also has a provision for a line called ALERT#, not to be confused with the I2C Ge
27、neral Call address. This line acts as an interrupt to the SMBus master. Upon receipt of an interrupt, the SMBus master can issue an Alert Response. This Alert Response is sent to address 0001 100, and any slave device that generated an interrupt attempts to identify itself by putting its own address
28、 on the bus. The device with the lowest address will dominate (due to the open-collector bus). If it is serviced and cleared, the master can repeat the process and work up through any other interrupts that may have occurred. Other Little DetailsThere are subtler issues having to do with rise and fal
29、l times and bus capacitance that are generally not a concern. In addition, there are some protocol differences with regard to use of Acknowledge and No Acknowledge conditions that are rarely encountered. With most mainstream choices of masters and slaves, none of these factors is typically a problem
30、. Summary of Significant Differences1. Timeout and minimum clock speed 2. Voltage levels 3. Pullup resistor values and current levels Table 4. ComparisonsI2C SMBusTimeout No Yes Minimum Clock Speed DC 10kHz Maximum Clock Speed100kHz (400kHz and 2MHz also available) 100kHz VHIGH 0.7 * VDD, 3.0 V Fixed 2.1V VLOW 0.3 * VDD, 1.5 V Fixed 0.8V Max I 3mA 350A Clock Nomenclature SCL SMBCLK Data Nomenclature SDA SMBDAT General Call Yes Yes Alert# No Yes