I run raspi-config, enable SPI from menu and get message
The SPI interface is enabled
But in console I see
/usr/bin/raspi-config: 597: /usr/bin/raspi-config: dtparam: not found
Is SPI Enabled? How to verify SPI?
That appears to be a spurious raspi-config
error message (caused by a bad link to a dynamic portion of device tree).
Reboot.
SPI is enabled if /dev/spidev0.0
and /dev/spidev0.1
exist.
sudo nano /boot/config.txt
dtparam=spi=on
sudo reboot
In addition to the above mentioned answers, you can also test if the port is really enabled and working properly as per rasp.'docs: , by connecting a wire between MOSI and MISO and running the following commands:
wget https://raw.githubusercontent.com/raspberrypi/linux/rpi-3.10.y/Documentation/spi/spidev_test.c
gcc -o spidev_test spidev_test.c
./spidev_test -D /dev/spidev0.0
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)
FF FF FF FF FF FF
40 00 00 00 00 95
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF FF FF FF FF
DE AD BE EF BA AD
F0 0D
Basically it is just a loopback test.
Note:
This does not test CE0 and CE1