Which Khadas SBC do you use?
VIM3
Which system do you use? Android, Ubuntu, OOWOW or others?
Ubuntu 20.04
Which version of system do you use? Khadas official images, self built images, or others?
self built image Linux 6.2.0 Ubuntu 20.04 with Gnome
Please describe your issue below:
Hi everyone. I’m new with Khadas software. I need a supporting CAN bus, SPI and some GPIO on VIM3 board. So according instruction GitHub - khadas/fenix: One-stop script set to build Ubuntu/Debian images kernel was rebuilt with necessary drivers.
gpio readall fails:
err: wiringPiSetup: mmap (GPIO) failed: Bad file descriptor
How to fix this issue? How can I use GPIO? Thanks for any help.
With shared images from Khadas with Linux kernel versions 6.0.0 and 6.1.0 gpio works properly (but no CAN drivers in kernel).
Post a console log of your issue below:
uname -r
6.2.0
gpio readall
err: wiringPiSetup: mmap (GPIO) failed: Bad file descriptor
Did you try to use the same config file and just add can support in it for 6.2 it did you use new config file?
Maybe gpio config is not enabled in your 6.2 kernel build?
1 Like
For build used config file build/linux/arch/arm64/configs/kvims_defconfig
Actually GPIO does not work without any config edits (directly from git).
Where I can find GPIO configuration in ‘make kernel-config’ ? Advise please
Linux 6.0.0 (gpio works)
ls /dev/gpiomem*
/dev/gpiomem
/dev/gpiomem-ao
Linux 6.2.0 (gpio does not work)
ls /dev/gpiomem*
No such file or directory
Hi all. Issue solved.
Add manually to ./build/linux/drivers/char/Kconfig
config AMLOGIC_GPIOMEM
tristate "/dev/gpiomem rootless GPIO access via mmap() on the Amlogic"
default y
help
Provides users with root-free access to the GPIO registers
on Meson platform. Calling mmap(/dev/gpiomem) will map the GPIO
register page to the user's pointer. This drvier can allow to access
gpio memory area in user account.
Then rebuild fenix kernel.
gpio readall works!
See this confs in patch ./packages/linux-mainline/patches/6.0/0043-add-gpiomem-driver.patch
1 Like