Is cape manager obsolete? What about device tree overlays?

3,854 views
Skip to first unread message

Ken Shirriff

unread,
Nov 28, 2017, 1:45:55 AM11/28/17
to BeagleBoard
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

Robert Nelson

unread,
Nov 28, 2017, 12:33:35 PM11/28/17
to Beagle Board, Ken Shirriff
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,

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

Mark A. Yoder

unread,
Nov 28, 2017, 7:38:25 PM11/28/17
to BeagleBoard
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/ocp*P9_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

Robert Nelson

unread,
Nov 28, 2017, 7:46:41 PM11/28/17
to Beagle Board
On Tue, Nov 28, 2017 at 6:38 PM, Mark A. Yoder <mark.a...@gmail.com> wrote:
> 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/ocp*P9_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?

uname -r

looks like P9_31 isn't synced with the kernel.

Regards

Rick Mann

unread,
Nov 28, 2017, 7:47:24 PM11/28/17
to beagl...@googlegroups.com

On Tuesday, November 28, 2017 at 12:33:35 PM UTC-5, RobertCNelson wrote:
> On Tue, Nov 28, 2017 at 12:45 AM, Ken Shirriff <ken.sh...@gmail.com> wrote:
> > 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?)
>
> 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,
>
> --
> Robert Nelson
> https://rcn-ee.com/

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.


--
Rick Mann
rm...@latencyzero.com


Robert Nelson

unread,
Nov 28, 2017, 7:50:49 PM11/28/17
to Beagle Board, Rick Mann
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)

Mark A. Yoder

unread,
Nov 28, 2017, 8:47:28 PM11/28/17
to BeagleBoard
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/ocp*P9_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/ocp*P9_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/ocp*P9_28_pinmux/state: No such file or directory
Cannot write pinmux file: /sys/devices/platform/ocp/ocp*P9_28_pinmux/state

Robert Nelson

unread,
Nov 28, 2017, 8:58:03 PM11/28/17
to Beagle Board, Mark Yoder
On Tue, Nov 28, 2017 at 7:47 PM, Mark A. Yoder <mark.a...@gmail.com> wrote:
> 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/ocp*P9_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/ocp*P9_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/ocp*P9_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,

Mark A. Yoder

unread,
Nov 28, 2017, 9:02:38 PM11/28/17
to BeagleBoard
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]

Robert Nelson

unread,
Nov 28, 2017, 9:06:56 PM11/28/17
to Beagle Board, Mark Yoder
On Tue, Nov 28, 2017 at 8:02 PM, Mark A. Yoder <mark.a...@gmail.com> wrote:
> 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]

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

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

William Hermans

unread,
Nov 29, 2017, 6:59:03 AM11/29/17
to beagl...@googlegroups.com
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.

Mark A. Yoder

unread,
Nov 29, 2017, 9:27:38 AM11/29/17
to BeagleBoard
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

William Hermans

unread,
Nov 29, 2017, 9:34:35 AM11/29/17
to beagl...@googlegroups.com
On Wed, Nov 29, 2017 at 7:27 AM, Mark A. Yoder <mark.a...@gmail.com> wrote:
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?

 
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

Mark A. Yoder

unread,
Nov 29, 2017, 10:01:37 AM11/29/17
to BeagleBoard
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

Robert Nelson

unread,
Nov 29, 2017, 10:05:35 AM11/29/17
to Beagle Board, Mark Yoder
On Wed, Nov 29, 2017 at 9:01 AM, Mark A. Yoder <mark.a...@gmail.com> wrote:
> 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

Mark A. Yoder

unread,
Nov 29, 2017, 10:10:36 AM11/29/17
to BeagleBoard
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

Mark A. Yoder

unread,
Nov 29, 2017, 9:08:00 PM11/29/17
to BeagleBoard
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

Robert Nelson

unread,
Nov 29, 2017, 9:23:04 PM11/29/17
to Beagle Board, Mark Yoder
On Wed, Nov 29, 2017 at 8:08 PM, Mark A. Yoder <mark.a...@gmail.com> wrote:
> 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?

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..

Yoder, Mark A

unread,
Nov 29, 2017, 9:24:39 PM11/29/17
to Robert Nelson, Beagle Board, Mark Yoder

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

