Professional Documents
Culture Documents
1 Interface
SPI
Master
SCLK
MOSI
MISO
SS
SCLK
MOSI
MISO
SS
SPI
Slave
SPI
Master
SCLK
MOSI
MISO
SS1
SS2
SS3
SCLK
MOSI
MISO
SS
SPI
Slave
SCLK
MOSI
MISO
SS
SPI
Slave
SCLK
MOSI
MISO
SS
SPI
Slave
2 OPERATION
Most slave devices have tri-state outputs so their MISO 2.2 Clock polarity and phase
signal becomes high impedance (logically disconnected)
when the device is not selected. Devices without tri-state
CPOL=0
outputs cannot share SPI bus segments with other devices;
SCK CPOL=1
only one such slave could talk to the master.
SS
2.1
CPHA=0
Data transmission
Master
Slave
Memory
Memory
SCLK
MOSI
CPHA=1
MISO
Cycle #
MISO
MOSI
Cycle #
MISO
MOSI
A timing diagram showing clock polarity and phase. The red vertical line represents CPHA=0 and the blue vertical line represents
CPHA=1
sion occurs. The master sends a bit on the MOSI line and
the slave reads it, while the slave sends a bit on the MISO
line and the master reads it. This sequence is maintained
even when only one-directional data transfer is intended.
2.5
In other words, CPHA=0 means transmitting data on the together, they are required to be tri-state pins (high, low
active to idle state and CPHA=1 means that data is trans- or high-impedance).
mitted on the idle to active state edge. Note that if transmission happens on a particular edge, then capturing will
happen on the opposite edge(i.e. if transmission hap- 2.5 Daisy chain conguration
pens on falling, then reception happens on rising and vice
versa). The MOSI and MISO signals are usually stable
(at their reception points) for the half cycle until the next
SCLK
SCLK
SPI
SPI
MOSI
MOSI
clock transition. SPI master and slave devices may well
Master
Slave
MISO
MISO
sample data at dierent points in that half cycle.
SS
SS
This adds more exibility to the communication channel
between the master and slave.
2.3
Mode numbers
The combinations of polarity and phases are often referred to as modes which are commonly numbered according to the following convention, with CPOL as the
high order bit and CPHA as the low order bit:
SCLK
MOSI
MISO
SS
SPI
Slave
SCLK
MOSI
MISO
SS
SPI
Slave
SPI
Master
SCLK
MOSI
MISO
SS1
SS2
SS3
Applications that require a daisy chain conguration include SGPIO and JTAG.
SCLK
MOSI
MISO
SS
SPI
Slave
SCLK
MOSI
MISO
SS
SPI
Slave
SCLK
MOSI
MISO
SS
SPI
Slave
In the independent slave conguration, there is an independent chip select line for each slave. A pull-up resistor
between power source and chip select line is highly recommended for each independent device to reduce crosstalk between devices.[3] This is the way SPI is normally
used. Since the MISO pins of the slaves are connected
2.7 Interrupts
SPI devices sometimes use another signal line to send an
interrupt signal to a host CPU. Examples include pendown interrupts from touchscreen sensors, thermal limit
alerts from temperature sensors, alarms issued by real
2.8
3.1
Advantages
Applications
RELATED TERMS
plications. Its main focus is the transmission of sensor 6.4 Logic analyzers
data between dierent devices.
When developing and/or troubleshooting the SPI bus, examination of hardware signals can be very important.
Logic analyzers are tools which collect, analyze, decode,
6 Development tools
and store signals so people can view the high-speed waveforms at their leisure. Logic analyzers display timeWhen developing or troubleshooting systems using SPI, stamps of each signal level change, which can help nd
visibility at the level of hardware signals can be important. protocol problems. Most logic analyzers have the capability to decode bus signals into high-level protocol data
and show ASCII data.
6.1
Host adapters
Related terms
Intelligent SPI controllers
6.2
Protocol analyzers
7.2 Microwire
[13]
SPI protocol analyzers are tools which sample an SPI bus Microwire, often spelled Wire, is essentially a predeand decode the electrical signals to provide a higher-level cessor of SPI and a trademark of National Semiconductor. Its a strict subset of SPI: half-duplex, and using SPI
view of the data being transmitted on a specic bus.
mode 0. Microwire chips tend to need slower clock rates
Examples of SPI protocol analyzers (manufacturers in
than newer SPI versions; perhaps 2 MHz vs. 20 MHz.
alphabetical order):
Some Microwire chips also support a three-wire mode,
which ts neatly with the restriction to half-duplex.
6.3
Oscilloscopes
Every major oscilloscope vendor oers oscilloscopebased triggering and protocol decoding for SPI. Most support 2-, 3-, and 4-wire SPI. The triggering and decoding
capability is typically oered as an optional extra. SPI
signals can be accessed via analog oscilloscope channels
or with digital MSO channels.[9]
7.3 Microwire/Plus
Microwire/Plus[14] is an enhancement of Microwire and
features full-duplex communication and support for SPI
modes 0 and 1. There was no specied improvement in
serial clock speed.
7.7
7.4
7.5
7.6
mSPI
7
the bus master to issue a slave address (typically 8 bits)
as mandatory rst word in every transmission. Since all
slave devices share the same SS line, the address word
will be received by all of them at the same time. From
that point further, only the device with the specied address will connect its MISO line to the bus and start communicating, while all other slave devices will ignore any
data and wait for a new start of transmission and address.
mSPI solves some of the basic disadvantages of the standard SPI at the expense of a slight decrease in the overall
communication speed due to the initial addressing.
10
EXTERNAL LINKS
the eSPI bus via virtual wire cycles and out-of-band message cycles respectively in order to remove those pins
from motherboard designs using eSPI.[16]
This proposed standard will support standard memory cycles with lengths of 1 byte to 4 kibibytes of data, short
memory cycles with lengths of 1, 2, or 4 bytes that have
much less overhead compared to standard memory cycles, and I/O cycles with lengths of 1, 2, or 4 bytes of
data which are low overhead as well. This signicantly
reduces overhead compared to the LPC bus, where all
cycles except for the 128-byte rmware hub read cycle
spends more than one half of all of the buss throughput
and time in overhead. The standard memory cycle allows
a length of anywhere from 1 byte to 4 kibibytes in order
to allow its larger overhead to be amortized over a large
transaction. eSPI slaves are allowed to initiate bus master versions of all of the memory cycles. Bus master I/O
cycles, which were introduced by the LPC bus specication, and ISA-style DMA including the 32-bit variant introduced by the LPC bus specication, are not present in
eSPI. Therefore, bus master memory cycles are the only
allowed DMA in this standard.[16]
[9] N5391B.
[10] Queued Serial Module Reference Manual, Freescale
Semiconductor
[11] Such as with the MultiChannel Serial Port Interface, or
McSPI, used in Texas Instruments OMAP chips.
[12] Such as the SPI controller on Atmel AT91 chips like the
at91sam9G20, which is much simpler than TIs McSPI.
[13] MICROWIRE Serial Interface National Semiconductor
Application Note AN-452
[14] MICROWIRE/PLUS Serial Interface for COP800 Family National Semiconductor Application Note AN-579
[15] Serial Peripheral Interface (SPI) Flash Memory Backgrounder, Spansion
[16] https://downloadcenter.intel.com/Detail_Desc.aspx?
See also
10 External links
Intel eSPI (Enhanced Serial Peripheral Interface)
Introduction to SPI and I2C protocols
Serial buses information page
SPI Introduction
UEXT Connector.
SPI Tutorial
Microsecond Bus.
References
11
11.1
Serial Peripheral Interface Bus Source: https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus?oldid=729292519 Contributors: Damian Yerrick, Ray Van De Walker, Heron, Cyp, William M. Connolley, Glenn, HPA, Colin Marquardt, Darkhorse, Blades,
Giftlite, Ds13, Gadum, Kiteinthewind, Togo~enwiki, Elektron, Sam, Vijaykumar~enwiki, Snukin~enwiki, Imroy, Ralph Corderoy,
Thomas Willerich, Plugwash, Mondalaci, Kwamikagami, Southen, Sietse Snel, Zoggie50, Polluks, Vapier, Kundor, Sebastian Goll, Hopp,
Jlasso, Tauwasser, Wtshymanski, Cburnett, Tocksin, David Haslam, Macaddct1984, Alecv, Rjwilmsi, Tizio, Allen Moore, FlaBot,
Chobot, Bgwhite, YurikBot, John2kx, Shaddack, Rsrikanth05, Marq Kole, Voidxor, Museo8bits, HereToHelp, SmackBot, Larry Doolittle,
Ankitkankane, Pieleric, Toddintr, Oli Filth, Letdorf, Tsca.bot, Plasma16, Frap, Jinxed, Chlewbot, Vegard, Mosca, Cybercobra, Doodle77, ManiacK, Kvng, Vanisaac, Mamanakis, CmdrObot, Jesse Viviano, Rmallins, Garrickk, Libro0, Christian75, Mtpaley, Zalgo,
Joel woodward, Djmdjm, Alex Forencich, Jtmoon, Widefox, Ebikeguy, Spencer, Alphachimpbot, Xoneca, Michael Stangeland, Japo,
Kgeischmann, Omnara, 99th Percentile, R'n'B, CommonsDelinker, Javawizard, Jreybert, Inwind, Scls19fr, Daltuna, Amikake3, Kunjan
patel, Senarvi, Melsaran, Logan, Kbrose, SieBot, Ceson~enwiki, Cashannon, GeiwTeol, Crm123, EnOreg, Nskillen, Agunther, ClueBot, Nsk92, Iandiver, Sylvain Leroux, PixelBot, Amolhshah, Ginbot86, XLinkBot, Tonypdmtr, Dgtsyb, Broke Back Records, Addbot,
Mortense, Tothwolf, MrOllie, Semiwiki, Crspybits, Tide rolls, OlEnglish, Luckas-bot, Yobot, Jinlei, Julia W, Jordsan, Alhaiksandher,
AnomieBOT, Adeliine, Materialscientist, Simonjohndoherty, Xqbot, Yenz820, Nasa-verve, GrouchoBot, RibotBOT, DaleDe, Jcmcclurg,
FrescoBot, LucienBOT, Username20090319, Ionutzmovie, Vishnu2011, Moggie100, Teuxe, Jusses2, MastiBot, RCelistrinoTeixeira, Ericbwiki, Hoptro, Jnmbk, HDLfriki, Cwavnew, Cp82, TheMesquito, Dhiraj1984, EmausBot, Dewritech, GoingBatty, Matthieu CASTET,
Dcirovic, Kalin.KOZHUHAROV, Encijia, Sbmeirow, Tronixstu, JohnBoxall, Edgar.bonet, Li Zaodie, Fftzyy, ClueBot NG, Matthiaspaul, O.Koslowski, Widr, Viswanathamk, Helpful Pixie Bot, Wbm1058, BG19bot, Charon77, Hz.tiang, IveGoneAway, Kendall-K1,
Wikih101, Simon naylor, M.A.Elfar, Tonusamuel, Markuj7, ChrisGualtieri, Jzj1993, Makecat-bot, Frosty, Currystomper, Faizan, Mohan.PAKALAPATI, 1nafar, PirateKing42, Buntybhai, Wasquewhat, Knivd, Bbrice86, ESPI ROCKS, Neuliss, Bafeigum, Jegan2510, Flyxtop, TristanRobitaille, RunnerRick08 and Anonymous: 349
11.2
Images
File:350px-mSPI_three_slaves_svg.png Source:
License: CC-BY-SA-3.0 Contributors:
Own work
Original artist:
Knivd
https://upload.wikimedia.org/wikipedia/en/f/fc/350px-mSPI_three_slaves_svg.png
https://upload.wikimedia.org/wikipedia/commons/6/6b/SPI_timing_diagram2.svg License:
11.3
Content license