I2C与SMBus的区别SMBus是一种二线制串行总线,1996年第一版规范开始商用。它大部分基于I2C总线规范。和I2C一样,SMBus不需增加额外引脚,创建该总线主要是为了增加新的功能特性,但只工作在100KHZ且专门面向智能电池管理应用。它工作在主/从模式:主器件提供时钟,在其发起一次传输时提供一个起始位,在其终止一次传输时提供一个停止位;从器件拥有一个唯一的7或10位从器件地址。SMBus与I2C总线之间在时序特性上存在一些差别。首先,SMBus需要一定数据保持时间,而I2C总线则是从内部延长数据保持时间。SMBus具有超时功能,因此当SCL太低而超过35ms时,从器件将复位正在进行的通信。相反,I2C采用硬件复位。SMBus具有一种警报响应地址(ARA),因此当从器件产生一个中断时,它不会马上清除中断,而是一直保持到其收到一个由主器件发送的含有其地址的ARA为止。SMBus只工作在从10kHz到最高100KHZ。最低工作频率10kHz是由SMBus超时功能决定的。ComparingtheI2CBustotheSMBusAbstract:TheI2CbusandtheSMBusarepopular2-wirebusesthatareessentiallycompatiblewitheachother.Normallydevices,bothmastersandslaves,arefreelyinterchangeablebetweenbothbuses.Bothbusesfeatureaddressableslaves(althoughspecificaddressallocationscanvarybetweenthetwo).Thebusesoperateatthesamespeed,upto100kHz,buttheI2Cbushasboth400kHzand2MHzversions.Completecompatibilitybetweenbothbusesisensuredonlybelow100kHz.ThisapplicationnotefocusesonthesignificantdifferencesbetweenI2CandSMB.TheI2CbusandtheSMBusarepopular2-wirebusesthatareessentiallycompatiblewitheachother.Normallydevices,bothmastersandslaves,arefreelyinterchangeablebetweenbothbuses.Bothbusesfeatureaddressableslaves(althoughspecificaddressallocationscanvarybetweenthetwobuses).Thebusesoperateatthesamespeed,upto100kHz,buttheI2Cbushasboth400kHzand2MHzversions.Obviously,completecompatibilitybetweenbothbusesusingalldevicesisensuredonlybelow100kHz.Thisapplicationnotefocusesonthesignificantdifferencesbetweenthetwobuses.AlthoughitisassumedthatthereaderhassomeknowledgeoftheI2Cbusand/ortheSMBus,let'sfirstreviewsomeprotocolbasics:StartandStopevents.Theseareespeciallyimportantinthattheyarewaysofsignalingtoaninterfacethatitneedstogotoaninitializedorresetstate.DataandClockmustbehightogenerateStartandStop.Amastercan'tgenerateaStartorStopunlessboththeData(SDAforI2CandSMBDataforSMBus)andClock(SCLforI2CandSMBClkforSMBus)linesarefree(notpulledlow).Thisisaconsequenceofbeinganopen-collectorbus.StartandStopconditionsaretheonlytimestherewillbeatransitionontheDatalinewhileClockishigh.DatacanchangestateonlywhenClockislowduringacommunication.ThedataonDatamustalwaysbereadyjustpriortoahighonClockandbechangedonlyafterClockhasgonelow(withtheexceptionofStartandStop).Figure1.Atypicalcommunication,showingtheStartandStopconditions.TimeoutandClockSpeedTimeoutand(asaconsequenceoftimeout)minimumclockspeedarethemostimportantdifferencesbetweentheI2CbusandtheSMBus.I2CBus=DC(notimeout)SMBus=10kHz(35mStimeout)TimeoutiswhereaslavedeviceresetsitsinterfacewheneverClockgoeslowforlongerthanthetimeout,typically35mSec.Useofatimeoutalsodictatesaminimumspeedfortheclock,becauseitcannevergostatic.Thus,theSMBushasaminimum-clock-speedspecification.Bycomparison,theI2Cbuscangostaticindefinitely.IntheI2Cbus,eitheramasteroraslavecanholdtheclocklowaslongasnecessarytoprocessdata.Allofthiscomesaboutasaresultofhowthetwobusesdealwithslaveerrorsandrecoveringfromthoseerrors.Tounderstanderrorrecovery,considerthattherearetwostates,StartandStop,whichonaproperlydesignedI2CorSMBusslavedictatethatt...