Hardware Reference
In-Depth Information
SPI
SPI consists of four wires to communicate data from a master (the microprocessor) to a slave
device (the peripheral). Data is sent serially (that is, the voltage on a wire is switched on and
off to communicate a binary number) over time using four wires as shown in Figure 1-1.
One wire is used for data from the master to the slave (named master output
slave input [MOSI]).
Data going to the master from the slave is sent on another wire (named master
input slave output [MISO]).
The serial clock (SCK) wire is used to synchronise the master and slave so they
know when a valid value is being sent (that is, that MISO and MOSI have
momentarily stopped changing).
The slave select wire, or sometimes called chip select (SS or CS), selects
between multiple slave devices connected to the same MOSI, MISO and SCK
wires.
Figure 1-1:
Example SPI
transaction: The
microprocessor
sends data
11011101, and
the device sends
11110011.
Installing PiFace Digital Software
Appendix A, “Getting Your Raspberry Pi Up and Running”, mentions drivers that the operat-
ing system loads. These make it easy for programmers to write code to interact with hard-
ware devices. Rather than bloat the operating system with drivers for every possible type of
hardware, Linux has driver modules. These are loaded separately when needed. As PiFace
Digital talks over SPI you need to ensure that the SPI driver is loaded so the Raspberry Pi
hardware sends the correct electrical signals on the expansion pins. You will also need to
install a Python library that makes the SPI driver easy to use from your Python code.
 
Search WWH ::




Custom Search