Enabling The SPI Port

You now use the raspbian config tool:


sudo raspi-config

Select 'Advanced Options' and then select the relevant option.

Enabling The SPI Port On Old Raspbian Distributions

The SPI port needs to be enabled in Raspbian before it can be used.

Edit the modules blacklist file:

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

Add a '#' character to this line so it is commented out:

#blacklist spi-bcm2708

Exit and save the file.

Enter "sudo reboot" to restart the pi and now the SPI pins will be available to use.

Test the SPI Port

Test the SPI port is working by typing:


ls /dev/spidev*

You should see the following:


/dev/spidev0.0  /dev/spidev0.1

There are 2 spidev devices shown.  The first number refers to the SPI peripheral which in both cases is 0 (the RPi only has 1 SPI port), the second number represents the chip select pins CS0 and CS1 .

USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.