OpenWrt Forum Archive

Topic: GPIOs For MR3220 and AR7241 processor

The content of this topic has been archived on 13 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

great work so far. maybe it helps to use some script to trigger special events that you can then measure on the pins of the CPU. So, you would set up your GPIOs in sysfs to ouput and enter the directory of the GPIO you want to detect (i.e. gpio13/).
With something like this:

while true; do echo "1" > value; sleep 1; echo "0" > value; sleep 1; done

that GPIO will switch high/low at 0,5 Hz. Maybe you need to adjust the values behind sleep, but 1 second is probably a good start.

I thought about it. To safely use a frequency where only one probe. The problem is that the router is powered pulsed voltage source. Or Power source or source GND or any other source of always give ~7KHz. This accuracy I do not have to tell the difference.
I used industrial multimeter.
Sorry for my English.

actually, 0,5 Hz is very slow, so you don't need to worry. Just have a look at your multimeter for a sequence of 1 second on, 1 second off, ...

In general, I found the the theoretically rest of GPIOs (13-17), as I understand it's WAN and LAN1-LAN4 LEDs. But which LED matches GPIO pin - I do not know. To find out, to the example of D-Link DIR-600/601(AR7240) - enable control of GPIOs:

Add leds with Led section :

#define TL_MR3X20_GPIO_LED_QSS          0
#define TL_MR3X20_GPIO_LED_SYSTEM       1
#define TL_MR3X20_GPIO_LED_3G           8
#define TL_MR3X20_GPIO_LED_13        13
#define TL_MR3X20_GPIO_LED_14        14
#define TL_MR3X20_GPIO_LED_15        15
#define TL_MR3X20_GPIO_LED_16        16
#define TL_MR3X20_GPIO_LED_17        17
static struct gpio_led tl_mr3x20_leds_gpio[] __initdata = {
                .name           = "tp-link:green:system",
                .gpio           = TL_MR3X20_GPIO_LED_SYSTEM,
                .active_low     = 1,
        }, {
                .name           = "tp-link:green:qss",
                .gpio           = TL_MR3X20_GPIO_LED_QSS,
                .active_low     = 1,
        }, {
                .name           = "tp-link:green:3g",
                .gpio           = TL_MR3X20_GPIO_LED_3G,
                .active_low     = 1,
        }, {
                .name           = "tp-link:green:13",
                .gpio           = TL_MR3X20_GPIO_LED_13,
                .active_low     = 1,
        }, {
                .name           = "tp-link:green:14",
                .gpio           = TL_MR3X20_GPIO_LED_14,
                .active_low     = 1,
        }, {
                .name           = "tp-link:green:15",
                .gpio           = TL_MR3X20_GPIO_LED_15,
                .active_low     = 1,
        }, {
                .name           = "tp-link:green:16",
                .gpio           = TL_MR3X20_GPIO_LED_16,
                .active_low     = 1,
        }, {
                .name           = "tp-link:green:17",
                .gpio           = TL_MR3X20_GPIO_LED_17,
                .active_low     = 1,

the only way to get control of these GPIOs

Please help me compile the firmware with this patch for MR3220, I do not have the time and resources (SW) to do it.

(Last edited by Dioptimizer on 4 Feb 2012, 08:34)

I can not really follow you. If those GPIOs 13-17 are connected to those LEDs, then you should be able to export them to sysfs and access the appropriate gpioXX/value file (as long as no other driver is occupying them, like some ledtrig-netdev alike driver - do "lsmod | grep led" to find out). And as long as you haven't confirmed those GPIOs I don't see any reason for adding them to the mach-tl-mr3x20.c file.

Once again, please help me with compiling the data described above.
Updated schematic chart that you have no doubts.
Pin AR7240 and AR7241 CPU is the same, illustrative example above.
The system uses the LED1-4, WAN, and does not use them to take control, so you need to patch the file mach-tl-mr3x20.c
From you I am not asking to flash your router, I just need to compile, I'm at your own risk and will flash my MR-3220 router.
Thank you for your patience.

(Last edited by Dioptimizer on 4 Feb 2012, 11:00)

Since you have not yet found the assignments of all GPIOs, you should connect to a terminal (telnet or ssh) of your router and issue the following:

cd /sys/class/gpio/
echo 13 > export
cd gpio13/
echo out > direction
echo 0 > value
echo 1 > value
echo 0 > value

Look on the LEDs for changes and do the procedure also for GPIOs 14-17. Also have a look if there are other files in gpio13/ and discover them using cat and echo.
After that is done, it will be time to deal with compiling anything.

Do you really think I could find all GPIOs without knowing how to control GPIOs via Sys fs?
Or is this the next trolling?

I repeat that the GPIOs 13-17 are not controlled, they obviously overriden by unknown-kernel module.

The same is with the SJ1-Px, SJ1-Tx, CS #, SCLK, MOSI, MISO - this is bug or a foolproof when they are overriden by ???-kernel module GPIOs, all these become the input-mode.

The only difference in the 13-17 GPIOs as they are actually in the output-mode

(Last edited by Dioptimizer on 4 Feb 2012, 15:24)

Actually, I don't really know about your skills. So, if in doubt, I prefer to give even too much information, than too less. But I certainly don't compile firmware images for other people, I just try to guide the way as good as I can. And if you want me to stay off your thread, that's fair enough.
Anyway, back to your topic: You should provide more information on what you actually did and tried, and which results you encountered (at best console logs).

The discussion might have continued from here.