Hardware Reference
In-Depth Information
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.
Installing PiFace Digital Software
Chapter 1, “Getting Your Raspberry Pi Up and Running”, mentions drivers that the operating
system loads. hese make it easy for programmers to write code to interact with hardware
devices. Rather than bloat the operating system with drivers for every possible type of hard-
ware, Linux has driver modules. hese 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.
It is possible to install PiFace Digital software on Raspbian as a Debian package with one
command. However, in the future you might need to install software that isn't packaged, or
perhaps want to use PiFace Digital on a diferent distribution that doesn't use Debian pack-
ages. As such the following steps show how to manually install software from the source.
Loading the SPI Driver Module
Check to see if the SPI driver is loaded. Type lsmod to list all modules. If it is loaded, you will
see the following line. Don't worry about the numbers on the right; it is the module name
spi_bcm2708 which is important.
spi_bcm2708 4401 0
If it is not listed, you need to enable the module. Although the driver module is included,
Linux “blacklists” some modules so they are not loaded. To un-blacklist the module, edit the
ile /etc/modprobe.d/raspi-blacklist.conf. You can insert a # in front of the line blacklist
spi-bcm2708 to comment it out, or delete the line completely. Use your favourite editor to
edit the ile, such as leafpad, nano or vi. For example, you use nano by typing the following:
sudo nano /etc/modprobe.d/raspi-blacklist.conf
 
Search WWH ::




Custom Search