OpenWrt GPIO MT7620A

Can I use UART pins on my ASUS RT-AC51U with SOC MT7620 as GPIO, if so how ?

  1. Whats it going to be used for...?

  2. Are you capable of using the buildroot / editing some source code? OR were you relying on a "non-invasive" method?

  3. Can you live without any LEDs?


  5. UART > MICROCONTROLLER etc. is also an option

  6. network based IO via esp8266 or similar is also an option depending on the use.

Better to use option 4 or 5, then 3... but it all comes down to what your using it for and how much your tied to using board hardware only.

I use it to control the aquarium. USB port and LED pins are already taken. it works great right now, but I need more gpio. I would like to use this hardware, because everything is already mounted.

i'm ok with buildroot and editing some source code.

Datasheet says, "Some pins are shared with GPIO to provide maximum flexibility for system designers. The MT7620 provides up to 73 GPIO pins. Users can configure SYSCFG and GPIOMODE registers in the System Control block to specify the pin function, or they can use the registers specified below. "

There are Register GPIOMODE: GPIO Purpose Select (offset: 0x0060), and bit 5 UARTL_GPIO_MODE
0: Normal Mode, 1: GPIO Mode. How to change this bit?

you may need to disable uartlite in the dts.

then search your buildroot for ralink/mt7620.h/rt2880.c

should be enough to get you started...

don't hook anything you care about up to it until you've tested that you've fully isolated it.

How i can disable uartline in the dts? What should i change in .dts and .dtsi files?
I deleted all uart parameters in mt7620a.dts and disabled all uart parameters in mt7620a.dtsi.
After this uart still working.

start here;

I terminated uart console without kernel rebuild how you write. But when i try to use gpio15 (echo 15 > /sys/class/gpio/export) i received "write error: Invalid argument".
I tried to disable uartlite in dts and dtsi files but after rebuilding nothing changes.
After building firmware, it called "openwrt-ramips-mt7620-rt-ac51u-squashfs-sysupgrade.bin". Is it correct?
If I disable UART in .dts file, will SysControl register have default values for pins 15-16 (will they set as GPIO)?

without that hardware i can't really say. i'm just giving you "ingredients" not a recipe.

having said that... i would "think" that simply disabling something would only be half of the task. in that you might also need to define those freed pins as available.

How is the dts file used to build the firmware?
Does it make sense to change it?