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?
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.
Seth
P.S. If gpioinfo does not work, argh! Maybe we can push for it in the next release!
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…
@jamidon@foxsquirrel
good news:
clean download of xuantie-ubuntu
used master branch, default
after running “04_build_linux.sh” then “build_linux_menuconfig.sh”
enable:
CONFIG_GPIO_SYSFS
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
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.
update:
P8.3
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
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/fastboot_emmc.sh
deleted: deploy/mac_fastboot_emmc.sh
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 ./07_fastboot_emmc.sh
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
:
jamidon@atl-p7865:~/sandbox/xuantie-ubuntu$
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
beagle@BeagleV:~$