cape-universal & 4.1.x = default.. ;)

This will break any scripts and libraries that load overlays as needed. I don’t see how loading it by default benefits anything :frowning:

Also the only updates I needed for the beaglebone gem was to change a single line to look for the new slots file, everything else worked the same, so I assume not much else is needed for pybbio and bonescript. With this auto-loading however, it breaks loading overlays for these libraries unless its disabled. Loading this also slows down boot time by a few seconds.

I just added a cmdline switch for this: (/boot/uEnv.txt)

cmdline="${cmdline} cape_universal=enable"

https://github.com/RobertCNelson/omap-image-builder/commit/ca1ec1397b30df027ff54d9902c64cc359538d0b

cape universal will be enabled by default, but a user can now more
easily disable it in /boot/uEnv.txt

Regards,

and the boot script change:

https://github.com/RobertCNelson/boot-scripts/commit/7730db559cf4b03b0d845b2bdc3e04542a7dcff6

Regards,

<rcn-ee> nyt, btw, ping charles on that email thread.. we should have slew rate controls ...

Also just my $0.02, I'd like to see the universal overlay loaded when needed (via config-pin?) and not during boot by default. This will continue to let anything else that loads overlays function as they were without change (beaglebone gem, pybbio, etc)

<rcn-ee> nyt, btw, ping charles on that email thread.. we should have slew rate controls ...

Also just my $0.02, I'd like to see the universal overlay loaded when needed (via config-pin?) and not during boot by default. This will continue to let anything else that loads overlays function as they were without change (beaglebone gem, pybbio, etc)

@Robert

So I decided to give universal-io a go for the first time( finally ), but . . . trying to follow along with Charles’ examples on github . . .

william@beaglebone:~$ sudo config-pin -l P9.14
sudo: config-pin: command not found

At this point, I do not know what is going on. So I check around a little.
william@beaglebone:~$ dmesg |grep universal
[ 0.000000] Kernel command line: console=tty0 console=ttyO0,115200n8 root=/dev/mmcblk0p1 rootfstype=ext4 rootwait coherent_pool=1M quiet cape_universal=enable ipv6.disable=1

william@beaglebone:~$ cat /boot/uEnv.txt | grep cmdline
cmdline=coherent_pool=1M quiet cape_universal=enable ipv6.disable=1
#cmdline=ipv6.disable=1
#cmdline=coherent_pool=1M quiet cape_universal=enable video=HDMI-A-1:1024x768@60e
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh

At which point, I am stuck. I did on a previous boot also manually load the universaln overlay. I did notice a lot more noise from dmesg in relation to pings being configured. But still no config-pin utility . . .

What am I missing ?

Still no dice . . .

william@beaglebone:~$ dmesg |grep univ
[ 0.000000] Kernel command line: console=tty0 console=ttyO0,115200n8 bone_capemgr.enable_partno=cape-universaln root=/dev/mmcblk0p1 rootfstype=ext4 rootwait ipv6.disable=1
[ 5.541989] bone_capemgr bone_capemgr: enabled_partno PARTNO ‘cape-universaln’ VER ‘N/A’ PR ‘0’
[ 5.563179] bone_capemgr bone_capemgr: slot #4: ‘Override Board Name,00A0,Override Manuf,cape-universaln’
[ 5.704778] gpio-of-helper ocp:cape-universal: Allocated GPIO id=0
[ 5.713400] gpio-of-helper ocp:cape-universal: Allocated GPIO id=1
. . .

[ 6.198582] gpio-of-helper ocp:cape-universal: Allocated GPIO id=32
[ 6.204916] gpio-of-helper ocp:cape-universal: ready
[ 6.320586] bone_capemgr bone_capemgr: slot #4: dtbo ‘cape-universaln-00A0.dtbo’ loaded; overlay id #0
william@beaglebone:~$ sudo config-pin
[sudo] password for william:
sudo: config-pin: command not found

william@beaglebone:~$ uname -r
4.4.9-bone-rt-r10

william@beaglebone:~$ cat /etc/dogtag
BeagleBoard.org Debian Image 2016-05-01

william@beaglebone:~$ cat /boot/uEnv.txt |grep cmdline
#cmdline=coherent_pool=1M quiet cape_universal=enable ipv6.disable=1
cmdline=ipv6.disable=1
#cmdline=coherent_pool=1M quiet cape_universal=enable video=HDMI-A-1:1024x768@60e
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh

william@beaglebone:~$ cat /boot/uEnv.txt |grep universaln
cape_enable=bone_capemgr.enable_partno=cape-universaln

My cure . . .

william@beaglebone:~$ wget https://raw.githubusercontent.com/cdsteinkuehler/beaglebone-universal-io/master/config-pin
william@beaglebone:~$ sudo chmod +x config-pin
[sudo] password for william:
william@beaglebone:~$ sudo cp ./config-pin /usr/bin
william@beaglebone:~$ config-pin -l P8.07
default gpio gpio_pu gpio_pd timer

I thought, perhaps incorrectly that config-pin came shipped by default.

It does, but it depends on the image you start with. Usually it's
found in /opt/source/beaglebone-universal-io/, with a symlink for
config-pin in /usr/local/bin/config-pin:

https://github.com/RobertCNelson/omap-image-builder/blob/master/target/chroot/beagleboard.org-wheezy.sh#L389-L396

It does, but it depends on the image you start with. Usually it’s
found in /opt/source/beaglebone-universal-io/, with a symlink for
config-pin in /usr/local/bin/config-pin:

