Learn something new every day
More Info... by email
A serial peripheral interface (SPI) is a low-cost, four-wire, full-duplex synchronous serial communication data stream interface that operates in a master-slave relationship. Data transfer in serial devices occurs one bit at a time, making SPI a low-speed interface. It is commonly used as a link between integrated circuits with on-board slow peripheral devices that are accessed intermittently. It competes with parallel data transmission devices, but as SPI increases in efficiency, the former's advantage is reduced. SPI is sometimes referred to as "microwire," although this is considered as a subset protocol of SPI.
Data transfers by a serial peripheral interface occur via full-duplexed protocol. Data is transferred and received in both directions at the same time. Applications using SPI gain much efficiency in this mode; one such application is between a coder-decoder (codec) and a Digital Signal Processor (DSP). Other applications include temperature and pressure sensors, as well as flash memory.
Whenever two serial peripheral interface devices communicate, one device is referred to as the "master," while the other device is the "slave." The master device initiates all communications by transmitting signals to the slave device. A serial peripheral interface bus can connect multiple slave devices to a single master.
Serial peripheral interface devices use three registers—control register (SPCR), status register (SPSR), and data register (SPDR)—in sending data, along with four different signals. The first signal is called serial clock (SCLK), which only the master device generates. This is followed by master-out slave-in (MOSI), master-in slave-out (MISO), and slave select (SSn), where "n" is the number of slave devices to which the master device is connected.
In a typical single-slave configuration, an engineer looking to use a serial peripheral interface would connect SCLK to a slave device's input. MOSI then carries data from the master device to the slave device while MISO transfers data from the slave to the master. To determine which device is master and which is slave, the former connects Master SSn to Slave SSn and generates a general-purpose discrete input/output signal to the latter.
To connect multiple slaves to one master in a serial peripheral interface, separate SSn signals are connected from the master device to separate slaves. For example, SS1 is connected to Slave 1, SS2 is connected to Slave 2, and so on. Similar to single-slave configuration, SCLK is connected from the master device to the multiple slaves. MOSI from master to slaves are connected, as well as MISO from slaves to master.
How do I connect if both systems are masters in the spi interface, e.g., Raspberry pi?
One of our editors will review your suggestion and make changes if warranted. Note that depending on the number of suggestions we receive, this can take anywhere from a few hours to a few days. Thank you for helping to improve wiseGEEK!