beaglebone-universal-io and analog input

Hi,

I am using kernel 3.17.1-armv7-x3 on my BBB and I want to read the analog inputs available.

I found this website
https://github.com/cdsteinkuehler/beaglebone-universal-io

for hadling gpio but I don’t understand how to read analog inputs:

P9 31-40 Analog Signals, no pinmuxCould someone explain how to read these inputs?

Thanks

Roy

config-pin was developed to work with gpios enabled with the cape-universal-00A0.dtbo overlay.
To access the ADC inputs, you need to load the BB-ADC overlay. You can then access the AIN inputs with sysfs.

als $OCP/helper.*
  ls: cannot access /sys/devices/ocp.*/helper.*: No such file or directory
echo BB-ADC > /sys/devices/bone_capemgr.*/slots
tail -1 /sys/devices/bone_capemgr.*/slots
   7: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-ADC
als /sys/devices/ocp.*/helper.*
  total 0
  0 drwxr-xr-x 3 root root 0 Nov 7 12:28 .
  0 drwxr-xr-x 33 root root 0 May 14 21:40 ..
  0 -r--r--r-- 1 root root 4096 Nov 7 12:29 AIN0
  0 -r--r--r-- 1 root root 4096 Nov 7 12:29 AIN1
  0 -r--r--r-- 1 root root 4096 Nov 7 12:29 AIN2
  0 -r--r--r-- 1 root root 4096 Nov 7 12:29 AIN3
  0 -r--r--r-- 1 root root 4096 Nov 7 12:29 AIN4
  0 -r--r--r-- 1 root root 4096 Nov 7 12:29 AIN5
  0 -r--r--r-- 1 root root 4096 Nov 7 12:29 AIN6
  0 -r--r--r-- 1 root root 4096 Nov 7 12:29 AIN7
  0 lrwxrwxrwx 1 root root 0 Nov 7 12:29 driver -> ../../../bus/platform/drivers/bone-iio-helper
  0 -r--r--r-- 1 root root 4096 Nov 7 12:29 modalias
  0 drwxr-xr-x 2 root root 0 Nov 7 12:29 power
  0 lrwxrwxrwx 1 root root 0 Nov 7 12:28 subsystem -> ../../../bus/platform
  0 -rw-r--r-- 1 root root 4096 Nov 7 12:28 uevent
cat /sys/devices/ocp.*/helper.*/AIN1
  1554

Chad

Chad Baker
Professor Emeritus
Christian Brothers University
Electrical and Computer Engineering

cmbaker@cbu.edu
cmbaker3@gmail.com

Thanks for your answer.
I now have some more questions.

  1. Where can I find BB-ADC overlay?
  2. There is no more bone_capemgr in my kernel 3.17.1-armv7-x3. They removed it and oly use “simple” Device Trees at bootup.
  3. Can I use the BB-ADC overlay as DeviceTree?

Roy

Hello Roy,

there’s an alternative way to fetch ADC data on the BBB. The library libpruio provides several functions to fetch analog input, much faster and more flexible than sysfs. It also allows to configure the ADC subsystem steps. And furthermore it supports digital IO (GPIO, PWM and CAP).

This libpruio looks good. The problem is that I can’t get it running.
I think this is related tu the kernel (3.14.x or 3.17.x) version I am using. There is no capemgr any more.
Could you suggest me a linux image or kernel version I should use?

This libpruio looks good. The problem is that I can’t get it running.
I think this is related tu the kernel (3.14.x or 3.17.x) version I am using. There is no capemgr any more.
Could you suggest me a linux image or kernel version I should use?

sudo apt-get update
sudo apt-get install linux-image-3.8.13-bone67
sudo reboot

Thanks.
Now I got the capemgr but no permission to write to the slots

sudo echo BB-BONE-PRU-01 > /sys/devices/bone_capemgr.9/slots

-bash: /sys/devices/bone_capemgr.9/slots: Permission denied

Thanks.
Now I got the capemgr but no permission to write to the slots

sudo echo BB-BONE-PRU-01 > /sys/devices/bone_capemgr.9/slots

-bash: /sys/devices/bone_capemgr.9/slots: Permission denied

Well yeah…

http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Privileged_echo

google “privileged commands” for linux. You need root, or us an additional “switch” with sudo. sudo -sh I believe. Also, you can fix this in the sudoers file by having that user set to use roots user:passwd

Thanks for the hint. I am now using root so that I don’t need this work around anymore.

I think now I need the am335x-pru-package package

apt-get install am335x-pru-package

E: Unable to locate package am335x-pru-package

I try to use git to install this package but I don’t see what to do with this?

Ok the examples work now.

I was missing the pruss driver kit.
At the moment I don’t need the am335x-pru-package package.