Some GPIO pins does not work with custom image
-
Hi,
I compiled my image from a recently cloned LEDE git repo. Almost everything seems to work correctly except controlling some GPIO pins (15, 16, 17, 18, 19). I've tried to setup the function with
omega2-ctrl
and setting the pins through/sys/class/gpio/*
interface, none caused any changes the voltage on the pins is ~1.55V (I've checked by scope as well, it is not toggling, it is a flat ~1.55V on all pins I cannot use / configure).GPIO 45 / 46 seems OK, I can set them GPIO with
omega2-ctrl gpiomux set
command, and I can configure to in or out, can set or get value through the/sys/class/gpio/*
.I've tried the same HW using official image
v0.1.9-b159.bin
and I can control the GPIO pins 15, 16, 17 correctly (although in that image/dev/mem
is not available, so even that omega2-ctrl is part of the image it is unusable...).Can anyone suppose a way which direction to start to figure out what's the root cause?
Thanks,
/sza2
-
Based on MT7688 datasheet to use GPIO 14-17,
EPHY_APGIO_AIO_EN
bits inAGPIO_CFG
have to be '1', anyway those pins areMDI_TP_P1
/MDI_TN_P1
/MDI_RP_P1
andMDI_RN_P1
correspondingly.I made a small
devmem
like utility (I was not able to adddevmem
applet to busybox), setting the corresponding bits directly in the registers solved the problem, I checked on the hardware and I can control GPIO 15-17 now.The question right now, what sets these bits in the official image (or what unset in my custom image)? Whether it happened from kernel or user space? What should I modify (config, source) to be able to use the necessary pins without hacking from user space with an aggressive utility which directly modifies the bits without caring about the consequences?
/sza2
-
@sza2-sza2
You surely know that using the official 0.1.10-b160 FW we can control GPIO 15..19 (and 45, 46 too) withgpioctl
,fast-gpio
(andomega2-ctrl gpiomux
) fairly well.
The "full" BusyBox v1.26.2 (Length: 1498448 bytes unfortunately) has a
devmem
applet too.root@Omega-5BE1:~# ./busybox-mipsel devmem --help BusyBox v1.26.2 (2017-01-10 16:07:35 UTC) multi-call binary. Usage: devmem ADDRESS [WIDTH [VALUE]] Read/write from physical address ADDRESS Address to act upon WIDTH Width (8/16/...) VALUE Data to be written
Sorry, I'm afraid this wasn't too much help for you. Actually I have a question.
You compiled a custom image and I'd like to know where can I find the source of thegpioctl
ELF.
-
@György-Farkas Hi,
Yes, I can set GPIOs flashing the mentioned official image to the board, however I need custom image as my I2S HW is not supported in any precompiled images.
The problem is that compiling the LEDE repo by default set GPIOs 14-17 to MDI_xxx (act as Ethernet ports) instead of GPIOs.
I can set those pins to GPIOs with
devmem
like stuffs at or after boot but that's far from elegant.Regarding
gpioctl
, I did not download it directly, but installed by./scripts/feeds install gpioctl-sysfs
(from the top level directory of the installed SDK). However, it is available as part of libugpio. But it is just an interface to access/sys/class/gpio/*
, it simply reads / writes those files./sza2