4

Is there any option to control the second SPI interface of Raspberry Pi 2 B with SpiDev?

http://pinout.xyz/pinout/spi

Pin 19, 21, 23 are SPI0 and Pin 35, 38, 40 are SPI1.

SPI0 works perfect, but if I try to open SPI1 an IOError raises:

IOError: [Errno 2] No such file or directory

My code to open:

spi = spidev.SpiDev()
spi.open(1,2) #for SPI1 CS2
spi.open(0,0) #for SPI0 CS0

In /dev/ there are also only 2 SPI files

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

But is there any option to use the second SPI interface?

4

Edit /boot/config.txt, add the following line, and reboot.

dtoverlay=spi1-3cs

You should then have the following devices.

$ ls /dev/sp*
/dev/spidev0.0  /dev/spidev0.1  /dev/spidev1.0  /dev/spidev1.1  /dev/spidev1.2

Then try the Python spidev module.

  • Thank you, this is working. I only found answers which say that the second SPI interface is not usable. – jhns Jul 8 '16 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.