Port to TP-Link RE200

Create a patch / Pull Request to get your modifications into OpenWrt master.

Once RE200 v3 support has been added, it will appear on the RE200 devicepage shortly after.

OK , I need to figure GPIO mapping for RE200-v3 since is not 100% matching v2 (besides the missing 2nd red led). Then I will patch/pull

Could you please give the steps you followed to create that modified openwrt-ramips-mt76x8-tplink_re200-v2-squashfs-factory.bin? Either as a message here or at the wiki. I don't really mind the LEDs and I would like to set mine up ASAP. Thank you!

Sorry for long post..

(1): patch for tplink-safeloader.c: (src is on https://github.com/lede-project/source/master/tools/firmware-utils/src/)


--- tplink-safeloader.c 2020-03-17 12:45:34.557111063 -0400
+++ tplink-safeloader.c.new     2020-03-13 14:19:01.103578167 -0400
@@ -1479,6 +1479,51 @@
                .last_sysupgrade_partition = "file-system"
        },
 
+  /** Firmware layout for the RE200 v3 */
+       {
+               .id     = "RE200-V3",
+               .vendor = "",
+               .support_list =
+                       "SupportList:\n"
+         "{product_name:RE200,product_ver:3.0.0,special_id:00000000}\n"
+         "{product_name:RE200,product_ver:3.0.0,special_id:45550000}\n"
+         "{product_name:RE200,product_ver:3.0.0,special_id:4A500000}\n"
+         "{product_name:RE200,product_ver:3.0.0,special_id:4B520000}\n"
+         "{product_name:RE200,product_ver:3.0.0,special_id:43410000}\n"
+         "{product_name:RE200,product_ver:3.0.0,special_id:41550000}\n"
+         "{product_name:RE200,product_ver:3.0.0,special_id:42520000}\n"
+         "{product_name:RE200,product_ver:3.0.0,special_id:55530000}\n"
+         "{product_name:RE200,product_ver:3.0.0,special_id:41520000}\n"
+         "{product_name:RE200,product_ver:3.0.0,special_id:52550000}\n"
+         "{product_name:RE200,product_ver:3.0.0,special_id:54570000}\n"
+         "{product_name:RE200,product_ver:3.0.0,special_id:45530000}\n"
+         "{product_name:RE200,product_ver:3.0.0,special_id:49440000}\n"
+         "{product_name:RE200,product_ver:3.0.0,special_id:45470000}\n",
+
+               .support_trail = '\x00',
+               .soft_ver = NULL,
+
+               .partitions = {
+                       {"fs-uboot", 0x00000, 0x20000},
+                       {"firmware", 0x20000, 0x7a0000},
+                       {"partition-table", 0x7c0000, 0x02000},
+                       {"default-mac", 0x7c2000, 0x00020},
+                       {"pin", 0x7c2100, 0x00020},
+                       {"product-info", 0x7c3100, 0x01000},
+                       {"soft-version", 0x7c4200, 0x01000},
+                       {"support-list", 0x7c5200, 0x01000},
+                       {"profile", 0x7c6200, 0x08000},
+                       {"config-info", 0x7ce200, 0x00400},
+                       {"user-config", 0x7d0000, 0x10000},
+                       {"default-config", 0x7e0000, 0x10000},
+                       {"radio", 0x7f0000, 0x10000},
+                       {NULL, 0, 0}
+               },
+
+               .first_sysupgrade_partition = "os-image",
+               .last_sysupgrade_partition = "file-system"
+       },
+
   /** Firmware layout for the RE305 v1 */
        {
                .id     = "RE305-V1",

(2): compile: cc -o tplink-safeloader tplink-safeloader.c md5.c -Wall --std=gnu99
(3): unpack the v2 firmware : ./tplink-safeloader -x openwrt-ramips-mt76x8-tplink_re200-v2-squashfs-factory.bin -d openwrt-ramips-mt76x8-tplink_re200-v2-squashfs-factory-unpack
(4): pack v3 ../tplink-safeloader -B RE200-V3 -k os-image -r file-system -o ../openwrt-ramips-mt76x8-tplink_re200-v3-squashfs-factory-testcgm.bin

It worked for me, if is failing to boot you might need to crack it open and use serial interface..

2 Likes

It worked perfectly, you are a savior! I had all kinds of weird ethernet issues in my home network, and after much trial and error I found out they were gone if I disconnected this device. Now, thanks to openwrt I can use it again, this time with no mysterious network disruption.
After flashing the firmware through the web UI I had to manually configure an internet connection through SSH (editing /etc/config/network), then install LuCI and finally configure the wifi. Took some effort but it paid off in the end!

Hello there! Is the snapshot build at least a little stable/safe for daily use? I only have access to internet due to my RE200v2, but it is having lots of issues, forcing me to go "remove-reinsert" the gadget at the power plug, or restarting via web interface, one time a day or more (usually more). Frequently, I can't even connect to my device via web interface. I want to try OpenWRT to see if the firmware problems go away.
Thanks in advance!

If you haven't figured it out yet, this is/was my config for the v3 (the buttons are not correct though, jus the LEDs):

/dts-v1/;

#include "mt7628an.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
        compatible = "tplink,re200-v3", "mediatek,mt7628an-soc";
        model = "TP-Link RE200 v3";

        aliases {
                led-boot = &led_power;
                led-failsafe = &led_power;
                led-running = &led_power;
                led-upgrade = &led_power;
        };

        chosen {
                bootargs = "console=ttyS0,57600n8";
        };

        leds {
                compatible = "gpio-leds";

                wps {
                        label = "re200-v3:green:wps";
                        gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
                };

                wlan {
                        label = "re200-v3:green:wlan";
                        gpios = <&gpio0 4 GPIO_ACTIVE_LOW>;
                };

                led_power: power {
                    label = "re200-v3:green:power";
                    gpios = <&gpio1 11 GPIO_ACTIVE_LOW>;
                };

                lan {
                        label = "re200-v3:green:lan";
                        gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
                };

                wlan24g {
                        label = "re200-v3:green:wlan24g";
                        gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
                };

                wlan5g {
                        label = "re200-v3:green:wlan5g";
                        gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
                };

                wlanred {
                        label = "re200-v3:red:wlan";
                        gpios = <&gpio1 8 GPIO_ACTIVE_LOW>;
                };

        };

        keys {
                compatible = "gpio-keys";

                reset {
                        label = "reset";
                        gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
                        linux,code = <KEY_RESTART>;
                };

                wps {
                        label = "wps";
                        gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
                        linux,code = <KEY_WPS_BUTTON>;
                };
        };
};


