博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
What is SPI?
阅读量:6071 次
发布时间:2019-06-20

本文共 2557 字,大约阅读时间需要 8 分钟。

原文地址: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.

posted on
2016-09-22 15:53 阅读(
...) 评论(
...)

转载于:https://www.cnblogs.com/christsong/p/5896710.html

你可能感兴趣的文章
mac 终端 常用命令
查看>>
linux的历史及大事年表
查看>>
LINUX文件系统与操作命令
查看>>
一.浅述Byte
查看>>
解决运行eclipse内存不足的问题
查看>>
iOS 终端常用命令
查看>>
javascript call用法的简单介绍
查看>>
菜鸟学Linux 第015篇笔记 bash脚本 条件判断
查看>>
在linux上挂载windows的共享目录
查看>>
Jqgrid -- search button doesn't work with Jquery 1.8.0 or greater
查看>>
XtraBackup物理备份MySQL的流程
查看>>
Java项目对jar包加密流程
查看>>
Ubuntu 16.04搭建nexus管理docker image
查看>>
dell srvadmin 安装部署
查看>>
SQL语句的预编译
查看>>
数字签名
查看>>
Windows Server 2003 R2 Enterprise Edition With SP2 VOL 下载地址及安装密钥
查看>>
条形码组件Spire.Barcode 教程:在Java中扫描条形码
查看>>
微软重新定义Skype
查看>>
XenDesktop7.12发布应用程序
查看>>