差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
后一修订版
前一修订版
上一修订版 两侧同时换到之后的修订记录
spi [2019/05/05 14:55]
gongyu
spi [2019/08/05 22:11]
gongyu
行 1: 行 1:
- 
-{{ :​eetreewechat.png?​600 |}} <WRAP centeralign>​**扫描二维码,关注微信公众号“电子森林”,可以在手机上查看本网站的所有文章** </​WRAP>​ 
- 
-\\ 
- 
 #### SPI - 同步、全双工的串行外设接口 #### SPI - 同步、全双工的串行外设接口
  
行 158: 行 153:
   * 有一些变种比如多路I/​O SPI和下面定义的三线串行总线都是半双工的   * 有一些变种比如多路I/​O SPI和下面定义的三线串行总线都是半双工的
  
-### 应用 +### SPI的主要应用
-The board real estate savings compared to a parallel I/O bus are significant,​ and have earned SPI a solid role in embedded systems. That is true for most system-on-a-chip processors, both with higher end 32-bit processors such as those using ARM, MIPS, or PowerPC and with other microcontrollers such as the AVR, PIC, and MSP430. These chips usually include SPI controllers capable of running in either master or slave mode. In-system programmable AVR controllers (including blank ones) can be programmed using an SPI interface.+
  
-Chip or FPGA based designs sometimes use SPI to communicate between internal components; on-chip real estate can be as costly as its on-board cousin.+与并行I/​O总线相比,SPI能够大大节省电路板的空间,因此在嵌入式系统中发挥了重要作用,对于大多数片上系统处理器而言都是如此,这些处理器都具有较高端的32位处理器,例如使用ARM、MIPS或PowerPC的处理器以及其它微控制器,如AVR、PIC和MSP430等。 这些芯片通常包括能够以主模式或从模式运行的SPI控制器,也可以使用SPI接口对系统内可编程AVR控制器(包括空白控制器)进行编程。
  
-The full-duplex capability makes SPI very simple and efficient for single master/​single slave applications. Some devices use the full-duplex mode to implement an efficient, swift data stream for applications such as digital audio, digital signal processing, or telecommunications channels, but most off-the-shelf chips stick to half-duplex request/​response protocols.+基于芯片或FPGA的设计有时使用SPI在内部的组件之间进行通信,即便是片内,其面积的节省也像电路板上一样非常重要。
  
-SPI is used to talk to a variety of peripherals,​ such as+全双工功能使SPI非常简单、高效、适用于单主/​单从机应用。 一些设备使用全双工模式为数字音频、数字信号处理或电信信道等应用实现高效、快速的数据流,但大多数现成的芯片都采用半双工请求/​响应协议。
  
-  ​Sensors: temperature,​ pressure, ​ADC, touchscreens,​ video game controllers +SPI被用来同各种外设通信,例如: 
-  * Control devices: audio codecs, digital potentiometers, ​DAC +  ​传感器:温度、压力、ADC、触摸屏、视频游戏控制器 
-  * Camera lenses: Canon EF lens mount +  * 控制设备:音频编解码器、数字电位器、DAC 
-  * Communications:​ Ethernet, ​USBUSARTCAN, IEEE 802.15.4IEEE 802.11, handheld video games +  * 相机镜头:佳能EF镜头卡口 
-  * Memory: flash and EEPROM +  * 通信:以太网、USBUSARTCAN、IEEE802.15.4IEEE 802.11、手持视频游戏 
-  * Real-time clocks +  * 内存:闪存和EEPROM 
-  * LCD, sometimes even for managing image data +  * 实时时钟 
-  * Any MMC or SD card (including ​SDIO variant[5])+  * LCD,有时甚至用于管理图像数据 
 +  * 任何MMCSD卡(包括SDIO变种)
  
-For high performance systems, FPGAs sometimes use SPI to interface as a slave to a host, as a master to sensors, or for flash memory used to bootstrap if they are SRAM-based. +对于高性能系统,FPGA有时使用SPI作为主机的从机接口、作为传感器的主机、或者如果它们是基于SRAM的,则用于引导的闪存。
- +
-Although there are some similarities between the SPI bus and the JTAG (IEEE 1149.1-2013) protocol, They are not interchangeable. The SPI bus is intended for high speed, on board initialization of device peripherals,​ while the JTAG protocol is intended to provide reliable test access to the I/O pins from an off board controller with less precise signal delay and skew parameters. While not strictly a level sensitive interface, the JTAG protocol supports the recovery of both setup and hold violations between JTAG devices by reducing the clock rate or changing the clock'​s duty cycles. Consequently,​ the JTAG interface is not intended to support extremely high data rates. +
- +
-SGPIO is essentially another (incompatible) application stack for SPI designed for particular backplane management activities.[citation needed] SGPIO uses 3-bit messages.+
  
 +虽然SPI总线和JTAG(IEEE 1149.1-2013)协议之间存在一些相似之处,但它们不可互换。 SPI总线用于器件外设的高速、板载初始化,而JTAG协议旨在通过板外控制器(有着比较低精度的信号延迟和偏斜参数)提供对I/​O引脚的可靠测试访问。 JTAG协议不是严格意义上的电平敏感接口,它通过降低时钟速率或改变时钟的占空比来支持JTAG器件在建立和保持违规的情况下能够恢复。 因此,JTAG接口不是用来支持极高的数据速率的。
  
 ### 协议分析及调试设备 ### 协议分析及调试设备
行 223: 行 215:
  
 ### 相关设计资源参考 ### 相关设计资源参考
- +  * 苏老师公众号文章 - [几种最常用的串行数据传输总线(1)- SPI](https://​mp.weixin.qq.com/​s/​jWbvn-DGR9xrrMHKBqXleQ) 
-#### 相技术文章 +  * FPGA4FUN上于如何使用SPI的文章应的参考代码 ​- [[https://​www.fpga4fun.com/​SPI.html|SPI接口]] 
- +  * [[简易电压表设计|使用SPI总线的简易电压表设计]] 
-#### 关FPGA开源代码 +  * Lattice Semi官网提供的[SPI控制器模块](http://​www.latticesemi.com/​en/​Products/​DesignSoftwareAndIP/​IntellectualProperty/​ReferenceDesigns/​ReferenceDesign03/​SPIMasterController)使用说明,及参考IP下载 
 +  * Lattice Semi官网提供的[SPI从设备控制器]( http://​www.latticesemi.com/​en/​Products/​DesignSoftwareAndIP/​IntellectualProperty/​ReferenceDesigns/​ReferenceDesign03/​SPISlaveController)使用说明,及参考IP下载 
 +  * Lattice Semi官网的[用于嵌入式功能块中的SPI从外设](http://​www.latticesemi.com/​en/​Products/​DesignSoftwareAndIP/​IntellectualProperty/​ReferenceDesigns/​ReferenceDesign03/​SPISlavePeripheralusingEmbeddedFunctionBlock)使用说明,及参考IP下载 
 +  * Lattice Semi官网的[SPI从设备到PWM的发生器](http://​www.latticesemi.com/​en/​Products/​DesignSoftwareAndIP/​IntellectualProperty/​ReferenceDesigns/​ReferenceDesign03/​SPISlavetoPWMGeneration)使用说明,及参考IP下载