User Guide

170
from the 3.3 V supply passes through the diode and into the 5 V
device, pulling low the GPIO pin on the Pi. When the 5 V device
outputs a high signal, the diode blocks the voltage. But because
the diode is blocking, the 3.3 V cannot flow to the 5 V device and
so it flows into the GPIO pin on the Pi – creating a high signal.
Figure 9. Using a diode for 5 V to 3.3 V interfacing
7.7 Serial Peripheral Interface (SPI)
Serial peripheral interface (SPI) is a serial data protocol that is
used by microcontrollers and small electronic devices to
exchange information. The term “serial” means that each bit of
a binary number (for example, the number 255 is made up of
eight bits in binary – 11111111) is sent one at a time, on the
same wire.
SPI divides devices into two categories: masters, and slaves. The
master is the device that starts the communication. The slave
receives instructions from the master and does what it is told. A
master can talk to many slave devices, but usually only one at a
time.
To use SPI, you need four pins:
Pin Name Description
MOSI Master output, slave input. The master uses this
line to send information to the slave.
MISO Master input, slave output. The master uses this
line to read information from the slave.
SCK Serial clock. Each bit is read on the “edge” of the
clock signal.