Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pdp7/e56c6907e3f7fa69f01c193bc936971f to your computer and use it in GitHub Desktop.
Save pdp7/e56c6907e3f7fa69f01c193bc936971f to your computer and use it in GitHub Desktop.
adafruit beaglebone cape universal spi pin config
Here is example of configuring the SPI0 pins.
First, verify cape unverisal is loaded:
[quote]
root@beaglebone:~# cat /sys/devices/platform/bone_capemgr/slots
0: PF---- -1
1: PF---- -1
2: PF---- -1
3: PF---- -1
4: P-O-L- 0 Override Board Name,00A0,Override Manuf,cape-universaln
root@beaglebone:~# uname -a
Linux beaglebone 4.4.11-ti-r29 #1 SMP Fri May 27 22:58:36 UTC 2016 armv7l GNU/Linux
root@beaglebone:~# cat /etc/dogtag
BeagleBoard.org Debian Image 2016-06-05
[/quote]
Next check the possible modes for the pins:
[quote]
root@beaglebone:~# config-pin -l P9.17
default gpio gpio_pu gpio_pd spi i2c pwm
root@beaglebone:~# config-pin -l P9.17 #SPI0_CS
default gpio gpio_pu gpio_pd spi i2c pwm
root@beaglebone:~# config-pin -l P9.18 #SPI0_D1
default gpio gpio_pu gpio_pd spi i2c pwm
root@beaglebone:~# config-pin -l P9.22 #SPI0_SCLK
default gpio gpio_pu gpio_pd spi uart i2c pwm
root@beaglebone:~# config-pin -l P9.21 #SPI0_D0
default gpio gpio_pu gpio_pd spi uart i2c pwm
[/quote]
Set the SPI0 pins to spi mode:
[quote]
root@beaglebone:~# config-pin P9.17 spi #SPI0_CS
root@beaglebone:~# config-pin P9.18 spi #SPI0_1
root@beaglebone:~# config-pin P9.21 spi #SPI0_D0
root@beaglebone:~# config-pin P9.22 spi #SPI0_SCLK
[/quote]
Check that the pins were set to SPI mode OK:
[quote]
root@beaglebone:~# config-pin -q P9.17
P9_17 Mode: spi
root@beaglebone:~# config-pin -q P9.18
P9_18 Mode: spi
root@beaglebone:~# config-pin -q P9.21
P9_21 Mode: spi
root@beaglebone:~# config-pin -q P9.22
P9_22 Mode: spi
[/quote]
@pdp7
Copy link
Author

pdp7 commented Oct 21, 2016

config-pin -l P9.17 #SPI0_CS
config-pin -l P9.18 #SPI0_D1
config-pin -l P9.22 #SPI0_SCLK
config-pin -l P9.21 #SPI0_D0

# Set the SPI0 pins to spi mode:
config-pin P9.17 spi #SPI0_CS
config-pin P9.18 spi #SPI0_1
config-pin P9.21 spi #SPI0_D0
config-pin P9.22 spi #SPI0_SCLK

# Check that the pins were set to SPI mode OK:
config-pin -q P9.17
config-pin -q P9.18
config-pin -q P9.21
config-pin -q P9.22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment