Hardware Reference
In-Depth Information
connected. On the Arduino Leonardo, the MOSI pin is available only on the
ICSP header and cannot be output to any digital pins.
ICSP
Figure 7-2: The ICSP header on an Arduino Uno
If you move on to designing your own shields, use the ICSP headers. Arduino
shields that use SPI cannot function on the Arduino Leonardo if they do not
use the ICSP header, and SPI is used for numerous connections (including
SD-card readers).
The ICSP header does not include any SS lines; only the MISO, MOSI, and
SCLK lines are exposed, together with power and ground connectors. Because
the Slave Select pin is not used to transfer data, but used only to tell a slave
that it will be addressed, any digital output pin can be used as a Slave Select.
This way, you can have an extremely large amount of slaves on your system;
however, remember that only one slave can be selected at any time; it is up to
you to drive all the outputs high when not talking to a slave.
Arduinos also have the possibility of becoming an SPI slave, and as such,
AVR-based Arduinos have an input SS pin. The Arduino SPI library can be
only a master, and as such, this pin must be coni gured as an output. Failure to
do so might make the Arduino believe that it is a slave and render the library
inoperative. On most Arduinos, this is pin 10, and on the Arduino Mega2560,
it is pin 53.
SPI Library
The Arduino SPI library is a powerful library designed to handle SPI commu-
nications simply and effectively. Most Arduino boards utilize the SPI library in
the exact same way, but there are notable differences if you're using an Arduino
 
Search WWH ::




Custom Search