&pinctrl {
        state_default: pinctrl0 {
                gpio {
                        ralink,group = "p4led_an", "p3led_an", "p2led_an", "p1led_an", "p0led_an", "perst", "refclk", "wdt", "wled_an", "i2c";
                        ralink,function = "gpio";
                };
        };
};

&spi0 {
        status = "okay";

        m25p80@0 {
                compatible = "jedec,spi-nor";
                reg = <0>;
                spi-max-frequency = <10000000>;

                partitions {
                        compatible = "fixed-partitions";
                        #address-cells = <1>;
                        #size-cells = <1>;

                        partition@0 {
                                label = "u-boot";
                                reg = <0x0 0x20000>;
                                read-only;
                        };

                        partition@20000 {
                                compatible = "tplink,firmware";
                                label = "firmware";
                                reg = <0x20000 0x7c0000>;
                        };

                        userconfig: partition@7e0000 {
                                label = "userconfig";
                                reg = <0x7e0000 0x10000>;
                                read-only;
                        };

                        factory: partition@7f0000 {
                                label = "factory";
                                reg = <0x7f0000 0x10000>;
                                read-only;
                        };
                };
        };
};

&gpio0 {
    status = "okay";
};

&gpio1 {
        status = "okay";
};

&gpio2 {
        status = "okay";
};

&ethernet {
        mtd-mac-address = <&userconfig 0x0158>;
};

&wmac {
        status = "okay";
        ralink,mtd-eeprom = <&factory 0>;
        mtd-mac-address = <&userconfig 0x0160>;
};

&pcie {
        status = "okay";
};

&pcie0 {
        mt76@0,0 {
                reg = <0x0000 0 0 0 0>;
                mediatek,mtd-eeprom = <&factory 0x8000>;
                mtd-mac-address = <&userconfig 0x0160>;
                mtd-mac-address-increment = <1>;
        };
};

Heya.

Followed @andyboeh guide to make an image with his tool and flash via web interface.
Flash went ok it seams, but after boot I have no way to access the device. There is no SSID broadcasting and I default ip does not work via ethernet cable.
Did i do something wrong?

Device is a RE200 v1 (EU)

Please give us a bit more information:

  1. Did you read the Wiki on Snapshot builds?
  2. The default IP is 192.168.1.1 and the device runs a DHCP server. Is an IP address assigned to your computer?
  3. There is no web interface in snapshot builds and WiFi is disabled by default.
  1. First thing i read.
  2. Tried both options. If i set the computer to DHCP I don't receive any IP. If i set the computer to static in the 192.168.1.x subnet, I cannot ping/telnet/ssh 192.168.1.1
  3. That I knew from the wiki. I was hoping wifi is somehow enabled on this.

Power and eth LEDs are steady green.

Power and LAN LEDs should not stay steady green. During boot up, power goes out, blinks rapidly to indicate failsafe and then blinks slowly during boot. Afterwards, power is steady green.

I meant it's steady green after boot.
Otherwise, it is exactly how you described: blinks rapidly, then slowly then goes steady.

Then it's alive and the flash went fine (at least)! Did you try failsafe? Different LAN cable?
Snapshot builds might be unstable, so it's as well possible that LAN doesn't work.

Sorry that I can't be of more help here, my devices are now all under regular use and I can't update them right now.

I can confirm that the latest snapshot build does not work properly on the RE200 v1 (and probably also the v2 and the RE210). The problem is caused by an indirectly related commit (https://github.com/openwrt/openwrt/commit/a8d62a4eb1ce53beb901b212ce7e474eb70341ca). I'm working on a fix and I will create a PR soon. Until then, do not flash a snapshot build as you will get a bricked device.

If that has already happened, I'm afraid, you have to open your device and attach a serial console.

1 Like

My hardware version is: v4.0 (RE200 v4.0) and firmware version is 1.0.4 Build 20191104 Rel. 69112.

  1. Can I just do manual image preparation with v4 firmware or automatic image preparation with v1 image? (Your program won't let me use v4 firmware).

  2. Which openwrt variant do I need to choose, v1 or v2?

It's the first time I hear about a v4 - I don't know which hardware is inside, so that's the first thing you'll have to figure out.

Then I will open it, do you have any tips how to open it?

I had the best success using a vice. However, you might get a lot of clues from the vendor's GPL code (if available).

A PR with a fix is now available at https://github.com/openwrt/openwrt/pull/2909. One or two days after resolving/merging this issue, the snapshot builds should be fine again.

1 Like

I can confirm that v4 contains mt7628an. If you want photos of the motherboard, I can send them