Hardware Reference
In-Depth Information
Driver Support
Raspbian Linux supports SPI through the spi_bcm2708 kernel module. As a loadable
kernel module, it may not be loaded by default. Check for it by using the lsmod command:
$ lsmod
Module Size Used by
spidev 5136 0
spi_bcm2708 4401 0
...
If you would like the module loaded by default after a reboot, edit the /etc/
modprobe.d file raspi-blacklist.conf . In the file, look for the line
blacklist spi-bcm2708
and change that to a comment line, by putting a # character in front, as follows:
# blacklist spi-bcm2708
With that module un-blacklisted, the module will automatically be loaded with each
new reboot.
The kernel module can be manually loaded by using modprobe command:
$ sudo modprobe spi_bcm2708
This loads the module and its dependents. Once the kernel module support is
present, the device driver nodes should appear:
$ ls /dev/spi
/dev/spidev0.0 /dev/spidev0.1
$
These two device nodes are named according to which slave select should be
activated, as shown in Table 13-3 .
Table 13-3. SPI Device Nodes
Pathname
Bus
Device
GPIO
SS
/dev/spidev0.0
0
0
8
CE 0
/dev/spidev0.1
0
1
7
CE 1
If you open either of these device nodes by applying the option SPI_NO_CS , the
node chosen makes no difference. Macro SPI_NO_CS indicates that slave select will be
performed by the application instead of the driver, if any select is used at all. (When only
one slave device is attached, the peripheral can be permanently selected.)
 
 
Search WWH ::




Custom Search