BBB (buster) setup to get analog inputs working

I would like to use 4 analog inputs ( AIN0, AIN2, AIN4, AIN6 ). The devices are not available, but the
overlay is loaded at boot time.
Status ( user = root ):
1.) config-pin -l P9.39
ERROR: open() for /sys/firmware/devicetree/base/ocp/P9_39_pinmux/pinctrl-names failed, No such file or directory
2.) ls /sys/firmware/devicetree/base/ocp/
Display all 136 possibilities? (y or n)
A15_pinmux/ name P8_35_pinmux/ P9_42_pinmux/
#address-cells ocmcram@40300000/ P8_36_pinmux/ P9_91_pinmux/
aes@53500000/ P8_03_pinmux/ P8_37_pinmux/ P9_92_pinmux/
bone_sound/ P8_04_pinmux/ P8_38_pinmux/ phandle
can@481cc000/ P8_05_pinmux/ P8_39_pinmux/ pruss-soc-bus@4a326004/
can@481d0000/ P8_06_pinmux/ P8_40_pinmux/ ranges
cape-universal/ P8_07_pinmux/ P8_41_pinmux/ rng@48310000/
clk_mcasp0/ P8_08_pinmux/ P8_42_pinmux/ rtc@44e3e000/
clk_mcasp0_fixed/ P8_09_pinmux/ P8_43_pinmux/ serial@44e09000/
compatible P8_10_pinmux/ P8_44_pinmux/ serial@48022000/
edma@49000000/ P8_11_pinmux/ P8_45_pinmux/ serial@48024000/
elm@48080000/ P8_12_pinmux/ P8_46_pinmux/ serial@481a6000/
emif@4c000000/ P8_13_pinmux/ P9_11_pinmux/ serial@481a8000/
epwmss@48300000/ P8_14_pinmux/ P9_12_pinmux/ serial@481aa000/
epwmss@48302000/ P8_15_pinmux/ P9_13_pinmux/ sgx@56000000/
epwmss@48304000/ P8_16_pinmux/ P9_14_pinmux/ sham@53100000/
ethernet@4a100000/ P8_17_pinmux/ P9_15_pinmux/ #size-cells
gpio@44e07000/ P8_18_pinmux/ P9_16_pinmux/ spi@48030000/
gpio@4804c000/ P8_19_pinmux/ P9_17_pinmux/ spi@481a0000/
gpio@481ac000/ P8_20_pinmux/ P9_18_pinmux/ spinlock@480ca000/
gpio@481ae000/ P8_21_pinmux/ P9_19_pinmux/ ti,hwmods
gpmc@50000000/ P8_22_pinmux/ P9_20_pinmux/ timer@44e31000/
i2c@44e0b000/ P8_23_pinmux/ P9_21_pinmux/ timer@48040000/
i2c@4802a000/ P8_24_pinmux/ P9_22_pinmux/ timer@48042000/
i2c@4819c000/ P8_25_pinmux/ P9_23_pinmux/ timer@48044000/
interrupt-controller@48200000/ P8_26_pinmux/ P9_24_pinmux/ timer@48046000/
l4_wkup@44c00000/ P8_27_pinmux/ P9_25_pinmux/ timer@48048000/
lcdc@4830e000/ P8_28_pinmux/ P9_26_pinmux/ timer@4804a000/
mailbox@480c8000/ P8_29_pinmux/ P9_27_pinmux/ tptc@49800000/
mcasp@48038000/ P8_30_pinmux/ P9_28_pinmux/ tptc@49900000/
mcasp@4803c000/ P8_31_pinmux/ P9_29_pinmux/ tptc@49a00000/
mmc@47810000/ P8_32_pinmux/ P9_30_pinmux/ tscadc@44e0d000/
mmc@48060000/ P8_33_pinmux/ P9_31_pinmux/ usb@47400000/
mmc@481d8000/ P8_34_pinmux/ P9_41_pinmux/ wdt@44e35000/

3.) uname -a
Linux beaglebone 4.19.94-ti-r64 #1buster SMP PREEMPT Fri May 21 23:57:28 UTC 2021 armv7l GNU/Linux

