Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A64 => Topic started by: oli_sbr on January 18, 2021, 07:42:40 PM

Title: [A64] Access of all GPIO with pyA64 (extension connector)
Post by: oli_sbr on January 18, 2021, 07:42:40 PM
Hello,

Using https://pypi.org/project/pyA64/ project, I am able to drive some GPIO (PE port)

The problem is I can't drive PB0 to PB4. The pins are not listed in the lib.
If I use the manual adress for PB0 to PB4, I still can not drive this ports.

Side note: PL port is said to not be accessible in user space. If I still want to access this port, what is the method ?

Thanks.
Title: Re: [A64] Access of all GPIO with pyA64 (extension connector)
Post by: LubOlimex on January 19, 2021, 08:22:23 AM
What Linux image are you using? Is it the latest Olimage image?

What does:

uname -a

returns.
Title: Re: [A64] Access of all GPIO with pyA64 (extension connector)
Post by: oli_sbr on January 19, 2021, 11:40:31 AM
Hi Lub,

Olimage version A64-OLinuXino-bionic-base-20201217-194545.img

Kernel:
Linux a64-olinuxino 5.8.18-olimex #122632 SMP Wed Dec 16 12:28:30 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux

My script to trigger PB3 (note it works with PE17 attached to the LED):

from pyA64.gpio import gpio
from pyA64.gpio import port

#led = port.PE17

#try to set PB3
#pin = (ord('B')-ord('A'))*32+3
pin = (2-1)*32+3

gpio.init()

gpio.setcfg(pin, gpio.OUTPUT)
gpio.output(pin, 1)

pyA64 version 0.1.0

Tested with a scope on pin PB3

thanks
Title: Re: [A64] Access of all GPIO with pyA64 (extension connector)
Post by: kalata23 on January 19, 2021, 02:50:05 PM
Quote from: oli_sbr on January 19, 2021, 11:40:31 AMHi Lub,

Olimage version A64-OLinuXino-bionic-base-20201217-194545.img

Kernel:
Linux a64-olinuxino 5.8.18-olimex #122632 SMP Wed Dec 16 12:28:30 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux

My script to trigger PB3 (note it works with PE17 attached to the LED):

from pyA64.gpio import gpio
from pyA64.gpio import port

#led = port.PE17

#try to set PB3
#pin = (ord('B')-ord('A'))*32+3
pin = (2-1)*32+3

gpio.init()

gpio.setcfg(pin, gpio.OUTPUT)
gpio.output(pin, 1)

pyA64 version 0.1.0

Tested with a scope on pin PB3

thanks

Can you execute "olinuxino-overlays" command and tell us, if uart2 overlay is enabled?
 
Title: Re: [A64] Access of all GPIO with pyA64 (extension connector)
Post by: oli_sbr on January 19, 2021, 03:38:50 PM
uart2 is disabled.
I also disabled LCD and I2C0 overlay, it changes nothing.
Title: Re: [A64] Access of all GPIO with pyA64 (extension connector)
Post by: oli_sbr on January 20, 2021, 05:20:23 PM
Update:

Using A64-OLinuXino-bionic-base-20201217-194545.img

I was able to drive the pins I wanted, using sysfs (read / write in /sys/class/gpio*).

So I think the issue is in the pyA64 project, and not in the kernel config or overlays.
Title: Re: [A64] Access of all GPIO with pyA64 (extension connector)
Post by: LubOlimex on January 21, 2021, 09:57:42 AM
Thanks for the update I was going to test with the sysfs today. The pyA64 project was made for Armbian images and I don't think it was recently updated, probably it is not compatible with latest Olimage images.
Title: Re: [A64] Access of all GPIO with pyA64 (extension connector)
Post by: oli_sbr on January 22, 2021, 05:56:42 PM
OK.

More info that might help other people.

I am using Buildroot as final tool to generate the system.
Since sysfs is deprecated, I am using libgpiod that is available for buildroot.

https://github.com/brgl/libgpiod


Works like a charm  :)