OpenWrt Forum Archive

Topic: TL-MR3040 GPIOs

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

Hi everybody!
So I new in the forum, but I´ve been doing some resource around the TL-MR3040 as you can see in the Wiki.

So far I could confirm 7 free GPIOs, 6 near LED4 and the other near flash memory, wich for now, I could only control 3 of them as described in the next photo.
http://wiki.openwrt.org/_media/media/mr3040gpio.jpg

I'm now writing this, because, I can´t really be sure of my research because I don´t have the right equipment/stuff to test the router and make sure that these are really free GPIOs and if we can use it.
This is why I asking for help from those who have an MR3040 or MR11U to confirm this GPIOs, but all the help is welcome.


Once again I wanna say thanks to Jarocks and his Reverse Engineering the TL-MR3040 for providing good photos for the research wink

best regards

EDIT: Updated Photo with free GPIOs

(Last edited by doiga on 26 Feb 2013, 19:59)

If you take a look at Squonk's wr703n reverse engineering you should be able to trace out gpio 0,7,14,15,27(9?) by analogy

How to enable control GPIO13-16:
https://forum.openwrt.org/viewtopic.php … 21#p175021
https://forum.openwrt.org/viewtopic.php … 23#p186723 <=this same as upper url only difference sending RAW command

uboot wrote:

    /* Disable clock obs
     * clk_obs1(gpio13/bit8),  clk_obs2(gpio14/bit9), clk_obs3(gpio15/bit10),
     * clk_obs4(gpio16/bit11), clk_obs5(gpio17/bit12)
     * clk_obs0(gpio1/bit19), 6(gpio11/bit20)
     */

(from u-boot/board/ar7240/ap121/ap121.c)

robthebrew wrote:

If you take a look at Squonk's wr703n reverse engineering you should be able to trace out gpio 0,7,14,15,27(9?) by analogy

Thanks for the tip. I´ve already studied the reverse engineering on the WR703N/MR3020, but, althought they are hardware similar unfortunaly the conections from MR3040/MR11U seems differents for LEDs, Switchs, etc...
And these GPIOS 6, 7, 8, 18, 19, 21, 22, 24 aren´t used (NC).


Dioptimizer wrote:

How to enable control GPIO13-16:
https://forum.openwrt.org/viewtopic.php … 21#p175021
https://forum.openwrt.org/viewtopic.php … 23#p186723 <=this same as upper url only difference sending RAW command

uboot wrote:

    /* Disable clock obs
     * clk_obs1(gpio13/bit8),  clk_obs2(gpio14/bit9), clk_obs3(gpio15/bit10),
     * clk_obs4(gpio16/bit11), clk_obs5(gpio17/bit12)
     * clk_obs0(gpio1/bit19), 6(gpio11/bit20)
     */

(from u-boot/board/ar7240/ap121/ap121.c)

Thanks for the help, but that means I have to compile a new version to test it, right? BTW should I remove kmod-leds-gpio like Squidge-Project says?



I will also PM Jarocks to see if he can take closer photos on some points, and ask Squonk for his help since he has an MR11U.
If we can be sure that this is really free GPIOs this means very GPIOs to use!!!

The thing that really gets me about this board is that you cannot measure the level of battery. Though I'm thinking that vbatt and gnd could be used with a chip like this to measure the charge using i2c:

https://www.sparkfun.com/products/10617


I took some more photos and will upload a zip with all of them.

doiga wrote:

Thanks for the help, but that means I have to compile a new version to test it, right? BTW should I remove kmod-leds-gpio like Squidge-Project says?

Yes.
kmod-leds-gpio does not use these GPIOs, as they are not registered in the kernel firmware.

Jarocks wrote:

The thing that really gets me about this board is that you cannot measure the level of battery. Though I'm thinking that vbatt and gnd could be used with a chip like this to measure the charge using i2c:

https://www.sparkfun.com/products/10617


I took some more photos and will upload a zip with all of them.

I´d also questioned myself how could I know the level of battery (make a script or graph for OpenWRT/LuCI), and besides "VBATT" but there´s also "TEMP1", what means?

I will trace out the origin of them, should we ask TP-Link what these connections stand for???


Dioptimizer wrote:

Yes.
kmod-leds-gpio does not use these GPIOs, as they are not registered in the kernel firmware.

Ok, thanks!

I would venture to guess that TEMP1 would be the readout of the battery temperature, likely for TP-Link to test for any thermal issues. I have taken measurements of various test points on the board in both off and charging states.

Note: These results were each observed and measured over a consistent 2 minute time span, however, at different battery charge levels. Therefore the values of TEMP1 and VBATT vary greatly between each set of readings.

On (Unplugged)
  • PCB TP | Volts | Change (+/-)

  • VBATT | 4.05V | (-) -> 4.04V

  • TEMP1 | 1.61V | (-) -> 1.53V

  • TP1V2 | 1.257V | n/c

  • TP1V5 | 2.71V | n/c

  • TPDDR | 2.44V | n/c

