Getting SPI working on the Raspberry Pi

The good thing about the web is, that you find thousands of answers to a specific question, but the really hard task is to find out which ones are “outdated” and which ones are the “state-of-the-art” way to do it. This is especially true when the question deals about an issue that is relatively new, and when there is a lot of work in progress around the issue by various people and groups.

I want to communicate with the RF module (with the TI CC1101) using SPI, so there is the need to get it working on my Raspberry Pi. After trying out several things I found on the web, it seems that the solution is quite easy:

You just need to remove the ‘blacklist’ entries from raspi-blacklist.conf.

sudo vi /etc/modprobe.d/raspi-blacklist.conf

Image

Just comment out the two lines and reboot the system.

After the system is up again, use the command lsmod to show the status of the modules in the linux kernel:

pi@raspberrypi ~ $ lsmod
Module Size Used by
snd_bcm2835 15846 0 
snd_pcm 77560 1 snd_bcm2835
snd_page_alloc 5145 1 snd_pcm
snd_seq 53329 0 
snd_seq_device 6438 1 snd_seq
snd_timer 19998 2 snd_pcm,snd_seq
snd 58447 5 snd_bcm2835,snd_timer,snd_pcm,snd_seq,snd_seq_device
spidev 5224 0 
leds_gpio 2235 0 
led_class 3562 1 leds_gpio
spi_bcm2708 4510 0 
i2c_bcm2708 3759 0

You should now see the modules spi_bcm2708 and i2c_bcm2708. You should also see two device files in your /dev folder:

pi@raspberrypi ~ $ ls /dev | grep spi
spidev0.0
spidev0.1
Advertisements

One thought on “Getting SPI working on the Raspberry Pi

  1. Correction:
    It is sufficient to remove the blacklist entry for the spi-bcm2708 (controller) driver. We don’t deal with I2C in our project, so the i2c-bcm2708 (controller) driver may stay as “blacklisted” in the /etc/modprobe.d/raspi-blacklist.conf file. Of course, if you keep this i2c driver as blacklisted, it will not show up in the lsmod command.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s