Is cape manager obsolete? What about device tree overlays?

I’m trying to understand the current state of device tree overlays. Is it correct that the cape manager is now obsolete, and device tree overlays should be set up through /boot/uEnv.txt? What about config-pin? Is that an alternative to device tree overlays, or something orthogonal?

The system I’m using is a PocketBeagle with 4.4.91-ti-r133. Before that I was using the 3.8 kernel on a BeagleBone and everything seems to have changed. (Is there a summary somewhere of the new world?)

Ken

Kernel Overlays is obsolete.

We now use U-Boot Overlays:

https://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays

config-pin is enabled by default, it allows you to easily change pin's
to different functions.

Regards,

I’ve just downloaded the latest test iot image (BeagleBoard.org Debian Image 2017-11-26) and tried config-pin on the BeagleBone Black

bone$ config-pin -l P9_31 spi_sclk
default gpio gpio_pu gpio_pd spi_sclk pwm pruout pruin

So far so good, but I want to use SPI, so

bone$ sudo config-pin P9_31 spi_sclk
P9_31 pinmux file not found!
bash: /sys/devices/platform/ocp/ocpP9_31_pinmux/state: No such file or directory
Cannot write pinmux file: /sys/devices/platform/ocp/ocp
P9_31_pinmux/state

Oops, what am I missing?

–Mark

uname -r

looks like P9_31 isn't synced with the kernel.

Regards

Is there any better documentation than this somewhere? I have a custom audio (and other stuff) cape I was working on a couple years ago and had to put aside. I would like to get back to that soon, and I see now that there's a new way to configure it. Is there anything that talks about how to configure Debian to set up my cape in the new paradigm?

Thanks.

Hi Rick,

Is there any better documentation than this somewhere? I have a custom audio (and other stuff) cape I was working on a couple years ago and had to put aside. I would like to get back to that soon, and I see now that there's a new way to configure it. Is there anything that talks about how to configure Debian to set up my cape in the new paradigm?

The "overlay" is the same, the only difference U-Boot loads it..

Since everything relies on U-Boot, make sure to run the version.sh script:

sudo /opt/scripts/tools/version.sh

Then we debug what's going on.. (unless you have usb serial cable to
log u-boot)

Regards,

bone $ uname -r
4.9.63-ti-r79

Looks like many aren’t synced. How do I sync them?

bone $ sudo config-pin P9_30 spi
P9_30 pinmux file not found!
bash: /sys/devices/platform/ocp/ocpP9_30_pinmux/state: No such file or directory
Cannot write pinmux file: /sys/devices/platform/ocp/ocp
P9_30_pinmux/state
bone$ sudo config-pin P9_29 spi
P9_29 pinmux file not found!
bash: /sys/devices/platform/ocp/ocpP9_29_pinmux/state: No such file or directory
Cannot write pinmux file: /sys/devices/platform/ocp/ocp
P9_29_pinmux/state
bone$ sudo config-pin P9_28 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

Ah!, P9_31 that was a bug i introduced then fixed..

Double check your version of: bb-cape-overlays

debian@test-bbb-6:~$ dpkg --list | grep cape
ii bb-cape-overlays
4.4.20171126.0-0rcnee1~stretch+20171126 armhf Device tree
overlays for Beaglebone.

I broke it on: 10/25/2017 3:16:11 PM

https://github.com/beagleboard/bb.org-overlays/commit/670ecdc1b86f5eac2e5291733e3b998c12877853

and fixed it on: 10/25/2017 3:26:20 PM

https://github.com/beagleboard/bb.org-overlays/commit/4701807776ede6504023eed06ca82e7f7923b1dd

debian@test-bbb-6:~$ cat /proc/device-tree/model
TI AM335x BeagleBone Black

debian@test-bbb-6:~$ config-pin -l P9_30
default gpio gpio_pu gpio_pd spi pwm pruout pruin

debian@test-bbb-6:~$ config-pin P9_30 spi

debian@test-bbb-6:~$ uname -r
4.9.65-bone8

Regards,

bone$ dpkg --list | grep cape
ii bb-cape-overlays 4.4.20171120.0-0rcnee1~stretch+20171120 armhf Device tree overlays for Beaglebone.
ii roboticscape 0.3.4-git20170602-0rcnee4~stretch+20171108 armhf Robotics Cape Library and Examples

Mine looks recent. Any suggestions on a fix?

–Mark

This might help…