On (Charging)
  • PCB TP | Volts | Change (+/-)

  • VBATT | 4.14V | (-) -> 4.16V

  • TEMP1 | 2.00V | (-) -> 1.97V

  • TP1V2 | 1.257V | n/c

  • TP1V5 | 2.71V | n/c

  • TPDDR | 2.44V | n/c

Off (Charging)
  • PCB TP | Volts | Change (+/-)

  • VBATT | 4.12V | (+) -> 4.15V

  • TEMP1 | 1.97V | (+) -> 2.00V
    -------------------------------------

  • TP1V2 | TP1V5 | TPDDR | 0V | n/c



Edit: Also here are the closeup photos of the board: http://d-h.st/77m, hope they help smile

(Last edited by Jarocks on 25 Feb 2013, 20:07)

Indeed, you are right. If you take a better look these "VBAT" and "TEMP1" are directly from the battery, from there "VBAT" goes to LED4 and K72 transistor (as supposed for power) bit confusing traces around them, and "TEMP1" goes to R154/R135 therefore U8 wich let me to: LTC4088 http://www.linear.com/product/LTC4088 but I´m not sure of this IC

Nice photos, I had already updated GPIOs with boostrap, LED, etc, thanks to Squonk explication...I will update all GPIOs soon as possible!

I will also try to mod to 8MB SPI FLASH! big_smile

Sucess!!! big_smile
All GPIOs have been traced, the latest updates are already in the wiki, and there are 3 free GPIOs!!!
Let´s say: 2 can be for I2C and the other for LED or button! smile
I wanna say thanks to everybody that helped me.

Next step is USB power (try to find the equivalent to R113 in WR703N) and External Antenna Hack!

For the external antenna hack, pretty simple: just remove the J1 jumper and solder RF cable to its pad closest to L15/C117, and the cable shield to the nearby round ground pad.

I've already ask in development center to make GPIO 14 and GPIO 15 controllable, but got no answer so far.
https://dev.openwrt.org/ticket/13090
Can any developer help me, please?

Have you tried:

echo 14 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio14/direction
echo 1 > /sys/class/gpio/gpio14/value
echo 0 > /sys/class/gpio/gpio14/value

For general use you probably want to unsolder the pulldown resistors.

Yes, I have.
The value is already 1, then I try:

echo 0 > /sys/class/gpio/gpio14/value

but doesn´t change, it keeps 1


for read the values I use

cat /sys/class/gpio/gpio14/value

Sounds like they are in use. Did you follow up on Dioptimizer's post on disabling clock obs to free 13-16?

robthebrew wrote:

Sounds like they are in use. Did you follow up on Dioptimizer's post on disabling clock obs to free 13-16?

I haven´t tried yet, cuz it requires to build a new firmware and reflash, wich I prefer to have shure that work's. But yes, i guess I have to try it.
BTW where can I find that ap121.c, seems to have changed location?

I´m looking for the ap121.c file that should enable control these GPIO, as yourself posted up here!

Can somebody help in gain control of GPIO 14 and GPIO15?


DEVELOPERS: Can you make a separate profile for MR3040, since MR11U is chinese only, the MR3040 doesn´t has WPS button and USP_POWER gpio is diferrent, please?

(Last edited by doiga on 2 Mar 2013, 21:15)

Nobody can help? Please I need help solving this.

I think this ap121.c file is located in the uboot sdk.

doiga
You can specify which GPIO's you can not control via /sys/class/gpio/gpioN ?

Dioptimizer wrote:

doiga
You can specify which GPIO's you can not control via /sys/class/gpio/gpioN ?

Is only GPIO14 and GPIO15.
Right now I compiling a new version (initramfs) with custom profile made by me only for MR3040, I will post updates soon.

After a deep investigation MR3040 and MR11U aren´t that similar, i will post differences on wiki.

Index: target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr11u.c
===================================================================
--- target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr11u.c    (revision 35839)
+++ target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr11u.c    (working copy)
@@ -12,7 +12,9 @@
 #include <linux/gpio.h>
 
 #include <asm/mach-ath79/ath79.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
 
+#include "common.h"
 #include "dev-eth.h"
 #include "dev-gpio-buttons.h"
 #include "dev-leds-gpio.h"
@@ -85,6 +87,10 @@
     u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
     u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
 
+    /* Disable hardware control LAN1 and LAN2 LEDs, enabling GPIO14 and GPIO15 */
+    ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
+                    AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN);
+
     /* disable PHY_SWAP and PHY_ADDR_SWAP bits */
     ath79_setup_ar933x_phy4_switch(false, false);
 

FIXED

(Last edited by Dioptimizer on 3 Mar 2013, 16:27)

Thanks!
I compiling right now with your fix, then I will post updates!

This is the custom profile I've made for TL-MR3040, is it OK for submit?

MANY THANKS!!! It works's now, I can contol them!

When I tried to compile with:

/* Disable clock obs */
clk_obs2(gpio14/bit9), clk_obs3(gpio15/bit10)

was giving error, don´t know why.


How about the TL-MR3040 single profile?

(Last edited by doiga on 3 Mar 2013, 20:16)