Serial Peripheral Interface
This article may need to be rewritten to comply with Wikipedia's quality standards, as it reads like a guide or textbook. (March 2021) |
Type | Serial communication bus | ||
---|---|---|---|
Production history | |||
Designer | Motorola | ||
Designed | 1979 | ||
Data | |||
Protocol | Serial, full-duplex |
Serial Peripheral Interface (SPI) is a synchronous serial communication specification used primarily in embedded systems for short-distance wired communication between integrated circuits. The interface was developed by Motorola in the mid-1980s and has become a de facto standard, but with many variants. Typical applications include interfacing with Secure Digital cards, liquid crystal displays, analog-to-digital and digital-to-analog converters.
SPI uses a main–subnode[note 1] architecture.[1] The main chip orchestrates communication by providing the clock signal and chip select signal(s) which control any number of subservient devices. Typically there is a single main.[note 2]
The original specification uses four wires to perform full duplex communication. It is sometimes is called a four-wire serial bus to contrast with three-wire variants which are half duplex, and with the two-wire I²C and 1-Wire serial buses.
SPI may be accurately described as a synchronous serial interface,[2] but it is different from the Synchronous Serial Interface (SSI) protocol.[note 3]
Operation
(Note: refer to the ‘Variations’ section later in this article for further details.)

SPI has four logic signals (which may go by alternative namings):
- SCLK : Serial Clock (output from main)
- MOSI : Main Out Sub In (data output from main)
- MISO : Main In Sub Out (data output from sub)
- CS : Chip Select (often active low, output from main to indicate that data is being sent)
MOSI on a main connects to MOSI on a sub. MISO on a main connects to MISO on a sub. Chip select provides addressing.
SPI can operate with a single main device and with one or more sub devices.
If a single sub device is used, the CS pin may be fixed to logic low if the sub permits it. Some subs require a falling edge of the chip select signal to initiate an action. An example is the Maxim MAX1242 ADC, which starts conversion on a high→low transition. With multiple sub devices, a multidrop configuration requires an independent CS signal from the main for each sub device, while a daisy-chain configuration only requires one SS signal.
Most sub devices have tri-state outputs so their MISO signal becomes high impedance (electrically disconnected) when the device is not selected. subs without tri-state outputs cannot share a MISO wire with other subs without using an external tri-state buffer.
Data transmission
To begin communication, the SPI main configures the clock, using a frequency supported by the sub device, typically up to a few MHz. The main then selects the sub device with a logic level 0 on the select line. If a waiting period is required, such as for an analog-to-digital conversion, the main must wait for at least that period of time before issuing clock cycles.
During each SPI clock cycle, a full-duplex data transmission occurs. The main sends a bit on the MOSI line and the sub reads it, while the sub sends a bit on the MISO line and the main reads it. This sequence is maintained even when only one-directional data transfer is intended.
Transmission using a single sub or multidrop configuration involves two shift registers of some given word-size, such as eight bits, one in the main and one in the sub; they are connected in a virtual ring topology. Data is usually shifted out with the most significant bit first. On the clock edge, both main and sub shift out a bit and output it on the transmission line to the counterpart. On the next clock edge, at each receiver the bit is sampled from the transmission line and set as a new least-significant bit of the shift register. After the register bits have been shifted out and in, the main and sub have exchanged register values. If more data needs to be exchanged, the shift registers are reloaded and the process repeats. Transmission may continue for any number of clock cycles. When complete, the main stops toggling the clock signal, and typically deselects the sub.
Transmissions often consist of eight-bit words. However, other word-sizes are also common, for example, sixteen-bit words for touch-screen controllers or audio codecs, such as the TSC2101 by Texas Instruments, or twelve-bit words for many digital-to-analog or analog-to-digital converters. Multiple SPI devices may also be daisy-chained to conserve pins.
Every sub on the bus that has not been activated using its chip select line must disregard the input clock and MOSI signals and should not drive MISO (i.e., must have a tristate output) although some devices need external tristate buffers to implement this.
Clock polarity and phase

