SPI 1 - What is SPI?

举报
李锐博恩 发表于 2021/07/15 03:52:59 2021/07/15
【摘要】 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 to...

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 full-duplex serial.
  3. It is not plug-and-play.
  4. There is one (and only one) master, and one (or more) slaves.

In more details:

  1. Synchronous: a clock is generated by the master.
  2. Full-duplex serial: data is serialized, one bit of data is transferred in each direction during each clock period, so two data wires are used (MOSI and MISO).
  3. Not plug-and-play: The master and slave know beforehand the details of the communication (bit order, length of data words exchanged, etc...).
  4. One master: slave(s) cannot initiates communication, only the master can. The slave(s) listen and respond.

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 details:

  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 in two ways: 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 activated 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.

Links

SPI 1 - What is SPI?

文章来源: reborn.blog.csdn.net,作者:李锐博恩,版权归原作者所有,如需转载,请联系作者。

原文链接:reborn.blog.csdn.net/article/details/89952805

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。