SPI1 not working: 9_28 Pinmux file missing from ocp directory

While attempting to use the SPI1 pins, I have had trouble in configuring the pins. I had it working after updating to the 4.19.50-ti-rt-r25 kernel, but then it mysteriously stopped working. I believe it stopped when I included the BB-I2C2-00A0.dtbo file in the uBoot, but I can’t be sure.

Here’s where the error happens:

debian@beaglebone:~$ config-pin -a 928 spi_cs
P9_28 pinmux file not found!
bash: /sys/devices/platform/ocp/ocpP9_28_pinmux/state: No such file or directory
Cannot write pinmux file: /sys/devices/platform/ocp/ocp
P9_28_pinmux/state

When I look for this P9_28 file in the ocp directory, I do not see 9_28, 9_29, 9_30, nor 9_31 pinmux.

drwxrwxr-x 3 root gpio 0 Aug 23 15:14 ocp:P9_27_pinmux
drwxrwxr-x 3 root gpio 0 Aug 23 15:14 ocp:P9_41_pinmux

It skips right over.

debian@beaglebone:~$ uname -r

4.19.59-ti-rt-r25

debian@beaglebone:~$ sudo /opt/scripts/tools/version.sh
[sudo] password for debian:
git:/opt/scripts/:[1aa73453b2c980b75e31e83dab7dd8b6696f10c7]
eeprom:[A335BNLTEIA04218BBBK0D06]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Image 2018-10-07]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2018.09-00002-g0b54a51eee]:[location: dd MBR]
kernel:[4.19.59-ti-rt-r25]
nodejs:[v6.14.4]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_addr4=/lib/firmware/BB-SPIDEV1-00A0.dtbo]
uboot_overlay_options:[disable_uboot_overlay_video=1]
uboot_overlay_options:[disable_uboot_overlay_audio=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade ]
pkg:[bb-cape-overlays]:[4.4.20190812.0-0rcnee0~stretch+20190812]
pkg:[bb-wl18xx-firmware]:[1.20180517-0rcnee0~stretch+20180517]
pkg:[kmod]:[23-2rcnee1~stretch+20171005]
pkg:[librobotcontrol]:[1.0.3-git20181005.0-0rcnee0~stretch+20181005]
pkg:[firmware-ti-connectivity]:[20170823-1rcnee1~stretch+20180328]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal i2c bluetooth netdev cloud9ide gpio pwm eqep admin spi tisdk weston-launch xenomai]
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.315958] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
[ 1.339726] gpio-of-helper ocp:cape-universal: ready
END

Well yeah... 9_28 is already CS..

https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-SPIDEV1-00A0.dts

Regards.

Thank you Robert, I did not initially realize that the pinmux for those pins are disabled from within the dts file.

I have been attempting to swap the MISO and MOSI pins on the beaglebone, unsuccessfully. I have tried by modifying the BB-SPIDEV1-00A0.dts file, and recompiling to a .dtbo. I then put this dtbo file in /lib/firmware, and ensured that I have referenced it in the /boot/uEnv.txt file at uboot_overlay_addr4, as well as disabled the HDMI.

No matter what I’ve done, P9_29 acts as MISO, and P9_30 acts as MOSI. I need them to be swapped.

Here is my dts file:

/dts-v1/;
/plugin/;

#include <dt-bindings/board/am335x-bbw-bbb-base.h>
#include <dt-bindings/pinctrl/am33xx.h>

/ {
compatible = “ti,beaglebone”, “ti,beaglebone-black”, “ti,beaglebone-green”;

/* identification */
part-number = “BB-SPIDEV1”;
version = “00A0”;

/* state the resources this cape uses /
exclusive-use =
/
the pin header uses /
“P9.31”, /
spi1_sclk /
“P9.29”, /
spi1_d0 /
“P9.30”, /
spi1_d1 /
“P9.28”, /
spi1_cs0 /
// “P9.42”, /
spi1_cs1 /
/
the hardware ip uses */
“spi1”;

/*

  • Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
    */
    fragment@0 {
    target-path=“/”;
    overlay {

chosen {
overlays {
BB-SPIDEV1-00A0 = TIMESTAMP;
};
};
};
};

/*

  • Free up the pins used by the cape from the pinmux helpers.
    /
    fragment@1 {
    target = <&ocp>;
    overlay {
    P9_28_pinmux { status = “disabled”; }; /
    spi1_cs0 /
    P9_30_pinmux { status = “disabled”; }; /
    spi1_d0 /
    P9_29_pinmux { status = “disabled”; }; /
    spi1_d1 /
    P9_31_pinmux { status = “disabled”; }; /
    spi1_sclk */
    };
    };

