原文地址:http://www.fpga4fun.com/SPI1.html

SPI is a simple interface that allows one chip to communicate with one or more other chips.

How does it look?

Let's start with a simple example where only two chips have to communicate together.

SPI requires 4 wires to be used in between the two chips.

As you can see, the wires are called SCK, MOSI, MISO and SSEL, and one of the chip is called the SPI master, while the other the SPI slave.

SPI fundamentals

Basically:

  1. It is synchronous.
  2. It is serial.
  3. It is full-duplex.
  4. It is not plug-and-play.
  5. There is one (and only one) master, and one (or more) slaves.

In more details:

  1. A clock is generated by the master, and one bit of data is transferred each time the clock toggles.
  2. Data is serialized before being transmitted, so that it fits on a single wire.
  3. There are two wires for data, one for each direction.
  4. The master and slave know beforehand the details of the communication (bit order, length of data words exchanged, etc...)
  5. The master is always the one who initiates communication.

Because SPI is synchronous and full-duplex, every time the clock toggles, two bits are actually transmitted (one in each direction).

Simple transfer

Let's assume that the master and slave expect 8-bits data transfers, with MSB transmitted first.
Here's how would look a single 8-bits data transfer.

The line MOSI is the "master output" while MISO is the "slave output". Since SPI is full-duplex, both lines toggles simultaneously, with different data going from master-to-slave, and slave-to-master.

In more datails:

  1. The master pulls SSEL down to indicate to the slave that communication is starting (SSEL is active low).
  2. The master toggles the clock eight times and sends eight data bits on its MOSI line. At the same time it receives eight data bits from the slave on the MISO line.
  3. The master pulls SSEL up to indicate that the transfer is over.

If the master had more than one 8-bits data to send/receive, it could keep sending/receiving and de-assert SSEL only when it is done.

Multiple slaves

An SPI master can communicate with multiples slaves by connecting most signals in parallel and adding SSEL lines, or by chaining the slaves.

With the multiple SSEL lines technique, only one SSEL line is actived at a time, and slaves that are not selected must not drive the MISO line.

How fast is it?

SPI can easily achieve a few Mbps (mega-bits-per-seconds). That means it can be used for uncompressed audio, or compressed video.

What is SPI?的更多相关文章

  1. SPI基础知识

    Serial Peripheral Interface 是摩托罗拉公司提出的一种总线协议,主要应用在EEPROM,FLASH,实时时钟,A/D转换,以及数字信号处理和数字信号解码器中 是一种高速,全双 ...

  2. spi子系统之驱动SSD1306 OLED

    spi子系统之驱动SSD1306 OLED 接触Linux之前,曾以为读源码可以更快的学习软件,于是前几个博客都是一边读源码一边添加注释,甚至精读到每一行代码,实际上效果并不理想,看过之后就忘记了.主 ...

  3. java中的SPI机制

    1 SPI机制简介 SPI的全名为Service Provider Interface.大多数开发人员可能不熟悉,因为这个是针对厂商或者插件的.在java.util.ServiceLoader的文档里 ...

  4. 基于TQ2440的SPI驱动学习(OLED)

    平台简介 开发板:TQ2440 (NandFlash:256M  内存:64M) u-boot版本:u-boot-2015.04 内核版本:Linux-3.14 作者:彭东林 邮箱:pengdongl ...

  5. SPI协议及IO模拟

    SPI协议 SPI协议网上资料比较多,但是也比较乱,当初在网上搜集的错误资料导致现在比较混乱. SPI协议资料比较正规的是: 1.SPI的规约协议英文文档,例如<摩托罗拉spi协议规范> ...

  6. STM32F412应用开发笔记之三:SPI总线通讯与AD采集

    本次我们在NUCLEO-F412ZG试验模拟量输入采集.我们的模拟量输入采用ADI公司的AD7705,是一片16位两路差分输入的AD采集芯片.具有SPI接口,我们将采用SPI接口与AD7705通讯.两 ...

  7. spi 10方式编写

    //第一个CS变低的时候要sclk为高电平,第一个跳变沿进行赋值 module spi(input clk,input rst_n,output reg sclk,output reg cs,outp ...

  8. 挣值管理(PV、EV、AC、SV、CV、SPI、CPI) 记忆

    挣值管理法中的PV.EV.AC.SV.CV.SPI.CPI这些英文简写相信把大家都搞得晕头转向的.在挣值管理法中,需要记忆理解的有三个参数:PV.AC.EV.     PV:计划值,在即定时间点前计划 ...

  9. SPI总线

    一.概述. SPI, Serial Perripheral Interface, 串行外围设备接口, 是 Motorola 公司推出的一种同步串行接口技术. SPI 总线在物理上是通过接在外围设备微控 ...

  10. I2S/PCM/IOM-2、I2C/SPI/UART/GPIO/slimbus

    概述 I2S,PCM,IOM-2都是数字音频接口,传数据的. I2C,SPI,UART,GPIO是控制接口,传控制信令的. I2S I2S(Inter-IC Sound Bus)是飞利浦公司为数字音频 ...

随机推荐

  1. [转] "self = [super init]"的解释与潜藏bug

    Objective-C的推荐init方法写法如下: - (id) init { if(self = [super init]) { //为子类增加属性进行初始化 } return self; } 这里 ...

  2. (转) Summary of NIPS 2016

    转自:http://blog.evjang.com/2017/01/nips2016.html           Eric Jang Technology, A.I., Careers       ...

  3. LeetCode----Linked List

    Swap Nodes in Pairs 思路:需要构造一个头指针,指向链表.一次比较两个指针,将其翻转,临界条件是pre != null(链表长度为偶数) && pre.next != ...

  4. TensorFlow官方文档中文版

    github地址: https://github.com/jikexueyuanwiki/tensorflow-zh

  5. 实现Cookie跨域共享

    实现原理:cookie是不能跨域访问的,但是在二级域名是可以共享cookie的 概念说明:站点1=a.abc.com   站点2=b.abc.com 实现步骤:1. 配置两个站点的webconfig ...

  6. Python字符串处理

    字符串输入: my_string = raw_input("please input a word:") 字符串判断: (1) 判断是不是纯字母 my_string.isalpha ...

  7. 【MySQL】排序原理与案例分析

    前言 排序是数据库中的一个基本功能,MySQL也不例外.用户通过Order by语句即能达到将指定的结果集排序的目的,其实不仅仅是Order by语句,Group by语句,Distinct语句都会隐 ...

  8. Nginx -- Gzip 压缩功能作用

    1.对应的压缩参数说明# 开启gzip压缩功能gzip on; # 设置允许压缩的页面最小字节数,页面字节数从header头的Content-Length中获取.默认值是0,不管页面多大都进行压缩,建 ...

  9. PBR实现2.0

    之前的错误和欠缺 1. 过于简单的划分diffuse和specular,非常光滑的非金属材料也是很能反光的2. 费奈尔效应的处理,F0的选取也比较随意3. 没有GI,更不支持AO 正确划分diffus ...

  10. sql server 跨数据库插入数据

    创建服务器的连接,创建好后可以存在服务器上,可以在不同位置重复使用,和系统函数类似 exec sp_addlinkedserver 'RemoteServer', '', 'SQLOLEDB ', ' ...