config-pins spi?

Hi,

I am trying to activate a couple SPI lines using the config-pin tool. I have my HDMI disabled, and if I run “config-pin -q” on any of these pins I get back “default”. However when I run the following commands, I just get “ERROR: write() to /sys/devices/platform/ocp/ocp:P9_13_pinmux/state failed, no such device”

config-pin P9.13 spi_sclk
config-pin P9.14 spi_cs
config-pin P9.15 spi
config-pin P9.16 spi
config-pin P8.33 spi_sclk
config-pin P8.34 spi_cs
config-pin P8.35 spi
config-pin P8.36 spi

Is this no longer the way to set this up? Thanks for your help.

  • Joey

It’s best to use an spi overlay. If you run and report the output of:

sudo beagle-version

We can fine tune why that didn’t work.

Regards,

Sure thing, here you go. Is there a good spi template around I could use?

eeprom:[A335BNLTEIA02104SBB23069]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Bullseye IoT Image 2023-09-02]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot SPL 2022.04-ge0d31da5 (Aug 04 2023 - 18:48:26 +0000)]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-boneblack-uboot-univ.dts]
UBOOT: Loaded Overlay:[AM335X-PRU-UIO-00A0.kernel]
UBOOT: Loaded Overlay:[BB-ADC-00A0.kernel]
UBOOT: Loaded Overlay:[BB-BONE-eMMC1-01-00A0.kernel]
UBOOT: Loaded Overlay:[BB-UART1-00A0.kernel]
UBOOT: Loaded Overlay:[BB-UART2-00A0.kernel]
UBOOT: Loaded Overlay:[BB-UART5-00A0]
kernel:[5.10.168-ti-r77]
nodejs:[v12.22.12]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_addr0=BB-UART1-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_addr1=BB-UART2-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_addr2=BB-UART5-00A0.dtbo]
uboot_overlay_options:[disable_uboot_overlay_video=1]
uboot_overlay_options:[disable_uboot_overlay_audio=1]
uboot_overlay_options:[disable_uboot_overlay_wireless=1]
uboot_overlay_options:[enable_uboot_cape_universal=1]
uboot_overlay_options:[uboot_overlay_pru=AM335X-PRU-UIO-00A0.dtbo]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.14.20210821.0-0~bullseye+20210821]
pkg:[bb-customizations]:[1.20240119.0-0~bullseye+20240119]
pkg:[bb-usb-gadgets]:[1.20240403.0-0~bullseye+20240403]
pkg:[bb-wl18xx-firmware]:[1.20230414.0-0~bullseye+20230414]
pkg:[kmod]:[28-1]
WARNING:pkg:[librobotcontrol]:[NOT_INSTALLED]
pkg:[firmware-ti-connectivity]:[20210315-3]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal input render bluetooth netdev i2c gpio admin tisdk weston-launch cloud9ide]
cmdline:[console=ttyS0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet]
dmesg | grep remote
[   12.691314] remoteproc remoteproc0: wkup_m3 is available
[   46.880213] remoteproc remoteproc0: powering up wkup_m3
[   46.880256] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217148
[   46.880574] remoteproc remoteproc0: remote processor wkup_m3 is now up
dmesg | grep pru
[ 4805.073090] bone-pinmux-helper ocp:P9_42_pinmux: Failed to find state pruin
[ 5338.273021] bone-pinmux-helper ocp:P9_42_pinmux: Failed to find state pruin
[ 5393.287078] bone-pinmux-helper ocp:P9_42_pinmux: Failed to find state pruin
[ 5404.742897] bone-pinmux-helper ocp:P9_42_pinmux: Failed to find state pruin
[ 7363.911081] bone-pinmux-helper ocp:P9_42_pinmux: Failed to find state pruin
[ 7376.390887] bone-pinmux-helper ocp:P9_42_pinmux: Failed to find state pruin
[ 7378.889641] bone-pinmux-helper ocp:P9_42_pinmux: Failed to find state pru
dmesg | grep pinctrl-single
[   12.089412] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
[   12.091210] gpio-of-helper ocp:cape-universal: Failed to get gpio property of 'P8_03'
[   12.091240] gpio-of-helper ocp:cape-universal: Failed to create gpio entry
[   13.014646] gpio-of-helper ocp:cape-universal: Allocated GPIO id=0 name='P8_03'
[   13.014926] gpio-of-helper ocp:cape-universal: Allocated GPIO id=1 name='P8_04'
[   13.015133] gpio-of-helper ocp:cape-universal: Allocated GPIO id=2 name='P8_05'
[   13.015366] gpio-of-helper ocp:cape-universal: Allocated GPIO id=3 name='P8_06'
[   13.016028] gpio-of-helper ocp:cape-universal: Allocated GPIO id=4 name='P8_07'
[   13.016260] gpio-of-helper ocp:cape-universal: Allocated GPIO id=5 name='P8_08'
[   13.016481] gpio-of-helper ocp:cape-universal: Allocated GPIO id=6 name='P8_09'
[   13.016675] gpio-of-helper ocp:cape-universal: Allocated GPIO id=7 name='P8_10'
[   13.016893] gpio-of-helper ocp:cape-universal: Allocated GPIO id=8 name='P8_11'
[   13.017106] gpio-of-helper ocp:cape-universal: Allocated GPIO id=9 name='P8_12'
[   13.017397] gpio-of-helper ocp:cape-universal: Allocated GPIO id=10 name='P8_13'
[   13.017617] gpio-of-helper ocp:cape-universal: Allocated GPIO id=11 name='P8_14'
[   13.017847] gpio-of-helper ocp:cape-universal: Allocated GPIO id=12 name='P8_15'
[   13.018068] gpio-of-helper ocp:cape-universal: Allocated GPIO id=13 name='P8_16'
[   13.018271] gpio-of-helper ocp:cape-universal: Allocated GPIO id=14 name='P8_17'
[   13.018467] gpio-of-helper ocp:cape-universal: Allocated GPIO id=15 name='P8_18'
[   13.018672] gpio-of-helper ocp:cape-universal: Allocated GPIO id=16 name='P8_19'
[   13.018882] gpio-of-helper ocp:cape-universal: Allocated GPIO id=17 name='P8_20'
[   13.019072] gpio-of-helper ocp:cape-universal: Allocated GPIO id=18 name='P8_21'
[   13.019290] gpio-of-helper ocp:cape-universal: Allocated GPIO id=19 name='P8_22'
[   13.019483] gpio-of-helper ocp:cape-universal: Allocated GPIO id=20 name='P8_23'
[   13.019687] gpio-of-helper ocp:cape-universal: Allocated GPIO id=21 name='P8_24'
[   13.020016] gpio-of-helper ocp:cape-universal: Allocated GPIO id=22 name='P8_25'
[   13.020217] gpio-of-helper ocp:cape-universal: Allocated GPIO id=23 name='P8_26'
[   13.020434] gpio-of-helper ocp:cape-universal: Allocated GPIO id=24 name='P8_27'
[   13.020635] gpio-of-helper ocp:cape-universal: Allocated GPIO id=25 name='P8_28'
[   13.020840] gpio-of-helper ocp:cape-universal: Allocated GPIO id=26 name='P8_29'
[   13.021042] gpio-of-helper ocp:cape-universal: Allocated GPIO id=27 name='P8_30'
[   13.021239] gpio-of-helper ocp:cape-universal: Allocated GPIO id=28 name='P8_31'
[   13.021459] gpio-of-helper ocp:cape-universal: Allocated GPIO id=29 name='P8_32'
[   13.021653] gpio-of-helper ocp:cape-universal: Allocated GPIO id=30 name='P8_33'
[   13.021877] gpio-of-helper ocp:cape-universal: Allocated GPIO id=31 name='P8_34'
[   13.022084] gpio-of-helper ocp:cape-universal: Allocated GPIO id=32 name='P8_35'
[   13.022290] gpio-of-helper ocp:cape-universal: Allocated GPIO id=33 name='P8_36'
[   13.022495] gpio-of-helper ocp:cape-universal: Allocated GPIO id=34 name='P8_37'
[   13.022706] gpio-of-helper ocp:cape-universal: Allocated GPIO id=35 name='P8_38'
[   13.022910] gpio-of-helper ocp:cape-universal: Allocated GPIO id=36 name='P8_39'
[   13.023107] gpio-of-helper ocp:cape-universal: Allocated GPIO id=37 name='P8_40'
[   13.023298] gpio-of-helper ocp:cape-universal: Allocated GPIO id=38 name='P8_41'
[   13.023504] gpio-of-helper ocp:cape-universal: Allocated GPIO id=39 name='P8_42'
[   13.023804] gpio-of-helper ocp:cape-universal: Allocated GPIO id=40 name='P8_43'
[   13.024026] gpio-of-helper ocp:cape-universal: Allocated GPIO id=41 name='P8_44'
[   13.024250] gpio-of-helper ocp:cape-universal: Allocated GPIO id=42 name='P8_45'
[   13.024445] gpio-of-helper ocp:cape-universal: Allocated GPIO id=43 name='P8_46'
[   13.024659] gpio-of-helper ocp:cape-universal: Allocated GPIO id=44 name='P9_11'
[   13.024882] gpio-of-helper ocp:cape-universal: Allocated GPIO id=45 name='P9_12'
[   13.025084] gpio-of-helper ocp:cape-universal: Allocated GPIO id=46 name='P9_13'
[   13.025293] gpio-of-helper ocp:cape-universal: Allocated GPIO id=47 name='P9_14'
[   13.025486] gpio-of-helper ocp:cape-universal: Allocated GPIO id=48 name='P9_15'
[   13.025728] gpio-of-helper ocp:cape-universal: Allocated GPIO id=49 name='P9_16'
[   13.025932] gpio-of-helper ocp:cape-universal: Allocated GPIO id=50 name='P9_17'
[   13.026144] gpio-of-helper ocp:cape-universal: Allocated GPIO id=51 name='P9_18'
[   13.026352] gpio-of-helper ocp:cape-universal: Allocated GPIO id=52 name='P9_19'
[   13.026543] gpio-of-helper ocp:cape-universal: Allocated GPIO id=53 name='P9_20'
[   13.026745] gpio-of-helper ocp:cape-universal: Allocated GPIO id=54 name='P9_21'
[   13.026947] gpio-of-helper ocp:cape-universal: Allocated GPIO id=55 name='P9_22'
[   13.027155] gpio-of-helper ocp:cape-universal: Allocated GPIO id=56 name='P9_23'
[   13.027371] gpio-of-helper ocp:cape-universal: Allocated GPIO id=57 name='P9_24'
[   13.028004] gpio-of-helper ocp:cape-universal: Allocated GPIO id=58 name='P9_25'
[   13.028254] gpio-of-helper ocp:cape-universal: Allocated GPIO id=59 name='P9_26'
[   13.028475] gpio-of-helper ocp:cape-universal: Allocated GPIO id=60 name='P9_27'
[   13.028674] gpio-of-helper ocp:cape-universal: Allocated GPIO id=61 name='P9_28'
[   13.028880] gpio-of-helper ocp:cape-universal: Allocated GPIO id=62 name='P9_29'
[   13.029080] gpio-of-helper ocp:cape-universal: Allocated GPIO id=63 name='P9_30'
[   13.029275] gpio-of-helper ocp:cape-universal: Allocated GPIO id=64 name='P9_31'
[   13.029492] gpio-of-helper ocp:cape-universal: Allocated GPIO id=65 name='P9_41'
[   13.029686] gpio-of-helper ocp:cape-universal: Allocated GPIO id=66 name='P9_91'
[   13.029919] gpio-of-helper ocp:cape-universal: Allocated GPIO id=67 name='P9_42'
[   13.030123] gpio-of-helper ocp:cape-universal: Allocated GPIO id=68 name='P9_92'
[   13.030136] gpio-of-helper ocp:cape-universal: ready
lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END