In addition to setting the clock frequency, the main must also configure the clock polarity and phase with respect to the data. Motorola SPI Block Guide[3] names these two options as CPOL and CPHA (for clock polarity and clock phase) respectively, a convention most vendors have also adopted.
The timing diagram is shown to the right. The timing is further described below and applies to both the main and the sub device.
- CPOL determines the polarity of the clock. The polarities can be converted with a simple inverter.
- CPOL=0 is a clock which idles at 0, and each cycle consists of a pulse of 1. That is, the leading edge is a rising edge, and the trailing edge is a falling edge.
- CPOL=1 is a clock which idles at 1, and each cycle consists of a pulse of 0. That is, the leading edge is a falling edge, and the trailing edge is a rising edge.
- CPHA determines the timing (i.e. phase) of the data bits relative to the clock pulses. Conversion between these two forms is non-trivial.
- For CPHA=0, the "out" side changes the data on the trailing edge of the preceding clock cycle, while the "in" side captures the data on (or shortly after) the leading edge of the clock cycle. The out side holds the data valid until the trailing edge of the current clock cycle. For the first cycle, the first bit must be on the MOSI line before the leading clock edge. An alternative way of considering it is to say that a CPHA=0 cycle consists of a half cycle with the clock idle, followed by a half cycle with the clock asserted.
- For CPHA=1, the "out" side changes the data on the leading edge of the current clock cycle, while the "in" side captures the data on (or shortly after) the trailing edge of the clock cycle. The out side holds the data valid until the leading edge of the following clock cycle. For the last cycle, the sub holds the MISO line valid until sub select is deasserted. An alternative way of considering it is to say that a CPHA=1 cycle consists of a half cycle with the clock asserted, followed by a half cycle with the clock idle.
The MOSI and MISO signals are usually stable (at their reception points) for the half cycle until the next clock transition. SPI main and sub devices may sample data at different points in that half cycle.
This[clarification needed] adds more flexibility to the communication channel between the main and sub.
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:
For "Microchip PIC" / "ARM-based" microcontrollers (note that NCPHA is the inversion of CPHA):
SPI mode | Clock polarity (CPOL/CKP) |
Clock phase (CPHA) |
Clock edge (CKE/NCPHA) |
---|---|---|---|
0 | 0 | 0 | 1 |
1 | 0 | 1 | 0 |
2 | 1 | 0 | 1 |
3 | 1 | 1 | 0 |
For PIC32MX: SPI mode configure CKP, CKE and SMP bits. Set SMP bit and CKP, CKE two bits configured as above table.
For other microcontrollers:
Mode | CPOL | CPHA |
---|---|---|
0 | 0 | 0 |
1 | 0 | 1 |
2 | 1 | 0 |
3 | 1 | 1 |
Another commonly used notation represents the mode as a (CPOL, CPHA) tuple; e.g., the value '(0, 1)' would indicate CPOL=0 and CPHA=1.
Note that in Full Duplex operation, the main device could transmit and receive with different modes. For instance, it could transmit in Mode 0 and be receiving in Mode 1 at the same time.
Multidrop configuration

In the multidrop bus configuration, there is an independent chip select line for each sub. This is the way SPI is normally used. The main asserts only one chip select at a time.
Pull-up resistors between power source and chip select lines are recommended for systems where the main's chip select pins may default to an undefined state.[4] When separate software routines initialize each chip select and communicate with its sub, pull-up resistors prevent other uninitialized subs from responding.
Since the MISO pins of the subs are connected together, they are required to be tri-state pins (high, low or high-impedance), where the high-impedance output must be applied when the sub is not selected. sub devices not supporting tri-state may be used in multidrop configuration by adding a tri-state buffer chip controlled by the chip select signal.[4] (Since only a single signal line needs to be tristated per sub, one typical standard logic chip that contains four tristate buffers with independent gate inputs can be used to interface up to four sub devices to an SPI bus)
Daisy chain configuration

