- SPI0: Connect wire from P9_18 and P9_21
- SPI1: Connect wire from P9_29 and P9_30
- Pins: http://beagleboard.org/static/images/cape-headers-spi.png
uname_r=4.4.39-ti-r79
cmdline=coherent_pool=1M quiet cape_universal=enable
cape_enable=bone_capemgr.enable_partno=cape-universala
for i in 17 18 19 20 21 22 28 29 30 31 42;
do echo config-pin P9.$i spi;
done
config-pin P9.17 spi
config-pin P9.18 spi
config-pin P9.19 spi
config-pin P9.20 spi
config-pin P9.21 spi
config-pin P9.22 spi
config-pin P9.28 spi
config-pin P9.29 spi
config-pin P9.30 spi
config-pin P9.31 spi
config-pin P9.42 spi
Source: https://raw.githubusercontent.com/torvalds/linux/master/tools/spi/spidev_test.c
debian@beaglebone:~/spi$ sudo ./spidev_test --device /dev/spidev1.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
debian@beaglebone:~/spi$ sudo ./spidev_test --device /dev/spidev1.1
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
debian@beaglebone:~/spi$ sudo ./spidev_test --device /dev/spidev2.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
debian@beaglebone:~/spi$ sudo ./spidev_test --device /dev/spidev2.1
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
from Adafruit_BBIO.SPI import SPI
# From Adafruit Learning System:
# https://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black/spi
#spi = SPI(bus, device) #/dev/spidev<bus>.<device>
#spi = SPI(0,0) #/dev/spidev1.0
#spi = SPI(0,1) #/dev/spidev1.1
#spi = SPI(1,0) #/dev/spidev2.0
#spi = SPI(1,1) #/dev/spidev2.1
spi = SPI(0,0)
print spi.xfer2([32, 11, 110, 22, 220])
spi.close()
debian@beaglebone:~/spi$ sudo python test-spi.py
[32, 11, 110, 22, 220]
debian@beaglebone:~/spi$ sudo strace -e open -f python ./test-spi.py 2>&1 |grep /dev/spidev
open("/dev/spidev1.0", O_RDWR|O_LARGEFILE) = 3
I tried the above steps but did not work in my case. Here is the log :
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)
Could you help me?