PC Engines APU4d2 GPIO support

Hello,

I've got an APU4d2 board with OpenWrt, I was making sure that GPIOs (on J18) were working as intended.


I compiled the kernel module for the super I/O chip (https://github.com/pcengines/linux-gpio-nct5104d) on OpenWrt and inserted it into the system without any error. Everything was looking good: the two GPIO controllers (gpiochip0 and gpiochip10) appeared in /sys/class/gpio and I was able to export any GPIO I wanted with the dmesg log looking clean.

Then, I found out that GPIO0 corresponds to pin number 3 from the schematics so I exported it, set it as output high:

$ echo 0 > /sys/class/gpio/export

$ echo out > /sys/class/gpio/gpio0/direction

$ echo 1 > /sys/class/gpio/gpio0/value

and measured the voltage between pin 1 (ground) and pin 3 with a multimeter, but it still showed 0V.
For some other pins (5, 6, 8, 13, 14, 16), the measured value is 3.3V, which appears to be immutable just like pin 3, regardless of the gpio value.
I also tried to use them as inputs, but their voltage wouldn't oscillate nor the value would change to 1 when I connected them to a positive pin (pin 2).

Does it look more like an electrical fault, which I might've caused by accidentally connecting two pins with different voltage without a resistor (causing the board to shutdown), or a software/driver-side issue?

Thanks in advance!

There's this under openwrt local sources:
https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=package/kernel/gpio-nct5104d/src/gpio-nct5104d.c;h=8f180edd33f8824f88d71f8c92a552a8c20fbe16;hb=HEAD

Is it different from the other driver?

1 Like

No, it's the same one I'm using

Hi

Have you looked in this guide https://openwrt.org/docs/techref/hardware/port.gpio?

1 Like

Turns out my pins were multiplexed for UART, disabling it from the BIOS options solved my problem

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.