Support for TL-WR840N Ver 6.0

@sanitariu mate i will be highly oblized if you could provide me a sysupgrade img without TFTP for WR840N(EU) v6.2 (updatable with tp link admin page) .
Use of router is only for internet surfing and i use ethernet as my internet wire with PPPoE.
i would have done it myself but i dont have enough knowledge with linux commands.
thanks alot in advance

Is there a stable version with correctly working Wi-Fi and LED indicators ?! Thanks.

Anyone has problems like this ?:
make[3]: *** No rule to make target '/build_dir/target-mipsel_24kc_musl/linux-ram ips_mt76x8/tl-wr840n-v6-kernel.bin', needed by 'imgbuilderWRT/openwrt-imagebuilder-18.06.4-ramips-mt76x8.Linux-x86_64/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/tmp/openwrt-18.06.4-ramips-mt76x8-tl-wr840n-v6-squashfs-sysupgrade.bin'. Stop

or share working imagebuilder

Hi all. I have faced with a problem when i used iptables -t mangle... TTL --ttl-inc 1 command. The output was like there is no such a command like ttl. How to fix ttl in another way or how to make iptables work with ttl. I have read somewhere,that i have to install iptables-mod-ipopt and another one packet,but because this is the unofficial firmware i doubt that it might not get installed.

Hi,
I ported the necessary changes for current git version https://www.dropbox.com/s/uy3ayj0rk462v1x/tp-link-wr840nv6.patch?dl=0

1 Like

I used these patches for custom build. The image built I can flash to 849n-v6 (Brazil) in TFTP only; sysupgrade does not work . Any idea ?

does anyone have a backup file for ROM wr840n v6?

can you tell me how to build tplink wr840n.v6.20 openwrt

Some space improvement here:
partition@10000 {
compatible = "tplink,firmware";
label = "firmware";
reg = <0x10000 0x3e0000>;
};
Also here:
led_power_orange: wifi {
label = "tl-wr840n-v6:orange:wifi";
gpios = <&gpio1 11 GPIO_ACTIVE_LOW>;
};
and here:

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

Still we have very low txpower. Problem is not fixed ! Same happens on version 6.1,6.2 and version 14.
Eeprom is read correctly but TXPOWER is not set ! Even default 20db is not set which make the router work very bad in the next room.
Maybe its something easy for nbd. I hope he will take a look at it finally.

Also router have enough space even for luci and ipv6. Working like a charm except the power.
I will make public images for all versions and code when there is a fix for that power.

hi @sanitariu

i tried to build from latest git and put on wr840n v6.20 and have similar problem like you
everything works, except WiFi
but my problem is not only with TX power, as i see, RX is almost blind
only few of dozen AP are shown in scan
do you have same situation with your build?

Hi,
No i do not have these problems. Actually i think txpower may be fine now. I modified a little dts file. Needs more testing but so far everything seems ok ! Even the leds are working as i wanted them.

Ok, i am glad that someone have a success with v6.xx
Is there any chance to share your image? i like to test WiFi.
Maybe my device is broken :slight_smile:
tnx in advance

Ok here it is for version 6.0. Everything working ok for now.
https://easyupload.io/4en71r - mt7628an_tplink_tl-wr840n-v6.dts file
https://easyupload.io/qo7t21 - 02_network file
https://easyupload.io/uk8o0w - mt76x8.mk file
Just put them to the right location and make menuconfig.
Select your TP-Link 840 version 6 and compile.
For 6.1,6.2 i will do maybe later.
You can add luci and other packages but you must optimize kernel and other stuff so you can have at least 3 blocks free.
Also for the latest git i suggest you edit these files:
build_dir/toolchain-mipsel_24kc_gcc-8.3.0_musl/linux-4.14.162/fs/jffs2/fs.c
build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/linux-4.14.162/fs/jffs2/fs.c
And lower jffs requirements for 5 blocks free. I do not know why it wants so much ?!
3 block is enough for me and for you !!!

if (c->flash_size < 3*c->sector_size) {
                pr_err("Too few erase blocks (%d)\n",
                       c->flash_size / c->sector_size);
                return -EINVAL;
        }

