ArchARM on Raspberry Pi 3, spidev
installed from AUR.
I'm trying to control a Waveshare device via SPI, and can't get SPI to work from Python.
The most basic sanity test I can think of is failing:
- Bridged MISO and MOSI for SPI0 (pins 19,21 in this diagram)
- Run this code as root:
#!/usr/bin/env python3
import spidev
spi = spidev.SpiDev()
spi.open(0, 0)
dat1=[1,2,3,4,5,6,7,7,7,7, 6, 5,5,5,5,5]
dat2 = spi.xfer(dat1)
print(dat1)
print(dat2)
- Get the following output:
$ sudo ./pyloop.py
[1, 2, 3, 4, 5, 6, 7, 7, 7, 7, 6, 5, 5, 5, 5, 5]
[0, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2]
I established these are the right pins because when I disconnected them the output changed to zeros.
What am I missing?
Thanks!