From: Robert Nelson <robert...@gmail.com>
Sent: Wednesday, November 29, 2017 9:22:10 PM
To: Beagle Board; Mark Yoder
Subject: Re: [beagleboard] Is cape manager obsolete? What about device tree overlays?
 

Johan Henselmans

unread,
Dec 1, 2017, 12:40:27 AM12/1/17
to BeagleBoard
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.

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

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.

Robert Nelson

unread,
Dec 1, 2017, 11:57:09 AM12/1/17
to Beagle Board, johan.he...@gmail.com
Correct, someone needs to write a pin manager for U-Boot.. Currently
what we do, if a custom cape is defined, cape_universal is disabled..

However you can toggle oneboard devices:

https://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Disable_on-board_devices

and the cape-universal knows what to do..

> 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

sudo /opt/scripts/tools/version.sh

&

USB Serial Debug cable, to track what U-Boot did..

&

cat /proc/cmdline | sed 's/ /\n/g' | grep uboot_detected_capes= || true

(very new: uboot_detected_capes )

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

Source is here:

https://github.com/beagleboard/bb.org-overlays

here is cape universal with

https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/univ-bbb-EVA-00A0.dts


>
> </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.


Mark A. Yoder

unread,
Dec 5, 2017, 7:14:19 PM12/5/17
to BeagleBoard
Well, I though I had a solution.  I switched from the 4.9 kernel to 4.4
bone$ uname -a
Linux bone-5eca 4.4.91-ti-r137 #1 SMP Tue Nov 7 01:13:03 UTC 2017 armv7l GNU/Linux
and I still can't unexport the pins I want for the LCD.
bone$ sudo bash
bone# echo 116 > unexport 
bash: echo: write error: Invalid argument

I'm not sure what to try next.

--Mark

Mark A. Yoder

unread,
Dec 6, 2017, 5:20:30 PM12/6/17
to BeagleBoard
I got the LCD working! But it with using Adafruit's user space LCD interface[1].
I still need a framebuffer solution.

--Mark

fred.p....@gmail.com

unread,
Oct 9, 2018, 10:29:47 AM10/9/18
to BeagleBoard
Hi

I am having the same problem and can't solve it. Here is the output of "sudo /opt/scripts/tools/version.sh "

git:/opt/scripts/:[0aa8fd09a1821f6f9197aada6ec69e9746e91f67]
eeprom:[A335BNLT00C05016BBBK1BDB]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[rcn-ee.net console Ubuntu Image 2018-09-11]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2018.09-00002-g0b54a51eee]:[location: dd MBR]
kernel:[4.14.67-ti-r74]
uboot_overlay_options:[enable_uboot_overlays=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.20180803.0-0rcnee0~bionic+20180804]
pkg:[bb-wl18xx-firmware]:[1.20180517-0rcnee0~bionic+20180517]
pkg:[kmod]:[24-1ubuntu3rcnee0~bionic+20180515]
WARNING:pkg:[librobotcontrol]:[NOT_INSTALLED]
groups:[ubuntu : ubuntu adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal bluetooth netdev i2c 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 cape_universal=enable]
dmesg | grep pinctrl-single
[    1.247646] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
dmesg | grep gpio-of-helper
[    1.259666] gpio-of-helper ocp:cape-universal: ready
END


I followed the same tips mentioned here but didn't work.
Message has been deleted

Robert Nelson

unread,
Oct 9, 2018, 10:32:58 AM10/9/18
to Beagle Board, fred.p....@gmail.com
What's your problem and what are your trying to do?

Robert Nelson

unread,
Oct 9, 2018, 11:06:24 AM10/9/18
to Beagle Board, fred.p....@gmail.com
On Tue, Oct 9, 2018 at 9:59 AM Fred Gomes <fred.p....@gmail.com> wrote:
>
> The problem is that I need to configure the pins P28 - P31 (Because I am using the SPI1) and when I ran "config-pin P9.31 spi_sclk" I got the following error: "Cannot write pinmux file: /sys/devices/platform/ocp/ocp*P9_31_pinmux/state". The same happens for pin P9.28 and P9.29. They seem to not exist in the pinMux list.

P9.28, P9.29, and P9.30 are tied to HDMI audio..

Add this option to /boot/uEnv.txt

disable_uboot_overlay_audio=1
Reply all
Reply to author
Forward
0 new messages