Everything seems to work now luci+ipv6 and even adblocker for luci :slight_smile:And still have 100K free space for config to be saved after restarts !

2 Likes

hello i'm new to all this and i don't understand most of the things here, i'm looking for a wr840v6 firware and the only way i know how to install on the router is with a bin file, do you have the image file for that router? I used one that was having problems with wifi and leds.
thanks

can you upload all needed file again, it's not found.

and how about v6.20 ?

thank you.

For which version you need ? Also can i remove ipv6 if you do not need it ?

it's
https://easyupload.io/4en71r - mt7628an_tplink_tl-wr840n-v6.dts file
https://easyupload.io/qo7t21 - 02_network file
https://easyupload.io/uk8o0w - mt76x8.mk file

all not found, i want to compile it.

and try to fit it on v6.20

thank you.

Ok

  1. ./target/linux/ramips/image/mt76x8.mk - add
define Device/tplink_tl-wr840n-v6.2
  $(Device/tplink)
  SOC := mt7628an
  IMAGE_SIZE := 3968k
  DEVICE_VENDOR := TP-Link
  DEVICE_MODEL := TL-WR840N
  DEVICE_VARIANT := v6.2
  TPLINK_FLASHLAYOUT := 4Mmtk
  TPLINK_HWID := 0x08400006
  TPLINK_HWREV := 0x1
  TPLINK_HWREVADD := 0x7
  TPLINK_HVERSION := 3
  SUPPORTED_DEVICES += tl-wr840n-v6.2
  IMAGE/tftp-recovery.bin := pad-extra 64k | $$(IMAGE/factory.bin)
endef
TARGET_DEVICES += tplink_tl-wr840n-v6.2
  1. target/linux/ramips/mt76x8/base-files/etc/board.d/02_network - add
    tplink,tl-wr840n-v6.2|\
    After - tplink,tl-wr840n-v5|\ There are two places !

  2. ./target/linux/ramips/dts/mt7628an_tplink_tl-wr840n-v6.2.dts

/dts-v1/;

#include "mt7628an.dtsi"

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

/ {
	compatible = "tplink,tl-wr840n-v6.2", "mediatek,mt7628an-soc";
	model = "TP-Link TL-WR840N v6.2";

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

	chosen {
		bootargs = "console=ttyS0,115200";
	};

	keys {
		compatible = "gpio-keys";

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

	/* LED used is dual-color,dual lead LED */
	leds {
		compatible = "gpio-leds";

		lan {
			label = "tl-wr840n-v6.2:green:lan";
			gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
		};

		wlan {
			label = "tl-wr840n-v6.2:green:wlan";
			gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
		};

		led_power_green: power {
			label = "tl-wr840n-v6.2:green:power";
			gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
		};

		led_power_orange: wan {
			label = "tl-wr840n-v6.2:orange:wan";
			gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
		};


	};
};

&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 = "boot";
				reg = <0x0 0x10000>;
				read-only;
			};

			partition@10000 {
				compatible = "tplink,firmware";
				label = "firmware";
				reg = <0x10000 0x3e0000>;
			};

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

&ehci {
	status = "disabled";
};

&ohci {
	status = "disabled";
};

&wmac {
	status = "okay";
	mtd-mac-address = <&factory 0xf100>;
};

&ethernet {
	mtd-mac-address = <&factory 0xf100>;
	mediatek,portmap = "wllll";
};



&state_default {
	gpio {
		ralink,group = "p1led_an", "p3led_an", "p4led_an", "wled_an", "perst";
		ralink,function = "gpio";
	};
};

Note that i did red flashing during restarts and when you flash the device. When device led turns to green it means OS is loaded and operational.

If you need more space do not forget to edit:
build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/linux-4.14.169/fs/jffs2/fs.c
and change 5 blocks to 3 free blocks.
if (c->flash_size < 3*c->sector_size)
If you want luci + ipv6 you may need to remove debugging and cut off some stuff from busybox which you do not need.

4 Likes

Nice, thankyou so much.
All just fine.

1 Like