BB-SPIDEV0: src/arm/overlays/BB-SPIDEV0-00A0.dts · v5.10.x-ti-unified · BeagleBoard.org / BeagleBoard-DeviceTrees · GitLab

and

BB-SPIDEV1: src/arm/overlays/BB-SPIDEV1-00A0.dts · v5.10.x-ti-unified · BeagleBoard.org / BeagleBoard-DeviceTrees · GitLab

uboot_overlay_addr3=BB-SPIDEV0-00A0.dtbo
uboot_overlay_addr4=BB-SPIDEV1-00A0.dtbo

Regards,

Would it be possible for me to just modify the numbers in those overlays to the desired pins (P9.13-16 and P8.33-36) and recompile to the .dtbos? I’m updating a legacy system and avoiding a hardware change.

Most of those are not offical modes for the pin: boneDeviceTree/docs at master · derekmolloy/boneDeviceTree · GitHub

I hope you counted wrong, otherwise your going to be using the emulated spi-gpio driver…

Regards,

1 Like

Nope, this is just what previous devs had done. It seems that a working spi link for similar purposes just used

config-pin P9.13 gpio_pd
config-pin P9.14 gpio_pu
config-pin P9.15 gpio_input
config-pin P9.16 gpio_pd

In place of what I tried:

config-pin P9.13 spi_sclk
config-pin P9.14 spi_cs
config-pin P9.15 spi
config-pin P9.16 spi

This has been reliably working for an older kernel version (~2020) so I suppose I’ll try that first…

What do you mean by an emulated spi-gpio driver?

Well those gpio_xyz are valid options for P9.13 → P9.16, and why your spi_xyz options failed…

Emulated/BitBang/etc… Manually toggling gpio pins to emulate spi bus, that’s exactly what the spi-gpio driver does… spi-gpio.c « spi « drivers - kernel/git/torvalds/linux.git - Linux kernel source tree

DeviceTree docs: spi-gpio.yaml « spi « bindings « devicetree « Documentation - kernel/git/torvalds/linux.git - Linux kernel source tree

Regards,

1 Like

Aha – yes my setup is BitBanged SPI. I think it just does this on the PRU.

Thanks a ton! This helped.

Oh Cool! yeah if done right the pru is another option. Too much thinking about only the cortex-A8 side…