SPI四种模式区别演示教学.doc

SPI四种模式区别演示教学.doc

ID:60849899

大小:125.00 KB

页数:4页

时间:2020-12-23

SPI四种模式区别演示教学.doc_第1页
SPI四种模式区别演示教学.doc_第2页
SPI四种模式区别演示教学.doc_第3页
SPI四种模式区别演示教学.doc_第4页
资源描述:

《SPI四种模式区别演示教学.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、…………………………………………………………最新精品资料推荐……………………………………………………spi四种模式SPI的相位(CPHA)和极性(CPOL)分别可以为0或1,对应的4种组合构成了SPI的4种模式(mode) Mode0CPOL=0,CPHA=0  Mode1CPOL=0,CPHA=1 Mode2CPOL=1,CPHA=0  Mode3CPOL=1,CPHA=1 时钟极性CPOL:即SPI空闲时,时钟信号SCLK的电平(1:空闲时高电平;0:空闲时低电平) 时钟相位CPHA:即SPI在SCLK第几个边沿开始采样(0:第一个边沿开始;1:第二个边沿开始) sd卡地spi常

2、用的是mode0和mode3,这两种模式的相同的地方是都在时钟上升沿采样传输数据,区别这两种方式的简单方法就是看空闲时,时钟的电平状态,低电平为mode0,高电平为mode3。OverviewTheSPIstandardincludesfourmodes,definedbythepolarityofSCLKandthephaserelationshipbetweendataandSCLK.Theclockpolarity(CPOL)isdeterminedbytheidlestateofSCLK.Iftheidlestateislow,CPOLis0.Iftheidlestateishig

3、h,CPOLis1.Theclockphase(CPHA)isdeterminedbywhichedgethatdataisvalid.IfthedataisvalidonthefirstedgeofSCLK,CPHAis0.IfthedataisvalidonthesecondedgeofSCLK,CPHAis1. IndustryhastwocommonformatstodefinethefourSPImodes.Thefirstformatdefinesthefourpossiblecombinationsofphaseandpolarityasmode0,mode1,mode2,

4、andmode3.Thesecondformatdefinesthecombinationsasmode0,0,mode0,1,mode1,0,andmode1,1.TheSPImastermustuseamodesupportedbytheslavedevicetoallowpropercommunications. DallasSemiconductor/Maxim'sSPI-interfaceRTCssupportbothSCLKpolarities.TheRTCautomaticallydeterminesthepolaritybydetectingtheidlestateofS

5、CLKwhenCEisasserted.Themastermust,therefore,placeSCLKintheproperidlestatebeforeCEisasserted.Onlyonephaseissupported.SincetwoSCLKpolaritiesaresupported,twoofthefourSPImodesaresupportedbytheRTCs:modes1and3(mode0,1andmode1,1). Onmicrocontrollerswithbuilt-inSPIinterfaces,anSPIcontrolorconfigurationre

6、gisterwillhavebitsthatcontrolthepolarityandphase.BecausetheRTCsupportseitherpolarity,thepolaritycanbesetasdesired.Thephasebit,however,mustbesetproperly,ortheRTCwillnotoperatecorrectly. Figure1showsatypicalsingle-bytereadandFigure2showsatypicalsingle-bytewrite.EachtimeCEisasserted,thefirsteightSCL

7、Kpulsesareusedtoclockinacommandbyte.Thecommandbyteconsistsofseveralbitsthatdefinearegisteraddress,andonebitthatdefinesthedatadirection:awriteifthenexteightSCLKpulseswillclockdataintothepart,…………………………………………………………

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。