https://github.com/RobertCNelson/omap-image-builder/blob/master/target/chroot/beagleboard.org-wheezy.sh#L389-L396

Oh, ok. I start with the console images always, and this is not the first time I’ve not been able to find config-pin. But after some investigation, and a system wide search for the file ‘config-pin’ turned up nothing. It was then just a matter of realizing that I had everything in place already except config pin. So I read the Makefile figured out where make install would put the file . . .and went from there :wink:

@Charles

So I’m not sure if this is normal or not. Thought I’d bring it to your attention in case it’s not.

william@beaglebone:~$ sudo chown root:gpio /usr/bin/config-pin
william@beaglebone:~$ config-pin P8.07 hi
william@beaglebone:~$ cat /sys/devices/platform/ocp/ocp:cape-universal/status
. . .
32 P8_07 66 IN 0

That should be OUT, and 1 ? the gpio sysfs stuff reports correctly though

william@beaglebone:~$ cat /sys/class/gpio/gpio66/direction
out
william@beaglebone:~$ cat /sys/class/gpio/gpio66/value
1
william@beaglebone:~$ config-pin -q P8.07
P8_07 Mode: gpio Direction: out Value: 1

As does the config-pin query option.

The status file is created by the kernel logic, and I believe simply
reflects the load-time configuration of the GPIO, which all default to
inputs when the overlay loads)...but I haven't crawled through the
kernel code to figure out exactly what it's doing to create the status
file. I suspect the kernel logic generating the status file doesn't
understand the GPIO have been exported and are not directly controlled
by the cape-universal overlay. Honestly, I'm not sure I've ever
looked at the contents of the status file previously.

Anyway, I get the same results on my system here, so I don't think
it's anything you need to worry about:

machinekit@beaglebone:~$ config-pin P8.07 hi
machinekit@beaglebone:~$ cat /sys/devices/ocp.3/cape-universal.51/status
...
34 P8_09 69 IN 0
35 P8_08 67 IN 0
36 P8_07 66 IN 0
machinekit@beaglebone:~$ cat /sys/class/gpio/gpio66/direction
out
machinekit@beaglebone:~$ cat /sys/class/gpio/gpio66/value
1

Thanks Charles.

Yes, initially I was thinking that perhaps that file reflected what the current values of pins were. But after thinking while waiting for your reply I was thinking that too. Initial state of the pins at the time the overlay was loaded.

Another question regarding config-pin . . .I have a Nodejs project here: https://github.com/wphermans/Bonejs, but I just now wrote a Nodejs( Javascript ) wrapper for config-pin and wanted to make sure that would be ok. I do also have plans on using that wrapper for a much bigger, and cooler project, which was requested by Robert not long ago . . .

No idea how long it’ll take me with other priorities in the mix too. But I figured I should ask.

By the way, it’s just a wrapper for Nodejs, but otherwise I’m not changing a thing. So far all I really want / need is:

“use strict”;
var fs = require(‘fs’);
var exec = require(‘child_process’).exec;

exports.config = function(pin, value){

var params = pin + ’ ’ + value;
var child = exec(’/usr/bin/config-pin ’ + params, (error, stdout, stderr) => {
if(error){throw error;}
});
};

exports.listModes = function(pin, callback){

var params = pin;
var child = exec(’/usr/bin/config-pin -l ’ + params, (error, stdout, stderr) => {
if(error){throw error;}

callback(stdout);
});
};

william@beaglebone:~/dev/bonejs$ node config-pin-example.js
default gpio gpio_pu gpio_pd timer

So the wrapper is really simple. But what I plan on doing with said wrapper will be really neat I think. How does configurering your pin modes from a web page sound ? :wink:

Wrap away!

I'm just happy the universal overlay concept has caught-on. I wanted
people to be able to do most simple things without having to craft
custom device-tree overlays. Using a custom overlay is still the most
flexible option, but there's a pretty high barrier to entry.

That sounds pretty awesome!

Wrap away!

I’m just happy the universal overlay concept has caught-on. I wanted
people to be able to do most simple things without having to craft
custom device-tree overlays. Using a custom overlay is still the most
flexible option, but there’s a pretty high barrier to entry.

Ok awesome.

I’ve actually really liked the idea of universal-io ever since you put the project up, and made it known. Really an awesome idea. At the time it was very obvious to me that this would be something really cool. But I was wrapped up in my own little world, doing my own thing, and since I use console images that do not always, or ever seem to have config-pin enabled by default ? Not really sure, but every time I went to tinker with config-pin . . . “command not found”. It’s just that this time, my own little world collided with universal-io. So I gave some thought into what actually was not working, and how to make it work.

I do have to say, that I’m every bit as impressed with universal-io now, as I was back when you put it into the wild. I quite honestly think that universal-io + config-pin is every bit as good as device tree files. At least in what universal-io can do. I do not know if it has any short comings. but from what I can see . . . there are none ?

Ok so one not so fun issue . . .

william@beaglebone:~/dev/bonejs$ config-pin P8.07 low
sudo: no askpass program specified, try setting SUDO_ASKPASS
Cannot write gpio direction file: /sys/class/gpio/gpio66/direction

EXCEPT
william@beaglebone:~/dev/bonejs$ ls -al /sys/class/gpio/gpio66/direction
-rwxrwx— 1 root gpio 4096 Jun 23 14:17 /sys/class/gpio/gpio66/direction

william@beaglebone:~/dev/bonejs$ getent group gpio
gpio:x:1001:william

I’ve a feeling I know how to fix this though . . . will require editing config-pin . . .