How to use current universal cape device tree and ADC at the same time

Hi,
In continue to my IRC chat with rcn-ee, I need more help to figure this out.
I am using a beaglebone green and the lxqt image and kernel 4.1.13-ti-r35 .
I want to use the on-board button connected to P8_43, so I need to setup pull up for this gpio.
I also want to use the analog to digital converter (ADC) to sample an input.

The universal cape used to load on boot, and I used to use config-pin P8_43 in+ to setup.
rcn-ee askd me to git pull in /opt/scripts, which I did, and I also ran apt-get upgrade on the full OS.
Now after boot when I try to run config-pin P8_43 in+ I get this error:
cape-universala overlay not found

run “config-pin overlay cape-universala” to load the cape

Yet /lib/firmware/ has no file named cape-universala-00A0.dtbo.

  1. So my first question is how to allow the use of config-pin after this upgrade.
  2. How to load the ADC device tree and module? seems config-pin overlay BB-ADC is ok, but should I load it after the universal cpae?

Thanks,
Niv

Hi Niv-

I’ve been looking at the kernel 4 implementation of device trees today.
Here are a couple of things which may help.

cd to this directory:

/sys/devices/platform/ocp/ocp:cape-universal

ls and you should see a file called status.
cat status

This should give you a listing of the currently enabled GPIOs.
“ocp” means “on chip peripheral”. A GPIO is one of several types of ocp.

Here is the first few lines of what I see on my BBB:

0 P9_92 114 IN 0
1 P9_42 7 IN 0
2 P9_91 116 IN 0
3 P9_30 112 IN 0
4 P9_27 115 IN 0
5 P9_26 14 IN 0
6 P9_24 15 IN 0
7 P9_23 49 IN 0
8 P9_22 2 IN 0
9 P9_21 3 IN 0

This continues on and shows GPIOs enabled on the P8 header as well.
So just taking an example P9_27:

config-pin -q P9_27
P9_27 Mode: default Direction: in Value: 0

The command runs successfully.
Now, try the command on a pin which is not listed in the status file:
config-pin -q P9_28

P9_28 pinmux file not found!
cape-universala overlay not found
run “config-pin overlay cape-universala” to load the cape

So I reproduce the a similar result as what you see for P8_43.
There is no overlay cape-universala being compiled by Robert’s script.
The command config-pin was written by another person and is described here:
https://github.com/cdsteinkuehler/beaglebone-universal-io

I suspect the error message being emitted by config-pin needs to be updated.
Otherwise, the first part of the error message is correct in that the GPIO is not active on the pin.

The pin you need as a GPIO P8_43 needs to be designated as such by the overlay file.
Now, the question is, does one of the existing overlay files have this pin designated as GPIO?

Regards,
Greg

Solved last night by Robert rcn-ee:

First upgrade your overlay, to include the fix for P8_43:

$ cd /opt/source/bb.org-overlays/ ; git pull

Then build the device tree overlays:
$ ./install.sh

This created the missing cape-universala-00A0.dtbo and copied it to /lib/firmware

Now I had a choice, should I have the cape-universal load on boot, for this do:
in /boot/uEnv.txt find, cmdline=… and add “cape_universal=enable”

Yet I chose not to do this but use my own systemd service to setup the GPIO, I posted the how to here.
I then have another service to load the ADC device tree.
and it all works fine

I don’t see any difference. When I use the command git pull, the command line response is “Already up-to-date.”.

I had already removed the bb.org-overlays directory and git cloned from
git clone GitHub - beagleboard/bb.org-overlays: Device Tree Overlays for bb.org boards

After ./install.sh, I see the same dtbo files in /lib/firmware.

Are you sure “git pull” is all that is required?

Another question I have on this overlay system: What determines the overlay which is loaded at boot?
Is there another influence besides the uEnv.txt file?
A cape board can have an EEPROM which describes the overlay to apply.
I know there is also an EEPROM on the BBB as well. Does this one also contain a default overlay which
is loaded in the case of no cape?

Regards,
Greg

I also did the git pull in the overlays directory and the ./intsall.sh, but the cape-universala overlay did not appear in the /lib/firmware directory. I searched the whole repository and as far as I can see an overlay with the name cape-universala has never existed. Any ideas how to resolve this?