bone$ sudo /opt/scripts/tools/version.sh
git:/opt/scripts/:[e5c23dc2a45f5c9ace291dd32e7c3d79edc1932d]
eeprom:[A335BNLT000C3114BBBK1969]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Image 2017-11-26]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2017.11-00002-g7b415acfc1]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2015.01-00001-gb2412df]
kernel:[4.9.63-ti-r79]
nodejs:[v6.12.0]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[disable_uboot_overlay_video=1]
uboot_overlay_options:[disable_uboot_overlay_wireless=1]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg:[bb-cape-overlays]:[4.4.20171120.0-0rcnee1~stretch+20171120]
pkg:[bb-wl18xx-firmware]:[1.20170829-0rcnee1~stretch+20170829]
pkg:[firmware-ti-connectivity]:[20170823-1rcnee0~stretch+20170830]

There's the issue, old u-boot in eMMC, so all teh U-Boot stuff is
ignored.. and thus nothing is in sync.. :wink:

sudo dd if=/dev/zero of=/dev/mmcblk1 count=1 seek=1 bs=128k

Regards,

So I'm seeing this as the biggest problem most people are having. It's
bitten me more than once too. Just got to remember people. Get into the
habit of pressing the boot button when flashing newer images.

That fixed it. Thanks…

Now I see all sorts of gpios are already exported.

export gpio114 gpio13 gpio22 gpio30 gpio46 gpio50 gpio66 gpiochip0
gpio110 gpio115 gpio14 gpio23 gpio31 gpio47 gpio51 gpio67 gpiochip32
gpio111 gpio116 gpio15 gpio26 gpio4 gpio48 gpio60 gpio68 gpiochip64
gpio112 gpio117 gpio2 gpio27 gpio44 gpio49 gpio61 gpio69 gpiochip96
gpio113 gpio12 gpio20 gpio3 gpio45 gpio5 gpio65 gpio7 unexport

I want to unexport a couple (14, 113 and 115) so the fbtft_device kernel driver and access them. But I get and error
echo: write error: Invalid argument

How do I unexport them?

–Mark

as root:

echo xxx > /sys/class/gpio/unexport

Where xxx == the gpioxxx value you wish to reclaim.

So in the example case of gpio112 . . .

echo 112 > /sys/class/gpio/unexport

Unfortunately, that’s the command that gives me the error message. Someone else has control of those gpio’s and I can unexport them, even as root.

–Mark

cape-universal exported them..

Something like this should work:

https://gist.github.com/jadonk/0e4a190fc01dc5723d1f183737af1d83#file-blue_adafruit24_setup-sh

Regards,

In fact, that is the LCD display I have working on the Blue and am trying to move to the Black.

I need to find 3 gpio pins that cape-universal hasn’t taken. Any suggestions?

–Mark

I see that if I edit /boot/uEnv.txt and comment out:
#enable_uboot_cape_universal=1
I can then access all sorts of gpio pins. But now I can’t run config-pin on them since there is no pinmux entry in /sys/devices/platform/ocp.

Is there a way to free up a few gpio pins to drive the LCD and keep the rest pinmux-able?

–Mark

I'm not sure why it's broken now, but you should be able to un-export
all those pins to drive the LCD, Jason's done it before..

Regards,

I can’t unexport them.

root@bone-5eca:/sys/class/gpio# echo 116 > unexport
bash: echo: write error: Invalid argument

–Mark A. Yoder, PhD
Electrical and Computer Engineering
Rose-Hulman Institute of Technology
812-233-3219

Thanks for the explanation, but could you elaborate a bit more on it?

As far as I understand the world as it is now works this way:

0- If you are running anything beyond kernel 4.1 you should be using uboot overlays. Be careful to load the latest bb-cape overlays and be sure that uboot is the latest version, check via /opt/script/tools/version.sh,
look for
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2015.01-00001-gb2412df]
this is wrong: ^^^^^^^^^^^^^^^^^^^^^^^^^^
Should be something like:
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2017.09-00002-g0f3f1c7907]

If not, do
/opt/scripts/tools/developers/update_bootloader.sh
This should put an updated bootloader in the boot block of your Beaglebone. Careful: you should have booted from the internal flash, not from an external flash-card.

1-Overlays are now loaded in /boot/uEnv.txt at boot time.
Cape-universal or the other universal capes make it possible to use config-pin to configure the pins that you want to use,
example:
config-pin -l p9-21
gives all the possible settings
config-pin -q p9-21
gives the current setting
config-pin -a p9-21 i2c
makes the pin respond to i2c signals.

2-if another overlay is loaded in /bootuEnv.txt which is not of the universal type, config-pin does not work anymore???

3-To find out which overlay is loaded if config-pin does not run, use command ??? to find out which overlay(s) is/are currently running

4-If you want to make a combination of some of the universal settings plus an overlay, ???

</SPECULATIVE STEPS: DO NOT USE IN THE REAL WORLD>

I am pretty sure it’s all wrong, but I am struggling with the info too. I am trying to modernize gobot to the latest uboot overlay stufff (it is still looking for cape_mgr slots file), but it is not exactly clear how I can find out if an overlay is set, or if I am able to set a specific pin after some overlay has been loaded.