Some products that implement SPI may be connected in a daisy chain configuration, where the first sub's output is connected to the second sub's input, and so on with subsequent subs, until the final sub, whose output is connected back to the main's input. This effectively merges the individual communication shift registers of each sub to form a single larger combined shift register that shifts data through the chain. This configuration only requires a single SS line from the main, rather than a separate SS line for each sub.[5]
In addition to using SPI-specific subs, daisy-chained SPI buses can include discrete shift registers to provide a bank of inputs or outputs. Other applications that can potentially interoperate with daisy-chained SPI include SGPIO, JTAG,[6] and I2C.
Expander configuration
Another variation uses exactly two chip selects. One chip select controls a block of selection logic, the other is routed by the selection logic. The application is common enough that there are available serial-controlled multiplexers.[7] This can future-proof a connector, so that a controller can support many devices with a change of software.
A similar application pairs a serial-controlled multiplexer with a merchant USB-to-SPI controller,[8] controlled by a PC or smartphone. This can be used to control many types of "dumb" electronic devices with inexpensive mass-produced computers.
High reliability modifications
In electrically noisy environments, since SPI has few signals, it can be economical to reduce the effects of common mode noise by adapting SPI to use low-voltage differential signaling.[9] Another advantage is that the controlled devices can be designed to loop-back to test signal integrity.[10]
Valid communications
Some sub devices are designed to ignore any SPI communications in which the number of clock pulses is greater than specified. Others do not care, ignoring extra inputs and continuing to shift the same output bit. It is common for different devices to use SPI communications with different lengths, as, for example, when SPI is used to access the scan chain of a digital IC by issuing a command word of one size (perhaps 32 bits) and then getting a response of a different size (perhaps 153 bits, one for each pin in that scan chain).
Interrupts
SPI devices sometimes use another signal line to send an interrupt signal to a host CPU. Examples include pen-down interrupts from touchscreen sensors, thermal limit alerts from temperature sensors, alarms issued by real time clock chips, SDIO,[11] and headset jack insertions from the sound codec in a cell phone.
Interrupts are outside the scope of SPI; their usage is neither forbidden nor specified, and so may optionally be implemented.
Software design
SPI lends itself to a "bus driver" software design. Software for attached devices is written to call a "bus driver" that handles the actual low-level SPI hardware. This permits the driver code for attached devices to port easily to other hardware, including a bit-banging design.
Example of bit-banging the main protocol
Below is an example of bit-banging the SPI protocol as an SPI main with CPOL=0, CPHA=0, and eight bits per transfer. The example is written in the C programming language. Because this is CPOL=0 the clock must be pulled low before the chip select is activated. The chip select line must be activated, which normally means being toggled low, for the peripheral before the start of the transfer, and then deactivated afterward. Most peripherals allow or require several transfers while the select line is low; this routine might be called several times before deselecting the chip.
/*
* Simultaneously transmit and receive a byte on the SPI.
*
* Polarity and phase are assumed to be both 0, i.e.:
* - input data is captured on rising edge of SCLK.
* - output data is propagated on falling edge of SCLK.
*
* Returns the received byte.
*
* For this example, assume uint8_t means "unsigned char".
*/
uint8_t SPI_transfer_byte(uint8_t byte_out)
{
uint8_t byte_in = 0;
for (uint8_t bit = 0x80; bit != 0; bit >>= 1)
{
/* Shift-out a bit to the MOSI line */
write_MOSI(byte_out & bit);
/* Delay for at least the peer's setup time */
delay(SPI_SCLK_LOW_TIME);
/* Pull the clock line high */
write_SCLK(1);
/* Shift-in a bit from the MISO line */
if (read_MISO())
byte_in |= bit;
/* Delay for at least the peer's hold time */
delay(SPI_SCLK_HIGH_TIME);
/* Pull the clock line low */
write_SCLK(0);
}
return byte_in;
}
Pros and cons
Advantages
- Full duplex communication in the default version of this protocol
- Push-pull drivers (as opposed to open drain) provide good signal integrity and high speed
- Higher throughput than I²C or SMBus. Not limited to any maximum clock speed, enabling potentially high speed
- Complete protocol flexibility for the bits transferred
- Not limited to 8-bit symbols
- Arbitrary choice of message size, content, and purpose
- Extremely simple hardware interfacing
- Typically lower power requirements than I²C or SMBus due to less circuitry (including pull up resistors)
- No arbitration or associated failure modes - unlike CAN-bus
- subs use the main's clock and do not need precision oscillators
- subs do not need a unique address – unlike I²C or GPIB or SCSI
- Transceivers are not needed - unlike CAN-bus
- Uses only four pins on IC packages, and wires in board layouts or connectors, much fewer than parallel interfaces
- At most one unique signal per device (chip select); all others are shared
- Note: the daisy-chain configuration doesn't need more than one shared chip select
- Signals are unidirectional allowing for easy galvanic isolation
- Simple software implementation
Disadvantages
- Requires more pins on IC packages than I²C, even in the three-wire variant
- No in-band addressing; out-of-band chip select signals are required on shared buses
- Extensibility severely reduced when multiple subs using different SPI Modes are required. Access is slowed down when main frequently needs to reinitialize in different modes.
- No hardware flow control by the sub (but the main can delay the next clock edge to slow the transfer rate)
- No hardware sub acknowledgment (the main could be transmitting to nowhere and not know it)
- Typically supports only one main device (depends on device's hardware implementation)
- No error-checking protocol is defined
- Without a formal standard, validating conformance is not possible
- Only handles short distances compared to RS-232, RS-485, or CAN-bus. (Its distance can be extended with the use of transceivers like RS-422.)
- Opto-isolators in the signal path limit the clock speed for MISO transfer because of the added delays between clock and data
- Many existing variations, making it difficult to find development tools like host adapters that support those variations
- SPI does not support hot swapping (dynamically adding nodes).
- Interrupts must either be implemented with out-of-band signals or be faked by using periodic polling similarly to USB 1.1 and 2.0.
- Some variants like dual SPI, quad SPI, and three-wire serial buses defined below are half-duplex.
Applications

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 main or sub mode. In-system programmable AVR controllers (including blank ones) can be programmed using a SPI interface.[12]
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.
The full-duplex capability makes SPI very simple and efficient for single main/single sub 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.
SPI is used to talk to a variety of peripherals, such as
- Sensors: temperature, pressure, ADC, touchscreens, video game controllers
- Control devices: audio codecs, digital potentiometers, DAC
- Camera lenses: Canon EF lens mount
- Communications: Ethernet, USB, USART, CAN, IEEE 802.15.4, IEEE 802.11, handheld video games
- Memory: flash and EEPROM
- Real-time clocks
- LCD, sometimes even for managing image data
- Any MMC or SD card (including SDIO variant[11])
- Shift registers[13]
For high-performance systems, FPGAs sometimes use SPI to interface as a sub to a host, as a main to sensors, or for flash memory used to bootstrap if they are SRAM-based.
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.[14]
SGPIO is essentially another (incompatible) application stack for SPI designed for particular backplane management activities.[citation needed] SGPIO uses 3-bit messages.
Standards
The SPI bus is a de facto standard. However, the lack of a formal standard is reflected in a wide variety of protocol options. Different word sizes are common. Every device defines its own protocol, including whether it supports commands at all. Some devices are transmit-only; others are receive-only. Chip selects are sometimes active-high rather than active-low. Some protocols send the least significant bit first.
SPI Bus was originally defined by Motorola. The original defining document was Motorola Application Node AN991. When Freescale spun out of Motorola, the responsibility for AN991 went with Freescale. When NXP acquired Freescale, NXP also acquired responsibility for AN991 which was last revised in January 2002 as AN991/D and still serves as the "official" defining document for SPI Bus.[15]
Variations
Some devices have minor variances from the CPOL/CPHA modes described above. Sending data from sub to main may use the opposite clock edge as main to sub. Devices often require extra clock idle time before the first clock or after the last one, or between a command and its response. Some devices have two clocks, one to read data, and another to transmit it into the device. Many of the read clocks run from the chip select line.
Some devices require an additional flow control signal from sub to main, indicating when data is ready. This leads to a 5-wire protocol instead of the usual 4. Such a ready or enable signal is often active-low, and needs to be enabled at key points such as after commands or between words. Without such a signal, data transfer rates may need to be slowed down significantly, or protocols may need to have dummy bytes inserted, to accommodate the worst case for the sub response time. Examples include initiating an ADC conversion, addressing the right page of flash memory, and processing enough of a command that device firmware can load the first word of the response. (Many SPI mains do not support that signal directly, and instead rely on fixed delays.)
Many SPI chips only support messages that are multiples of 8 bits. Such chips can not interoperate with the JTAG or SGPIO protocols, or any other protocol that requires messages that are not multiples of 8 bits.
There are also hardware-level differences. Some chips combine MOSI and MISO into a single data line (SI/SO); this is sometimes called 'three-wire' signaling (in contrast to normal 'four-wire' SPI). Another variation of SPI removes the chip select line, managing protocol state machine entry/exit using other methods. Anyone needing an external connector for SPI defines their own: UEXT, JTAG connector, Secure Digital card socket, etc. Signal levels depend entirely on the chips involved.
SafeSPI[16] is an industry standard for SPI in automotive applications. Its main focus is the transmission of sensor data between different devices.
Development tools
When developing or troubleshooting systems using SPI, visibility at the level of hardware signals can be important.
Host adapters
There are a number of USB hardware solutions to provide computers, running Linux, macOS, or Windows, SPI main or sub capabilities. Many of them also provide scripting or programming capabilities (Visual Basic, C/C++, VHDL, etc.).
An SPI host adapter lets the user play the role of a main on an SPI bus directly from a PC. They are used for embedded systems, chips (FPGA, ASIC, and SoC) and peripheral testing, programming and debugging.
The key parameters of SPI are: the maximum supported frequency for the serial interface, command-to-command latency and the maximum length for SPI commands. It is possible to find SPI adapters on the market today that support up to 100 MHz serial interfaces, with virtually unlimited access length.
SPI protocol being a de facto standard, some SPI host adapters also have the ability of supporting other protocols beyond the traditional 4-wire SPI (for example, support of quad-SPI protocol or other custom serial protocol that derive from SPI[17]).
Protocol analyzers
SPI protocol analyzers are tools which sample an SPI bus and decode the electrical signals to provide a higher-level view of the data being transmitted on a specific bus.
Oscilloscopes
Most oscilloscope vendors offer oscilloscope-based triggering and protocol decoding for SPI. Most support 2-, 3-, and 4-wire SPI. The triggering and decoding capability is typically offered as an optional extra. SPI signals can be accessed via analog oscilloscope channels or with digital MSO channels.[18]
Logic analyzers
When developing or troubleshooting the SPI bus, examination of hardware signals can be very important. Logic analyzers are tools which collect, analyze, decode, and store signals so people can view the high-speed waveforms at their leisure. Logic analyzers display time-stamps of each signal level change, which can help find protocol problems. Most logic analyzers have the capability to decode bus signals into high-level protocol data and show ASCII data.
Related terms
Intelligent SPI controllers
A Queued Serial Peripheral Interface (QSPI; different to but has same abbreviation as Quad SPI described in § Quad SPI) is a type of SPI controller that uses a data queue to transfer data across the SPI bus.[19] It has a wrap-around mode allowing continuous transfers to and from the queue with only intermittent attention from the CPU. Consequently, the peripherals appear to the CPU as memory-mapped parallel devices. This feature is useful in applications such as control of an A/D converter. Other programmable features in Queued SPI are chip selects and transfer length/delay.
SPI controllers from different vendors support different feature sets; such DMA queues are not uncommon, although they may be associated with separate DMA engines rather than the SPI controller itself, such as used by Multichannel Buffered Serial Port (MCBSP).[20] Most SPI main controllers integrate support for up to four chip selects,[21] although some require chip selects to be managed separately through GPIO lines.
Note that Queued SPI is different from Quad SPI, and some processors even confusingly allow a single "QSPI" interface to operate in either quad or queued mode![22]
Microwire

Microwire,[23] often spelled μWire, is essentially a predecessor of SPI and a trademark of National Semiconductor. It's a strict subset of SPI: half-duplex, and using SPI mode 0. Microwire chips tend to need slower clock rates than newer SPI versions; perhaps 2 MHz vs. 20 MHz. Some Microwire chips also support a three-wire mode.
Microwire/Plus
Microwire/Plus[24] is an enhancement of Microwire and features full-duplex communication and support for SPI modes 0 and 1. There was no specified improvement in serial clock speed.
Three-wire serial buses
As mentioned, one variant of SPI uses a single bidirectional data line (sub out/sub in, called SISO or main out/main in, called MOMI) instead of two unidirectional ones (MOSI and MISO). This variant is restricted to a half duplex mode. It tends to be used for lower performance parts, such as small EEPROMs used only during system startup and certain sensors, and Microwire. Few SPI main controllers support this mode; although it can often be easily bit-banged in software.
Dual SPI
For instances where the full-duplex nature of SPI is not used, an extension uses both data pins in a half-duplex configuration to send two bits per clock cycle. Typically a command byte is sent requesting a response in dual mode, after which the MOSI line becomes SIO0 (serial I/O 0) and carries even bits, while the MISO line becomes SIO1 and carries odd bits. Data is still transmitted msbit-first, but SIO1 carries bits 7, 5, 3 and 1 of each byte, while SIO0 carries bits 6, 4, 2 and 0.
This is particularly popular among SPI ROMs, which have to send a large amount of data, and comes in two variants:[25][26]
- Dual read commands the send and address from the main in single mode, and return the data in dual mode.
- Dual I/O commands send the command in single mode, then send the address and return data in dual mode.
Quad SPI
Quad SPI (QSPI; different to but has same abbreviation as Queued-SPI described in § Intelligent SPI controllers) goes beyond dual SPI, adding two more I/O lines (SIO2 and SIO3) and sends 4 data bits per clock cycle. Again, it is requested by special commands, which enable quad mode after the command itself is sent in single mode.[25][26]
- SQI Type 1
- Commands sent on single line but addresses and data sent on four lines
- SQI Type 2
- Commands and addresses sent on a single line but data sent/received on four lines
QPI/SQI

Further extending quad SPI, some devices support a "quad everything" mode where all communication takes place over 4 data lines, including commands.[27] This is variously called "QPI"[26] (not to be confused with Intel QuickPath Interconnect) or "serial quad I/O" (SQI)[28]
This requires programming a configuration bit in the device and requires care after reset to establish communication.
Double data rate
In addition to using multiple lines for I/O, some devices increase the transfer rate by using double data rate transmission.[29][30]
Intel Enhanced Serial Peripheral Interface Bus
Intel has developed a successor to its Low Pin Count (LPC) bus that it calls the Enhanced Serial Peripheral Interface Bus, or eSPI for short. Intel aims to allow the reduction in the number of pins required on motherboards compared to systems using LPC, have more available throughput than LPC, reduce the working voltage to 1.8 volts to facilitate smaller chip manufacturing processes, allow eSPI peripherals to share SPI flash devices with the host (the LPC bus did not allow firmware hubs to be used by LPC peripherals), tunnel previous out-of-band pins through the eSPI bus, and allow system designers to trade off cost and performance.[31][32]
The eSPI bus can either be shared with SPI devices to save pins or be separate from the SPI bus to allow more performance, especially when eSPI devices need to use SPI flash devices.[31]
This standard defines an Alert# signal that is used by an eSPI sub to request service from the main. In a performance-oriented design or a design with only one eSPI sub, each eSPI sub will have its Alert# pin connected to an Alert# pin on the eSPI main that is dedicated to each sub, allowing the eSPI main to grant low-latency service because the eSPI main will know which eSPI sub needs service and will not need to poll all of the subs to determine which device needs service. In a budget design with more than one eSPI sub, all of the Alert# pins of the subs are connected to one Alert# pin on the eSPI main in a wired-OR connection, which will require the main to poll all the subs to determine which ones need service when the Alert# signal is pulled low by one or more peripherals that need service. Only after all of the devices are serviced will the Alert# signal be pulled high due to none of the eSPI subs needing service and therefore pulling the Alert# signal low.[31]
This standard allows designers to use 1-bit, 2-bit, or 4-bit communications at speeds from 20 to 66 MHz to further allow designers to trade off performance and cost.[31]
All communications that were out-of-band of the LPC bus like general-purpose input/output (GPIO) and System Management Bus (SMBus) are tunneled through 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.[31]
This standard supports standard memory cycles with lengths of 1 byte to 4 kilobytes 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 significantly reduces overhead compared to the LPC bus, where all cycles except for the 128-byte firmware hub read cycle spends more than one-half of all of the bus's throughput and time in overhead. The standard memory cycle allows a length of anywhere from 1 byte to 4 kilobytes in order to allow its larger overhead to be amortised over a large transaction. eSPI subs are allowed to initiate bus main versions of all of the memory cycles. Bus main I/O cycles, which were introduced by the LPC bus specification, and ISA-style DMA including the 32-bit variant introduced by the LPC bus specification, are not present in eSPI. Therefore, bus main memory cycles are the only allowed DMA in this standard.[31]
eSPI subs are allowed to use the eSPI main as a proxy to perform flash operations on a standard SPI flash memory sub on behalf of the requesting eSPI sub.[31]
64-bit memory addressing is also added, but is only permitted when there is no equivalent 32-bit address.[31]
The Intel Z170 chipset can be configured to implement either this bus or a variant of the LPC bus that is missing its ISA-style DMA capability and is underclocked to 24 MHz instead of the standard 33 MHz.[33]
Alternative namings
The original SPI specification used historical terminology of "Master" to identify the main device and "Slave" to identify subservient devices:
- SCLK : Serial Clock (output from main)
- MOSI : "Master" Out "Slave" In (data output from main)
- MISO : "Master" In "Slave" Out (data output from sub)
- SS : "Slave" Select (same functionality as chip select)
On a sub-only device, MOSI may be labeled as SDI (Serial Data In) and MISO may be labeled as SDO (Serial Data Out). Many products have SPI pin abbreviations that also deviate from the original specification:
Serial Clock:
- SCK, SCLK, CLK, SCL
Master Output → Slave Input (MOSI):
- SIMO, MTSR, SPID - correspond to MOSI on both main and sub devices, connects to each other
- SDI, DI, DIN, SI, SDA - on sub devices; connects to MOSI on main, or to below connections
- SDO, DO, DOUT, SO - on main devices; connects to MOSI on sub, or to above connections
- COPI, PICO,[34] COTI
Master Input ← Slave Output (MISO):
- SOMI, MRST, SPIQ - correspond to MISO on both main and sub devices, connects to each other
- SDO, DO, DOUT, SO - on sub devices; connects to MISO on main, or to below connections
- SDI, DI, DIN, SI - on main devices; connects to MISO on sub, or to above connections
- CIPO, POCI,[34] CITO
Slave Select:
- SS, SS, SSEL, NSS, /SS, SS# (sub select)
- CS, CS (chip select)
- CSN (chip select/enable)
- CE (chip enable)
See also
Notes
- ^ Historically this arrangement has been called master/slave, however alternative terms are used to to avoid referencing slavery.
- ^ For any given transaction SPI is one master and multi slave communication. While typically there is only one master, however, some Atmel and Silabs devices support changing master and slave roles on the fly depending on an external pin.
- ^ While Synchronous Serial Interface (SSI) is also a four-wire synchronous serial communication protocol, the SSI protocol employs differential signaling and provides only a single simplex communication channel.
References
- ^ Dhaker, Piyu (2018). "Introduction to SPI Interface". Analog Dialogue. Archived from the original on 2023-05-25. Retrieved 2023-07-21.
- ^ "What is Serial Synchronous Interface (SSI)?". Retrieved 2015-01-28.
- ^ SPI Block Guide v3.06; Motorola/Freescale/NXP; 2003.
- ^ a b Better SPI Bus Design in 3 Steps
- ^ Maxim-IC application note 3947: "Daisy-Chaining SPI Devices"
- ^ Interfaces, 1977, pp. 80, 84
- ^ "Serial-controlled multiplexer expands SPI ports". Electronic Design. Retrieved 14 February 2021.
- ^ "USB to SPI converter". FTDI. Retrieved 14 February 2021.
- ^ "Transmitting SPI over LVDS Interfaces" (PDF). Texas Instruments. Retrieved 14 February 2021.
- ^ "SPI Master Loopback Example". Nordic Semiconductor. Retrieved 14 February 2021.
- ^ a b Not to be confused with the SDIO(Serial Data I/O) line of the half-duplex implementation of the SPI bus, sometimes also called "3-wire SPI-bus". Here e.g. MOSI (via a resistor) and MISO (no resistor) of a master is connected to the SDIO line of a slave.
- ^ "AVR910 - In-system programming" (PDF). Archived from the original (PDF) on 2011-03-02.
- ^ Szczys, Mike (2011-11-04). "How to drive 595 shift registers with AVR hardware SPI - Jumptuck". jumptuck.com. Archived from the original on 2023-02-04. Retrieved 2023-07-21.
- ^ IEEE 1149.1-2013
- ^ "AN991/D: Using the Serial Peripheral Interface to Communicate Between Multiple Microcomputers" (PDF). Retrieved 2021-10-14.
- ^ SafeSPI.org
- ^ SPI Storm – Serial Protocol Host Adapter with support of custom serial protocols, Byte Paradigm.
- ^ "N5391B I²C and SPI Protocol Triggering and Decode for Infiniium scopes".
- ^ "Freescale Semiconductor, Inc. - QSM - Queued Serial Module - Reference Manual" (PDF). NXP. 1996 [1991]. Archived from the original (PDF) on 2019-08-24.
- ^ Such as with the MultiChannel Serial Port Interface, or McSPI, used in Texas Instruments OMAP chips.
- ^ Such as the SPI controller on Atmel AT91 chips like the at91sam9G20, which is much simpler than TI's McSPI.
- ^ "Quad-SPI Brings Fast Parallel Data Transmission". Cadence Design Systems. 2023-01-11. Archived from the original on 2023-06-01. Retrieved 2023-06-30.
- ^ MICROWIRE Serial Interface National Semiconductor Application Note AN-452
- ^ MICROWIRE/PLUS Serial Interface for COP800 Family National Semiconductor Application Note AN-579
- ^ a b "W25Q16JV 3V 16M-bit serial flash memory with Dual/Quad SPI" (PDF) (data sheet). Revision D. Winbond. 12 August 2016. Retrieved 2017-02-10.
- ^ a b c "D25LQ64 1.8V Uniform Sector Dual and Quad SPI Flash" (PDF) (data sheet). version 0.1. GigaDevice. 11 February 2011. Archived from the original (PDF) on 12 February 2017. Retrieved 2017-02-10.
- ^ "QuadSPI flash: Quad SPI mode vs. QPI mode". NXP community forums. December 2014. Retrieved 2016-02-10.
- ^ "SST26VF032B / SST26VF032BA 2.5V/3.0V 32 Mbit Serial Quad I/O (SQI) Flash Memory" (PDF) (Data sheet). version E. Microchip, Inc. 2017. Retrieved 2017-02-10.
- ^ Patterson, David (May 2012). "Quad Serial Peripheral Interface (QuadSPI) Module Updates" (PDF) (Application note). Freescale Semiconductor. Retrieved September 21, 2016.
- ^ Pell, Rich (13 October 2011). "Improving performance using SPI-DDR NOR flash memory". EDN.
- ^ a b c d e f g h Enhanced Serial Peripheral Interface (eSPI) Interface Base Specification (for Client and Server Platforms) (PDF) (Report). Revision 1.0. Intel. January 2016. Document number 327432-004. Retrieved 2017-02-05.
- ^ Enhanced Serial Peripheral Interface (eSPI) Interface Specification (for Client Platforms) (PDF) (Report). Revision 0.6. Intel. May 2012. Document Number 327432-001EN. Retrieved 2017-02-05.
- ^ "Intel® 100 Series Chipset Family PCH Datasheet, Vol. 1" (PDF). Retrieved April 15, 2015.
- ^ a b SPI; OSHWA.