SPI1

The Pi-Tron has the same GPIO header as the Raspberry Pi B(+) models. Since the SPI 0 bus is intended to be used for the CAN bus function of the Pi-Tron, the SPI 1 bus can be used instead.

1. Update Raspberry Pi OS

pi@raspberry:~ $ sudo apt-get update
pi@raspberry:~ $ sudo apt-get dist-upgrade

2. Edit the config.txt

pi@raspberry:~ $ sudo nano /boot/config.txt

Enter the following at the end of the file:

### SPI 1 interface with 3 chip enable/chip select signals
dtparam=spi=on
dtoverlay=spi1-3cs

Save the changes.

3. Reboot

pi@raspberry:~ $ sudo reboot

4. Check for SPI1

After the reboot there should be 3 new SPI devices in the /dev/ folder. It should be spidev1.0 to spidev1.2.

pi@raspberry:~ $ ls -la /dev/spidev1*
crw-rw---- 1 root spi 153, 3 Feb 14  2019 /dev/spidev1.0
crw-rw---- 1 root spi 153, 2 Feb 14  2019 /dev/spidev1.1
crw-rw---- 1 root spi 153, 1 Feb 14  2019 /dev/spidev1.2

The SPI 1 bus is located on the GPIO header at:

Pin number GPIO name GPIO description
12 GPIO18 SPI1 CE0 N
11 GPIO17 SPI1 CE1 N
36 GPIO16 SPI1 CE2 N
35 GPIO19 SPI1 MISO
38 GPIO20 SPI1 MOSI
40 GPIO21 SPI1 SCLK