4.) /opt/scripts/tools/
dogtag:[ Debian Buster IoT Image 2020-04-06]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2019.04-00002-g07d5700e21]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-boneblack-uboot-univ.dts]
UBOOT: Loaded Overlay:[AM335X-PRU-RPROC-4-19-TI-00A0]
UBOOT: Loaded Overlay:[]
UBOOT: Loaded Overlay:[]
UBOOT: Loaded Overlay:[BB-NHDMI-TDA998x-00A0]
/boot/uEnv.txt Settings:
pkg check: to individually upgrade run: [sudo apt install --only-upgrade ]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal bluetooth netdev i2c gpio pwm eqep remoteproc admin spi iio docker tisdk weston-launch xenomai cloud9ide]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet video=HDMI-A-1:1024x600@60e]
dmesg | grep remote
[ 69.456980] remoteproc remoteproc0: wkup_m3 is available
[ 69.645880] remoteproc remoteproc0: powering up wkup_m3
[ 69.645915] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217148
[ 69.646204] remoteproc remoteproc0: remote processor wkup_m3 is now up
[ 71.818158] remoteproc remoteproc1: is available
[ 71.829000] remoteproc remoteproc2: is available
[ 161.030454] remoteproc remoteproc1: powering up
[ 161.037099] remoteproc remoteproc1: Booting fw image pru_modulator-pru0-fw, size 64480
[ 161.037173] remoteproc remoteproc1: remote processor is now up
dmesg | grep pru
[ 71.818158] remoteproc remoteproc1: is available
[ 71.818318] pru-rproc PRU rproc node pru@4a334000 probed successfully
[ 71.829000] remoteproc remoteproc2: is available
[ 71.829196] pru-rproc PRU rproc node pru@4a338000 probed successfully
[ 161.030454] remoteproc remoteproc1: powering up
[ 161.037099] remoteproc remoteproc1: Booting fw image pru_modulator-pru0-fw, size 64480
[ 161.037173] remoteproc remoteproc1: remote processor is now up
dmesg | grep pinctrl-single
[ 0.944062] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
[ 0.957567] gpio-of-helper ocp:cape-universal: ready
Bus 001 Device 002: ID 1a86:e5e3 QinHeng Electronics
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

So … was loaded …

BTW, PRU 0 is in use and works fine .

5.) cat /sys/bus/iio/devices/iio:device0/in_voltage0_raw
cat: ‘/sys/bus/iio/devices/iio:device0/in_voltage0_raw’: Resource temporarily unavailable

6.) ll /sys/bus/iio/devices/iio:device0/in_voltage*
0 -rw-rw-r-- 1 root gpio 4096 Sep 24 13:36 /sys/bus/iio/devices/iio:device0/in_voltage6_raw
0 -rw-rw-r-- 1 root gpio 4096 Sep 24 13:36 /sys/bus/iio/devices/iio:device0/in_voltage3_raw
0 -rw-rw-r-- 1 root gpio 4096 Sep 24 13:36 /sys/bus/iio/devices/iio:device0/in_voltage7_raw
0 -rw-rw-r-- 1 root gpio 4096 Sep 24 13:36 /sys/bus/iio/devices/iio:device0/in_voltage0_raw
0 -rw-rw-r-- 1 root gpio 4096 Sep 24 13:36 /sys/bus/iio/devices/iio:device0/in_voltage4_raw
0 -rw-rw-r-- 1 root gpio 4096 Sep 24 13:36 /sys/bus/iio/devices/iio:device0/in_voltage1_raw
0 -rw-rw-r-- 1 root gpio 4096 Sep 24 13:36 /sys/bus/iio/devices/iio:device0/in_voltage5_raw
0 -rw-rw-r-- 1 root gpio 4096 Sep 24 13:36 /sys/bus/iio/devices/iio:device0/in_voltage2_raw

So what is missing? I’m running out of ideas …

Thanks for any good hint


Analog is is solved … not really clear why … but it works now.
Concerning eqep I’m going to open a new thread

The analog read issue is solved.
iolib_init() of BBBio_lib causes the problem.
At the moment iolib_init(); is called, the analog inputs are busy, no longer usable,
independent if the program is still running or not.
It’s independent of iolib_free(); also, can call it or not, analog inputs are temporarily unavailable,
up to reboot … and then as long iolib_init() is not called.

But eqep is working only with kernel 4.19.94-ti-r42. Independent of iolib_init();
No idea how to solve that. Will not update.
That’s a hard decision, don’t like that. Because there is hidden behavior, finally I want to control a machine, think I have to know what it is.


After apt update ; apt upgrade
my encoder is no longer working ( P8.11 / P8.12 )
config-pin -l P8.11
default gpio gpio_pu gpio_pd gpio_input qep pruout
config-pin -q P8.11
P8_11 Mode: default Direction: in Value: 1
config-pin P8.11 qep
/usr/local/bin/config-pin: 1489: echo: echo: I/O error
Cannot write pinmux file: /sys/devices/platform/ocp/ocp:P8_11_pinmux/state
config-pin -q P8.11
P8_11 Mode: default Direction: in Value: 1

And I can*t still get analog values …
config-pin -l P9.32
Pin is not modifiable: P9.32 VADC
config-pin -q P9.32
Pin is not modifiable: P9_32 VADC

But can’t get any value.
Trying to get my old working environment back alive … :joy:

Priority has the eqep interface … up to now it worked perfect …

It doesn’t look like anyone responded to you. Sorry. To my knowledge, the analog pins are not configurable so using config-pin is not required to set those up. I have never even tried that and my analog inputs work just fine. I’m assuming you are doing this on the ARM side of the system. If you are reading the ADC with the PRU, then you have do quite a bit of setup for your ADC with code in the PRU.

Find ADC and eQEP features in libpruio. No need for config-pin tool. Instead do pinmuxing inside your source code (unlimited, fast, reliable).

Got any examples for pru analog Input pin setup? In c instead of Asm would be helpful