- 1、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
spi-spec详解
Serial Peripheral Interface Bus SPI?总线是Motorola公司推出的三线同步接口,同步串行3线方式进行通信:一条时钟线SCK,一条数据输入线MOSI,一条数据输出线MISO;用于CPU与各种外围器件进行全双工、同步串行通讯。SPI主要特点有:可以同时发出和接收串行数据;可以当作主机或从机工作;提供频率可编程时钟;发送结束中断标志;写冲突保护;总线竞争保护等。During each SPI clock cycle, a full duplex data transmission occurs: (主要是在sck的控制下,两个双向移位寄存器进行数据交换。the master sends a bit on the MOSI line; the slave reads it from that same line the slave sends a bit on the MISO line; the master reads it from that same line 2、时钟极性及相位: In addition to setting the clock frequency, the master must also configure the clock polarity and phase with respect to the data. Freescales SPI Block Guide [1] names these two options as CPOL and CPHA respectively, and most vendors have adopted that convention. The timing diagram is shown to the right. The timing is further described below and applies to both the master and the slave device. At CPOL=0 the base value of the clock is zero For CPHA=0, data is captured on the clocks rising edge (low→high transition) and data is propagated on a falling edge (high→low clock transition). For CPHA=1, data is captured on the clocks falling edge and data is propagated on a rising edge. At CPOL=1 the base value of the clock is one (inversion of CPOL=0) For CPHA=0, data is captured on clocks falling edge and data is propagated on a rising edge. For CPHA=1, data is captured on clocks rising edge and data is propagated on a falling edge. 3、以MX29L12845E为例: read bytes 主机把一位数据放到(主出从进)上,其实就是把相应的线拉高(1)或者拉低(0);然后主机让S(时钟)上升一次,数据将在S的上升沿被slave接受;主机再把时钟拉低,以备下次将其拉高;这样重复8次,就可以把一个byte的指令送到slave了。第一次传指令,第二次就是传要读的地址;传完指令和地址,主机就可以一次次把时钟拉高,一位一位地读取到slave传来的数据了。 Timing analysis 伪代码: set_line(SPI_S, low); //选中,表示要开始交互 set_line(SPI_C, low); //clock拉低,以保证待会可以“拉高” for(i=0;i 8; i++) { //传指令 set_line(SPI_D, BIT(command, i)); set_line(SPI_C, high); ------| set_line(SPI_C, low);--------| } for(i=0;i ; i++) { //传地址 set_line(SPI_D, BIT(addr, i)); set_line(SPI_C, high); set_line(SPI_C, low); } for(i=0;i 8; i++) { //
文档评论(0)