Skip to content

Enabling SPI on RaspberryPi

Umberto Raimondi edited this page Oct 5, 2016 · 2 revisions

Enablig SPI on a RaspberryPi

The SPI peripheral is not turned on by default. To enable it, do the following.

  • Run sudo raspi-config.
  • Use the down arrow to select 9 Advanced Options
  • Arrow down to A6 SPI.
  • Select yes when it asks you to enable SPI,
  • Also select yes when it asks about automatically loading the kernel module.
  • Use the right arrow to select the <Finish> button.
  • Select yes when it asks to reboot.

The system will reboot. When it comes back up, log in and enter the following command

ls /dev/*spi*

The Pi should respond with

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

(Original source: Learn SparkFun, check out their full guide)

Alternatively, if you are using Ubuntu or other OSes and raspi-config is not available, just edit /boot/firmware/config.txt adding this line:

dtparam=spi=on

and reboot.

If it worked, you'll have two new spidev devices in /dev.

Clone this wiki locally