GPIO configuration in HLK-7688A

This is regarding GPIO configuration in HLK-7688A.
We need to configure 2 pins as GPIO pins (GPIO20 as input and GPIO21 as output).
We tried to configure GPIO pin 20 as an output pin using sysfs driver for testing and was driving the pin HIGH, but GPIO20 didn’t reflect it on probing it with multimeter.
The steps followed for configuring are:

  1.         ls /sys/class/gpio/
             This command lists out the gpiochips. We got one of the gpiochips as gpiochip416@
  2.        echo 436 >/sys/class/gpio/export           
             This command registers gpio436 (416 base + 20) and its reflecting on giving the ls command.
  3.        echo out >/sys/class/gpio/gpio436/direction
  4.        echo 1 >/sys/class/gpio/gpio436/value

We tried to configure this pin as input pin but that also didn’t work.
Our end objective is to configure one GPIO pin as an input pin which is interrupt based and one pin as an output pin.
Any help will be appreciated.
Thanks in advance.

You cannot use them until they are set in the DTS.
Both 20 and 21 belong to uart2 pingroup that is not set as gpio initially.

1 Like

Thanks AndrewZ.
Can you tell how to set these particular pins in DTS?

The group name should be added on this line:

1 Like

Hi Andrew, I have the exactly same problem.

What group should be added in that line "gpio" "uart2"? can you write how the line "groups" should be?

Thanks for your help!

groups = "wdt", "wled_an", "uart2";

Hi Andrew

It didn't work.

I compiled and updated the HLK-7688a, then configured the GPIO pins and changed the values, but the voltage on the pin remains stable at 1.5V for high and low

root@OpenWrt:~# cat /sys/kernel/debug/gpio
gpiochip2: GPIOs 416-447, parent: platform/10000600.gpio, 10000600.gpio-bank2:
 gpio-436 (                    |sysfs               ) out hi
 gpio-437 (                    |sysfs               ) out hi

gpiochip1: GPIOs 448-479, parent: platform/10000600.gpio, 10000600.gpio-bank1:
 gpio-454 (                    |reset               ) in  hi IRQ ACTIVE LOW
 gpio-460 (                    |green:wlan          ) out lo ACTIVE LOW

gpiochip0: GPIOs 480-511, parent: platform/10000600.gpio, 10000600.gpio-bank0:

Is there another file or line that I need to modify? or setting to activate?

This is the chipset I have. I made the pinmap with the documentation I found.

It would be perfect to use the GPIO LEDs (EPHY_LED1 to EPHY_LED4) and uart0 and uart1.

I'm testing with OpenWrt 21.02.2, maybe it's the version?

Thanks for your help!

I am also working on the same function, build on the same version - OpenWrt 21.02.2. I tried what was suggested above and made sure that firmware binary are correct on both HLK-7628N and HLK-7688A. Are there any additional information on this one? Voltage on the pin does not reflect what is being registered using gpioctl and sysfs commands.