How to access GPIOs on BeagleV Ahead

Because of my experiences with other Beagles, I assumed that access to the GPIOs would be similar on the RISC-V SOCs, that is, visible via gpiodetect and/or look in the /sys/class/gpio directory for file system access. However, gpiodetect returns nothing on a BeagleV Ahead and the /sys/class/gpio directory does not exist. I have tested this on both the Debian Sid and Ubuntu Mantic distributions.

Not that I know exactly what I’m looking at but when I dump and view the th1520-beaglev-ahead.dtb file, I do see gpio controllers defined, so I’m thinking they should be somewhere.

What do a I need to do to access the GPIOs from user-space applications?


– jda

I don’t have a V, however the gpiodetect requires sudo. You should see something or the board would not have booted.

sudo gpiodetect, did not help

no useful info from debug either.
cat /sys/kernel/debug/pinctrl/pinctrl-
pinctrl-devices pinctrl-handles pinctrl-maps

also was not able to get i2c2 to work with an RTC

Debian Sid Console Image 2024-01-19

Does it have .dtbo files that need to added, possibly, I am just pulling this out of thin air in hopes of finding a clue as to what is missing.

1 Like


On the docs, there are some clues. I think the audio is out for now from somewhere when I read about it…

gpioinfo is the command in question to get to know your system a bit (I am guessing too)…

There at the .html page is a lengthy availability of pins and how to use 'em (sort of). I found gpioinfo useful at times and learn when things change, change happens.


P.S. If gpioinfo does not work, argh! Maybe we can push for it in the next release!

I’m running RevyOS (based on Debian Bookworm). /sys/class/gpio, gpiodetect, and gpioinfo all show something there (six chips with 32 lines each).

What are these Debian Sid and Ubuntu Mantic BeagleV-Ahead distros of which you speak? Do they support the GPU?

$sudo apt list --installed | grep gpiod

yes, was tested on the yocto build, i2cdetect does not detect the bus either.

no go
sudo /usr/bin/gpioinfo
no results returned

thanks for the link
using their example, same results with or w/o sudo
/usr/bin/gpioset 1 21
/usr/bin/gpioset: invalid offset<->value mapping: 21

excluding the install part, looks like libgpiod is installed,

gpiod/unstable,now 1.6.3-1.1 riscv64 [installed]
libgpiod-dev/unstable,now 1.6.3-1.1 riscv64 [installed]
libgpiod-doc/unstable 1.6.3-1.1 all
libgpiod2t64/unstable,now 1.6.3-1.1 riscv64 [installed,automatic]
libpigpiod-if-dev/unstable 1.78-1.1 riscv64
libpigpiod-if1t64/unstable 1.78-1.1 riscv64
libpigpiod-if2-1t64/unstable 1.78-1.1 riscv64
python3-libgpiod/unstable,now 1.6.3-1.1 riscv64 [installed]

The number of gpio controllers you mention matches up with what’s in the /boot/firmware/th1520-beaglev-ahead.dtb file.

The debian and ubuntu distributions can be built from


It is down to the kernel config or some module is not available or loaded. Since apt has that stuff available and installed for riscv it might be in the kernel config. Some others posted its working with a different OS so maybe open up the kernel and see how its configured for the other os that is known working and update the one you are using. @jamidon

you may be correct, xuantie-ubuntu has kernel config GPIO support enabled
/sys/class/gpio/… enabled
character deivce /dev/gpiochpN support enabled

being the weekend is rained out, i’ll try to spend some time looking at this.

did a clean download of ‘xuantie-ubuntu’ checked out v6.8.x
built and installed to mmc, however at boot it hangs
Waiting for root device /dev/mmcblk0p3…

is v6.8.x of xuantie-ubuntu working ??

@jamidon @foxsquirrel
good news:
clean download of xuantie-ubuntu
used master branch, default
after running “” then “”
CONFIG_GPIO_DWAPB (not sure this is needed, was enable in buildroot, which works)

i did not test if pins can be set/changed
gpioinfo listed status of all pins

beagle@BeagleV:~$ gpiodetect
gpiochip0 [ffe7f34000.gpio] (32 lines)
gpiochip1 [ffe7f38000.gpio] (32 lines)
gpiochip2 [ffec005000.gpio] (32 lines)
gpiochip3 [ffec006000.gpio] (32 lines)
gpiochip4 [fffff41000.gpio] (32 lines)
gpiochip5 [fffff52000.gpio] (32 lines)

Should work if they are visible.

Do you know if they have pthreads.h or threads working on that board?

testing that now, does not seem to work (sudo or no sudo)

changing output of P8.3
gpioset 1 21=1
does not change the pin value
P8.3 is GPIO1_21 (per web site posted above)
GPIO1_21 is (??) gpio53 (1*32 + 21)
echo 53 > /sys/class/gpio/export, does not produce /sys/class/gpio/gpio53
been a while since i did this, so maybe i’m doing it wrong.
no errors are produced.

root@BeagleV:/sys/class/gpio# echo 53 > export
bash: echo: write error: Invalid argument

export has write permissions.

sudo gpioset 1 21=1
with dmm attached, the pin goes to 1.7ish, disconnect dmm and reattach and the pin is at 3.3 volts
sudo gpioset 1 21=0
with dmm attached, the pin goes to 1.8ish, disconnect dmm and reattach and the pin is at 0 volts

so clearly there are issues OR i have no clue what i’m doing LOL

haven’t worked with pthreads on beagleV
there is

ok, simple test

builds with some warnings, runs with no issues

eagle@BeagleV:~$ ./thread
Thread - 1
Thread - 2

1 Like

Thank you.

Oops, I should have mentioned kernel I tested on:

Linux BeagleV 6.9.0-rc5-20240424+ #1 SMP Wed Apr 24 09:15:42 EDT 2024 riscv64 riscv64 riscv64 GNU/Linux

Awesome, I was going to check that this morning when I got back. I’ll do a clean build and see what happens.

beagle@BeagleV:~$ uname -a
Linux BeagleV 6.9.0-rc5-00363-g48333bae09f7-dirty #5 SMP Sun Apr 28 08:04:48 CDx
this is what master branch is

Hmm, I’m on the master branch, I simply cloned and built. Post building the Ubuntu 24.04 console this morning, this is what the status of the local repo looks like:

jamidon@atl-p7865:~/sandbox/xuantie-ubuntu$ git status
On branch master
Your branch is up to date with ‘origin/master’.

Changes not staged for commit:
(use “git add/rm …” to update what will be committed)
(use “git restore …” to discard changes in working directory)
deleted: deploy/.empty
deleted: deploy/
deleted: deploy/
modified: patches/linux/beaglev_defconfig

no changes added to commit (use “git add” and/or “git commit -a”)

I then installed on a connected BeagleV Ahead:

jamidon@atl-p7865:~/sandbox/xuantie-ubuntu$ sudo ./
fastboot version 29.0.6-debian
Installed as /usr/lib/android-sdk/platform-tools/fastboot
Sending ‘ram’ (940 KB) OKAY [ 0.250s]
Writing ‘ram’ OKAY [ 0.002s]
Finished. Total time: 0.257s
Rebooting OKAY [ 0.001s]
Finished. Total time: 0.151s

This is what gets installed:

beagle@BeagleV:~$ uname -a
Linux BeagleV 6.9.0-rc6-20240430+ #1 SMP Tue Apr 30 10:28:32 EDT 2024 riscv64 riscv64 riscv64 GNU/Linux
beagle@BeagleV:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04 LTS
Release: 24.04
Codename: noble

No gpios detected.