- All Implemented Interfaces:
- SPIConstants, Closeable, AutoCloseable
public class SpiDevice
extends Object
implements Closeable, SPIConstants
https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md
For modern Raspberry Pis:
2 SPI controllers, 0 (SPI-0) and 1 (SPI-1)
Controller 0 has 2 channels (CE-0 on physical pin 24, CE-1 on physical pin 26)
Controller 1 has 3 channels (CE-0 on physical pin 12, CE-1 on physical pin 11, CE-2 on physical pin 36)
SPI-1 is more limited that SPI-0 on the Raspberry Pi (https://www.raspberrypi.org/forums/viewtopic.php?t=81903&p=579154)
- The SPI-1 clock is derived from the system clock therefore you have to be careful when over/underclocking to set the right divisor
- Limited IRQ support, no thresholding on the FIFO except "TX empty" or "done".
- No DMA support (no peripheral DREQ)
On a RPi 3 you have to change the GPU core frequency to 250 MHz, otherwise the SPI clock has the wrong frequency.
Do this by adding the following line to /boot/config.txt and reboot.
core_freq=250