Hardware Reference
In-Depth Information
HardwareConiguration
Four data lines, at a minimum, are present in any SPI system. Additional SS
lines are added for each slave device appended to the network. Before you learn
how to actually send and receive data to and from an SPI device, you need to
understand what these I/O lines do and how they should be wired. TableĀ 9-2
describes these lines.
Table 9-2: SPI Communication Lines
SPI COMMUNICATION LINE
DESCRIPTION
MOSI
Used for sending serial data from the master device
to a slave device.
MISO
Used for sending serial data from a slave device to
the master device.
SCLK
The signal by which the serial data is synchronized
with the receiving device, so it knows when to read
the input.
SS
A line indicating slave device selection. Pulling it low
means you are speaking with that slave device.
Unlike with the I 2 C bus, pull-up resistors are not required, and communica-
tion is fully bidirectional. To wire an SPI device to the Arduino, all you have to
do is connect the MOSI, MISO, SCLK, and SS pins and you'll be ready to use to
the SPI communication library.
NAMING CONVENTIONS
BecauseSPIisnotauniversalstandard,somedevicesandmanufacturers
mayusedifferentnamesfortheSPIcommunicationlines.Slaveselectis
sometimesreferredtoaschipselect(CS),serialclockissometimesjust
calledclock(CLK),MOSIandMISOpinsonslavedevicesaresometimes
abbreviatedtoserialdatain(SDI),andserialdataout(SDO).
CommunicationScheme
The SPI communication scheme is synced with the clock signal and depends on
the state of the SS line. Because all devices on the bus share the MOSI, MISO, and
SCLK lines, all commands sent from the master arrive at each slave. The SS pin
tells the slave whether it should ignore this data or respond to it. Importantly,
this means that you must make sure to only have one SS pin set low (the active
mode) at a time in any program that you write.
 
Search WWH ::




Custom Search