Beaglebone Black SPI with GPIO CS

275 views
Skip to first unread message

jame...@gmail.com

unread,
Dec 4, 2018, 2:18:07 PM12/4/18
to BeagleBoard
Hi everyone,
I'm trying to add at least three additional GPIO chip selects in addition to the existing hardware CS for SPI0. I found a tutorial here: https://dev.iachieved.it/iachievedit/gpio-chip-selects-with-the-beaglebone/ However, I'm trying to get this to work with the latest U-boot overlays. I've modified the device tree file, compiled it, added it to /boot/uEnv.txt under uboot_overlay_addr4. However, I'm getting this error on boot:

[    1.565570] pinctrl-single 44e10800.pinmux: pin PIN84 already requested by ocp:P9_22_pinmux; cannot claim for 48030000.spi
[    1.576764] pinctrl-single 44e10800.pinmux: pin-84 (48030000.spi) status -22
[    1.583861] pinctrl-single 44e10800.pinmux: could not request pin 84 (PIN84) from group pinmux_bb_spi0_pins  on device pinctrl-single
[    1.595922] omap2_mcspi 48030000.spi: Error applying setting, reverse things back
[    1.603527] omap2_mcspi: probe of 48030000.spi failed with error -22

Based on my understanding, it looks like the universal cape overlay has already claimed the pins, and I'm now unable to set my own settings for the pin. Is there any way around this without decompiling / editing the universal cape overlay? Are there any guides on how to do this with uboot overlays? Unfortunately almost all the documentation revolving device trees on Beaglebone still revolve around the old slots architecture, and very little documentation is available for uboot overlays.

Robert Nelson

unread,
Dec 4, 2018, 2:24:31 PM12/4/18
to Beagle Board, jame...@gmail.com
So the issue is, P9_22 is taken by the cape-universal, so you can't
use it for spi..

2 options:

disable cape-universal in /boot/uEnv.txt

Or upgrade to v4.14.x-ti, which has cape-universal only take the pins un-used..

To better assist you with the 2nd option, please share the output of:

sudo /opt/scripts/tools/version.sh

Regards,

--
Robert Nelson
https://rcn-ee.com/

jame...@gmail.com

unread,
Dec 4, 2018, 5:03:30 PM12/4/18
to BeagleBoard
Here's the output:

git:/opt/scripts/:[0726131c362e3adfcf359f3e1debf5ff156e5bec]
eeprom:[A335BNLT000CyywwBBoxxxx]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[Machinekit Debian Image 2018-09-16]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2018.09-00002-g0b54a51eee]:[location: dd MBR]
kernel:[4.14.69-ti-rt-r75]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_addr4=/lib/firmware/BB-SPICAPE-01-00A0.dtbo]
uboot_overlay_options:[disable_uboot_overlay_audio=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.4.20181120.0-0rcnee0~stretch+20181120]
pkg:[bb-wl18xx-firmware]:[1.20180517-0rcnee0~stretch+20180517]
pkg:[kmod]:[23-2rcnee1~stretch+20171005]
pkg:[roboticscape]:[0.4.4-git20180608.0-0rcnee0~stretch+20180609]:[GOT_REPLACED_BY_NEXT]
WARNING:pkg:[librobotcontrol]:[NOT_INSTALLED]
pkg:[firmware-ti-connectivity]:[20170823-1rcnee1~stretch+20180328]
groups:[machinekit : machinekit adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal i2c bluetooth netdev gpio pwm eqep admin spi tisdk weston-launch xenomai cloud9ide]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet]
dmesg | grep pinctrl-single
[    1.424240] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
[    1.565570] pinctrl-single 44e10800.pinmux: pin PIN84 already requested by ocp:P9_22_pinmux; cannot claim for 48030000.spi
[    1.576764] pinctrl-single 44e10800.pinmux: pin-84 (48030000.spi) status -22
[    1.583861] pinctrl-single 44e10800.pinmux: could not request pin 84 (PIN84) from group pinmux_bb_spi0_pins  on device pinctrl-single
dmesg | grep gpio-of-helper
[    1.445942] gpio-of-helper ocp:cape-universal: ready
END

Robert Nelson

unread,
Dec 4, 2018, 5:12:17 PM12/4/18
to Beagle Board, jame...@gmail.com
Ah i see what your doing now..

Take a look at these 4 examples, your missing the "cape-universal"
disable pins in fragment0, but you see how to use the 3rd cs-gpio in
these exmples..

P9_22_pinmux { status = "disabled"; }; /* RX3 */

https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-mBC1-ETH-CLICK.dts

https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-mBC2-ETH-CLICK.dts

https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-mBC3-ETH-CLICK.dts

https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-mBC4-ETH-CLICK.dts

jame...@gmail.com

unread,
Dec 5, 2018, 7:54:47 AM12/5/18
to BeagleBoard
Excellent, thank you! I got my GPIO CS pins to work. For reference (in case anyone needs the same information), here's my dts file:



/dts-v1/;
/plugin/;

/ {
compatible = "ti,beaglebone", "ti,beaglebone-black";
/* identification */
part-number = "BB-SPICAPE-01";
version = "00A0";

fragment@0 {
target = <&ocp>;
__overlay__ {
P9_17_pinmux { status = "disabled"; };
P9_18_pinmux { status = "disabled"; };
P9_21_pinmux { status = "disabled"; };
P9_22_pinmux { status = "disabled"; };
P8_10_pinmux { status = "disabled"; };
};
};

fragment@1 {
target = <&am33xx_pinmux>;

__overlay__ {
#address-cells = <1>;
#size-cells = <1>;

bb_spi0_pins: pinmux_bb_spi0_pins {
pinctrl-single,pins = <
0x150 0x30 /* spi0_sclk.spi0_sclk, INPUT_PULLUP | MODE0 */
0x154 0x30 /* spi0_d0.spi0_d0, INPUT_PULLUP | MODE0 */
0x158 0x10 /* spi0_d1.spi0_d1, OUTPUT_PULLUP | MODE0 */
0x15c 0x10 /* spi0_cs0.spi0_cs0, OUTPUT_PULLUP | MODE0 */
0x098 0x17 /* P8 10 gpio2_4.spi0_cs1 OUTPUT_PULLUP | MODE7 */
>;
};
};
};

fragment@2 {
target = <&spi0>; /* spi0 is numbered correctly */

__overlay__ {
#address-cells = <1>;
#size-cells = <0>;

status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&bb_spi0_pins>;

cs-gpios = <0>, <&gpio2 4 0>;

spi0@0{
#address-cells = <1>;
#size-cells = <0>;
compatible = "linux,spidev";
reg = <0>;
spi-max-frequency = <16000000>;
};

spi0@1 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "linux,spidev";
reg = <1>;
spi-max-frequency = <16000000>;
};
};
};

};
Reply all
Reply to author
Forward
0 new messages