Skip to content

Commit 8f8c47f

Browse files
committed
Document SPI loopback test
1 parent 1439133 commit 8f8c47f

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

doc/spi_loopback_test.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Adafruit_BBIO SPI test
2+
3+
## Loopback test with SPI0
4+
* Connect wire from P9_18 [SPI0_D1] and P9_21 [SPI0_D0]
5+
* Reference: [P9 header pins](http://beagleboard.org/static/images/cape-headers-spi.png)
6+
7+
## System Info
8+
### uname -r
9+
`4.4.39-ti-r79`
10+
### /etc/debian_version
11+
`8.6`
12+
### /etc/dogtag
13+
`BeagleBoard.org Debian Image 2016-11-27`
14+
### /boot/uEnv.txt
15+
```
16+
uname_r=4.4.39-ti-r79
17+
cmdline=coherent_pool=1M quiet cape_universal=enable
18+
```
19+
### /sys/devices/platform/bone_capemgr/slots
20+
```
21+
0: PF---- -1
22+
1: PF---- -1
23+
2: PF---- -1
24+
3: PF---- -1
25+
4: P-O-L- 0 Override Board Name,00A0,Override Manuf,cape-universaln
26+
```
27+
28+
### config-pin
29+
```
30+
config-pin P9_17 spi
31+
config-pin P9_18 spi
32+
config-pin P9_21 spi
33+
config-pin P9_22 spi
34+
```
35+
36+
## test-spi.py
37+
```
38+
from Adafruit_BBIO.SPI import SPI
39+
40+
# From Adafruit Learning System:
41+
# https://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black/spi
42+
#spi = SPI(bus, device) #/dev/spidev<bus>.<device>
43+
#spi = SPI(0,0) #/dev/spidev1.0
44+
#spi = SPI(0,1) #/dev/spidev1.1
45+
#spi = SPI(1,0) #/dev/spidev2.0
46+
#spi = SPI(1,1) #/dev/spidev2.1
47+
48+
spi = SPI(0,0)
49+
print spi.xfer2([32, 11, 110, 22, 220])
50+
spi.close()
51+
```
52+
53+
### output
54+
```
55+
debian@beaglebone:~/spi$ sudo python test-spi.py
56+
[32, 11, 110, 22, 220]
57+
```
58+
59+
### strace
60+
```
61+
debian@beaglebone:~/spi$ sudo strace -e open -f python ./test-spi.py 2>&1 |grep /dev/spidev
62+
open("/dev/spidev1.0", O_RDWR|O_LARGEFILE) = 3
63+
```

0 commit comments

Comments
 (0)