fragment@2 {
target = <&am33xx_pinmux>;
overlay {
/* default state has all gpios released and mode set to uart1 /
bb_spi1_pins: pinmux_bb_spi1_pins {
pinctrl-single,pins = <
0x190 0x33 /
mcasp0_aclkx.spi1_sclk, INPUT_PULLUP | MODE3 /
0x194 0x33 /
mcasp0_fsx.spi1_d0, OUTPUT_PULLUP | MODE3 /
0x198 0x13 /
mcasp0_axr0.spi1_d1, INPUT_PULLUP | MODE3 /
0x19c 0x13 /
mcasp0_ahclkr.spi1_cs0, OUTPUT_PULLUP | MODE3 /
// 0x164 0x12 /
eCAP0_in_PWM0_out.spi1_cs1 OUTPUT_PULLUP | MODE2 */

;
};
};
};

fragment@3 {
target = <&spi1>;
overlay {
#address-cells = <1>;
#size-cells = <0>;

status = “okay”;
pinctrl-names = “default”;
pinctrl-0 = <&bb_spi1_pins>;
ti,pio-mode; /* disable dma when used as an overlay, dma gets stuck at 160 bits… */
ti,pindir-do-out-d1-in = <1>;

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

compatible = “spidev”;
symlink = “spi/1.0”;

reg = <0>;
spi-max-frequency = <16000000>;
spi-cpha;
};

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

compatible = “spidev”;
symlink = “spi/1.1”;

reg = <1>;
spi-max-frequency = <16000000>;
};
};
};
};

And my version info:

debian@beaglebone:/opt/scripts/tools$ ./version.sh
must be run as root
debian@beaglebone:/opt/scripts/tools$ sudo ./version.sh
git:/opt/scripts/:[1aa73453b2c980b75e31e83dab7dd8b6696f10c7]
eeprom:[A335BNLTEIA04218BBBK0D06]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Image 2018-10-07]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2018.09-00002-g0b54a51eee]:[location: dd MBR]
kernel:[4.19.59-ti-rt-r25]
nodejs:[v6.14.4]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_addr4=/lib/firmware/BB-SPIDEV1-00A0.dtbo]
uboot_overlay_options:[disable_uboot_overlay_video=1]
uboot_overlay_options:[disable_uboot_overlay_audio=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade ]
pkg:[bb-cape-overlays]:[4.4.20190812.0-0rcnee0~stretch+20190812]
pkg:[bb-wl18xx-firmware]:[1.20180517-0rcnee0~stretch+20180517]
pkg:[kmod]:[23-2rcnee1~stretch+20171005]
pkg:[librobotcontrol]:[1.0.3-git20181005.0-0rcnee0~stretch+20181005]
pkg:[firmware-ti-connectivity]:[20170823-1rcnee1~stretch+20180328]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal i2c bluetooth netdev cloud9ide gpio pwm eqep admin spi tisdk weston-launch xenomai]
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.403716] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
[ 1.427457] gpio-of-helper ocp:cape-universal: ready
END

And show-pins:

Robert,

Please disregard. I realized my mistake – I was not changing the value, only the commented line… I have since got it to do what it’s told!

debian@beaglebone:~$ sudo show-pins | grep spi
P9.31 / hdmi audio clk 100 fast rx up 3 spi 1 clk spi@481a0000 (pinmux_bb_spi1_pins)
P9.29 / hdmi audio fs 101 fast up 3 spi 1 d0 miso spi@481a0000 (pinmux_bb_spi1_pins)
P9.30 102 fast rx up 3 spi 1 d1 mosi spi@481a0000 (pinmux_bb_spi1_pins)
P9.28 / hdmi audio data 103 fast up 3 spi 1 cs 0 spi@481a0000 (pinmux_bb_spi1_pins)

My issue now is that I believe the spidev library is still trying to access P9_30 as MOSI and P9_29 as MISO. This is my guess anyways.