}

Enable additional SPI port on the raspberry pi 2

Created:

Introduction

This tutorial explain how to add more spi devices to the raspberry pi by enabling the spi1. Raspberry pi by default has the /dev/spi0.0 and /dev/spi0.1, doing this tutorial will enable you to use /dev/spi1.0.

This tutorial requires kernel 4.4, which has the feature to add a second hardware SPI peripheral, SPI1.

Configuration

If you never enabled spi add the following line to the /boot/config.txt:

dtparam=spi=on

To enable spi1 also another line to the /boot/config.txt

dtoverlay=spi1-3cs

Reboot and check with ls that the new spi devices are in /dev/:

ls /dev/spidev*

Pin outs for spi1

GPIO20 (Pin Header Number 38) – MOSI GPIO19 (Pin Header Number 35) – MISO GPIO21 (Pin Header Number 40) – SCLK GPIO18 (Pin Header Number 12) – CE0

Raspberry pi 2 SPI1 pinout