Adafruit Industries, Essential service and business: NYC – Executive Order 202.6 - Read more.
0

using universal-io / SPI mode
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

using universal-io / SPI mode

by rifo on Fri Jun 24, 2016 1:03 pm

Hello,

I am planning to use SPI 1 in my project. I thought of proceeding like below, can you please comment whether this makes sense?

// Disable HDMI by adding below line to uEnv.txt
cape_disable=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN

// Load univ overlay files
echo cape-univ-hdmi > /sys/devices/bone_capemgr.9/slots
echo cape-universal > /sys/devices/bone_capemgr.9/slots

// Change appropriate pin modes to SPI
config-pin P9.28 spi
config-pin P9.29spi
config-pin P9.30 spi
config-pin P9.31 spi

thanks a lot
rifo
rifo
 
Posts: 42
Joined: Sun Jan 26, 2014 3:07 pm

Re: using universal-io / SPI mode

by drewfustini on Fri Jun 24, 2016 9:44 pm

Which Debian image are you using?

Are there other pins / peripherals that you are planing to use?

drewfustini
 
Posts: 920
Joined: Sat Dec 26, 2015 1:19 pm

Re: using universal-io / SPI mode

by rifo on Sat Jun 25, 2016 3:18 am

Hello,

I am using " BeagleBoard.org Debian Image 2015-03-01 " and

my kernel version is "Linux beaglebone 3.8.13-bone79 #1 SMP Tue Oct 13 20:44:55 UTC 2015 armv7l GNU/Linux"

Actually I want to control multiple spi slave devices so I planned to use extra GPIOs to as Slave Select.
rifo
 
Posts: 42
Joined: Sun Jan 26, 2014 3:07 pm

Re: using universal-io / SPI mode

by drewfustini on Sun Jun 26, 2016 5:47 am

For the Linux 3.8 kernel, it may be simpler to just use a device tree overlay for SPI0 or SPI1.

For example, to enable SPI0, edit /boot/uboot/uEnv.txt:
cape_enable=capemgr.enable_partno=BB-SPIDEV0


Verify that SPIDEV0 is loaded:
$ cat /sys/devices/bone_capemgr.9/slots
<snip>
7: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-SPIDEV0


As for using GPIO as Chip Select, you should check out this post :
GPIO Chip Selects with the BeagleBone

drewfustini
 
Posts: 920
Joined: Sat Dec 26, 2015 1:19 pm

Re: using universal-io / SPI mode

by rifo on Sun Jun 26, 2016 6:28 am

Hello Drew

Thanks again for the answers. I may add a gps and some other sensors later on during the project.
So to have a general solution
can you please comment about changing to spi mode with config-pin?
rifo
 
Posts: 42
Joined: Sun Jan 26, 2014 3:07 pm

Re: using universal-io / SPI mode

by drewfustini on Thu Jun 30, 2016 1:29 am

Here is example of configuring the SPI0 pins.

First, verify cape unverisal is loaded:
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


Next check the possible modes for the pins:
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


Set the SPI0 pins to spi mode:
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


Check that the pins were set to SPI mode OK:
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

drewfustini
 
Posts: 920
Joined: Sat Dec 26, 2015 1:19 pm

Please be positive and constructive with your questions and comments.