Adding OpenWrt support for TPLINK TL-WR841HP v2

do you test with same wireless region and settings. Moreover signal achievement depends on many factor like weather condition, router antenna position, wireless channel etc. I will post a new build, changing some wireless modules..

I did this comparison without touching the router or moving the router, (the router still remains in the same position)

I've checked again, and I'm also confused.
even though the settings are the same as the US country, and I set the maximum tx power to 3000mw
but the sensitivity level is different

use tx power 25 to 26dbm and report the changes

Some useless wireless modules has removed from the kernel. Check this build :

As I return to the original firmware, they help me is that with open wtr I do not have a good signal in client mode

i will try changing spi frequency. if found better result, i will update the build.

try this.
compiled via smartphone with KaliNetHunter & Openwrt 21 rc4

https://drive.google.com/folderview?id=1C8MLsYh-VDEdQ0TjCZlhkZ0yUekCWAgE

1 Like

wireless range is as powerful as stock firmware

after some query in forum, i found that every target in ar9344 has wireless range problem. Moreover when we flash wr841hp_v2 with wr842n_v2,(both have different gpio values), wireless range works as like stock firmware. @si_GILA can you make a build using ref frequency 40mhz in ar9341_tplink.dtsi,

I know this is OT but would anyone with the HP version of this router please take a picture or 2 of the wifi antenna after its opened up so we can see what it looks like? The HP version has taller antennas that are higher DB and I am wondering what the difference physically looks like.

yeah. i opened one of my 9dbi antenna. there is a 2 twisted pure thick copper wire inside the antenna. as this single band router there have only one aluminium core covering the root of the copper wire.

@si_GILA @Rafita07 , Finally low wifi range & performance problem has been fixed. Thanks should be given to openwrt developers in github.
Check this build -

1 Like

Congrats on your successful support this router.

1 Like

congrats, you finally made it.

I've also tried making a custom build of the 16mb version, and everything seems to be fine.

please correct if there is an error

[    0.000000] Linux version 5.4.137 (si_GILA@Kali-NetHunter) (gcc version 8.4.0 (OpenWrt GCC 8.4.0 r16256-2d5ee43dc6)) #0 Sat Jul 31 17:21:01 2021
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001974c (MIPS 74Kc)
[    0.000000] MIPS: machine is TP-Link TL-WR841HP v2
[    0.000000] SoC: Atheros AR9344 rev 2
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] On node 0 totalpages: 16384
[    0.000000]   Normal zone: 144 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 16384 pages, LIFO batch:3
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16240
[    0.000000] Kernel command line: console=ttyS0,115200 rootfstype=squashfs,jffs2
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes, linear)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 57152K/65536K available (4969K kernel code, 189K rwdata, 1136K rodata, 1184K init, 196K bss, 8384K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 51
[    0.000000] random: get_random_bytes called from start_kernel+0x358/0x54c with crng_init=0
[    0.000000] CPU clock: 560.000 MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6825930166 ns
[    0.000009] sched_clock: 32 bits at 280MHz, resolution 3ns, wraps every 7669584382ns
[    0.008707] Calibrating delay loop... 278.78 BogoMIPS (lpj=557568)
[    0.051569] pid_max: default: 32768 minimum: 301
[    0.056893] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.065068] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.079031] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.089952] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.097681] pinctrl core: initialized pinctrl subsystem
[    0.104700] NET: Registered protocol family 16
[    0.117560] GPIO line 18 (tp-link:ext:lna0) hogged as output/high
[    0.124421] GPIO line 19 (tp-link:ext:lna1) hogged as output/high
[    0.157389] workqueue: max_active 576 requested for napi_workq is out of range, clamping between 1 and 512
[    0.172099] clocksource: Switched to clocksource MIPS
[    0.179198] NET: Registered protocol family 2
[    0.184350] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.193169] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.202580] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.211150] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.219034] TCP: Hash tables configured (established 1024 bind 1024)
[    0.226281] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.233639] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.241805] NET: Registered protocol family 1
[    0.246753] PCI: CLS 0 bytes, default 32
[    0.255614] workingset: timestamp_bits=14 max_order=14 bucket_order=0
[    0.270970] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.277535] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.307586] pinctrl-single 1804002c.pinmux: 544 pins, size 68
[    0.315184] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.323174] printk: console [ttyS0] disabled
[    0.328057] 18020000.uart: ttyS0 at MMIO 0x18020000 (irq = 9, base_baud = 2500000) is a 16550A
[    0.337710] printk: console [ttyS0] enabled
[    0.346620] printk: bootconsole [early0] disabled
[    0.373357] spi-nor spi0.0: w25q128jv (16384 Kbytes)
[    0.378477] 3 fixed-partitions partitions found on MTD device spi0.0
[    0.384937] Creating 3 MTD partitions on "spi0.0":
[    0.389821] 0x000000000000-0x000000020000 : "u-boot"
[    0.396058] 0x000000020000-0x000000ff0000 : "firmware"
[    0.404730] 2 tplink-fw partitions found on MTD device firmware
[    0.410805] Creating 2 MTD partitions on "firmware":
[    0.415873] 0x000000000000-0x0000001f99f5 : "kernel"
[    0.422030] 0x0000001f99f8-0x000000fd0000 : "rootfs"
[    0.428190] mtd: device 3 (rootfs) set to be root filesystem
[    0.436009] 1 squashfs-split partitions found on MTD device rootfs
[    0.442374] 0x0000005a0000-0x000000fd0000 : "rootfs_data"
[    0.449015] 0x000000ff0000-0x000001000000 : "art"
[    0.457156] libphy: Fixed MDIO Bus: probed
[    0.483673] ag71xx 19000000.eth: invalid MAC address, using random address
[    0.805192] ag71xx 19000000.eth: Could not connect to PHY device. Deferring probe.
[    0.813366] ag71xx 1a000000.eth: invalid MAC address, using random address
[    1.184091] random: fast init done
[    1.452532] libphy: ag71xx_mdio: probed
[    1.457779] libphy: ar8xxx-mdio: probed
[    1.469600] switch0: Atheros AR8229 rev. 1 switch registered on mdio.0
[    1.513827] ag71xx 1a000000.eth: connected to PHY at fixed-0:00 [uid=00000000, driver=Generic PHY]
[    1.523693] eth0: Atheros AG71xx at 0xba000000, irq 5, mode: gmii
[    1.530162] i2c /dev entries driver
[    1.536915] NET: Registered protocol family 10
[    1.548262] Segment Routing with IPv6
[    1.552167] NET: Registered protocol family 17
[    1.556782] 8021q: 802.1Q VLAN Support v1.8
[    1.562554] ag71xx 19000000.eth: invalid MAC address, using random address
[    1.886019] ag71xx 19000000.eth: connected to PHY at mdio.0:1f:00 [uid=004dd042, driver=Generic PHY]
[    1.896453] eth1: Atheros AG71xx at 0xb9000000, irq 4, mode: mii
[    1.906258] squashfs: SQUASHFS error: Xattrs in filesystem, these will be ignored
[    1.913935] unable to read xattr id index table
[    1.920869] VFS: Mounted root (squashfs filesystem) readonly on device 31:3.
[    1.935037] Freeing unused kernel memory: 1184K
[    1.939672] This architecture does not have kernel memory protection.
[    1.946218] Run /sbin/init as init process
[    2.650515] init: Console is alive
[    2.654376] init: - watchdog -
[    4.033617] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    4.081979] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    4.099876] init: - preinit -
[    5.662035] random: jshn: uninitialized urandom read (4 bytes read)
[    6.000452] random: jshn: uninitialized urandom read (4 bytes read)
[    6.218811] random: jshn: uninitialized urandom read (4 bytes read)
[    7.233860] eth0: link up (1000Mbps/Full duplex)
[    7.244243] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[    7.256264] IPv6: ADDRCONF(NETDEV_CHANGE): eth0.1: link becomes ready
[    7.320438] urandom_read: 4 callbacks suppressed
[    7.320447] random: procd: uninitialized urandom read (4 bytes read)
[   11.661109] jffs2: notice: (513) jffs2_build_xattr_subsystem: complete building xattr subsystem, 14 of xdatum (13 unchecked, 1 orphan) and 18 of xref (1 dead, 0 orphan) found.
[   11.678766] mount_root: switching to jffs2 overlay
[   11.688573] overlayfs: upper fs does not support tmpfile.
[   11.706539] urandom-seed: Seeding with /etc/urandom.seed
[   11.840642] eth0: link down
[   11.870231] procd: - early -
[   11.873369] procd: - watchdog -
[   12.502925] procd: - watchdog -
[   12.531208] procd: - ubus -
[   12.619856] random: ubusd: uninitialized urandom read (4 bytes read)
[   12.629202] random: ubusd: uninitialized urandom read (4 bytes read)
[   12.640492] procd: - init -
[   13.879269] kmodloader: loading kernel modules from /etc/modules.d/*
[   13.955774] zram: Added device: zram0
[   14.105594] GACT probability on
[   14.113509] Mirror/redirect action on
[   14.149935] u32 classifier
[   14.152755]     input device check on
[   14.156498]     Actions configured
[   14.195534] Loading modules backported from Linux version v5.10.42-0-g65859eca4dff
[   14.203305] Backport generated by backports.git v5.10.42-1-0-gbee5c545
[   14.273372] urngd: v1.0.2 started.
[   14.343051] xt_time: kernel timezone is -0000
[   14.745100] random: crng init done
[   14.857303] PPP generic driver version 2.4.2
[   14.873598] NET: Registered protocol family 24
[   15.034409] ath: EEPROM regdomain sanitized
[   15.034421] ath: EEPROM regdomain: 0x64
[   15.034425] ath: EEPROM indicates we should expect a direct regpair map
[   15.034450] ath: Country alpha2 being used: 00
[   15.034454] ath: Regpair used: 0x64
[   15.048668] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[   15.051085] ieee80211 phy0: Atheros AR9340 Rev:2 mem=0xb8100000, irq=12
[   15.156635] kmodloader: done loading kernel modules from /etc/modules.d/*
[   19.253880] zram0: detected capacity change from 0 to 29360128
[   19.375503] Adding 28668k swap on /dev/zram0.  Priority:-2 extents:1 across:28668k SSDsc
[   32.873701] eth0: link up (1000Mbps/Full duplex)
[   32.892203] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   32.900072] br-lan: port 1(eth0.1) entered blocking state
[   32.905647] br-lan: port 1(eth0.1) entered disabled state
[   32.911669] device eth0.1 entered promiscuous mode
[   32.916598] device eth0 entered promiscuous mode
[   32.945575] br-lan: port 1(eth0.1) entered blocking state
[   32.951123] br-lan: port 1(eth0.1) entered forwarding state
[   33.884190] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   35.422215] eth1: link up (100Mbps/Full duplex)
[   35.454350] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[   37.755400] ath: EEPROM regdomain: 0x8348
[   37.755409] ath: EEPROM indicates we should expect a country code
[   37.755418] ath: doing EEPROM country->regdmn map search
[   37.755426] ath: country maps to regdmn code: 0x3a
[   37.755433] ath: Country alpha2 being used: US
[   37.755437] ath: Regpair used: 0x3a
[   37.755446] ath: regdomain 0x8348 dynamically updated by user
[   41.805882] br-lan: port 2(wlan0) entered blocking state
[   41.811350] br-lan: port 2(wlan0) entered disabled state
[   41.817164] device wlan0 entered promiscuous mode
[   41.923445] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[   41.930219] br-lan: port 2(wlan0) entered blocking state
[   41.935677] br-lan: port 2(wlan0) entered forwarding state

dts file

&spi {
	status = "okay";

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

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

			uboot: partition@0 {
				label = "u-boot";
				reg = <0x000000 0x020000>;
				read-only;
			};

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

			art: partition@7f0000 {
				label = "art";
				reg = <0xff0000 0x010000>;
				read-only;
			};
		};
	};
};

1 Like

Incorrect. From firmware partition: 20000+fd0000=ff0000

Thanks, looks like I missed something.
maybe it should be like this?

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

			art: partition@ff0000 {
				label = "art";
				reg = <0xff0000 0x010000>;
				read-only;

Yep, corrected.

I found the wireless mac address does not match.
02:03:04:05:06

I've read this thread https://openwrt.org/docs/guide-developer/mac.address
but don't really understand

**
If there is an ART partition, WiFi MAC addresses are frequently/typically stored there.

ath79:

  • All TP-LINK routers using old tp-link header (those using Device/tplink-Xm or Device/tplink-Xmlzma templates defined in target/linux/ath79/image/common-tplink.mk), store only one mac address in <&uboot 0x1fc00>, which is the label mac address.

**

please help me which part should i change?


aliases {

		label-mac-device = &wmac;
	};

&wmac {
	status = "okay";
	
	mtd-cal-data = <&art 0x1000>;
	
	nvmem-cells = <&macaddr_uboot_1fc00>;
	nvmem-cell-names = "mac-address";
};

&eth0 {
	status = "okay";

	phy-handle = <&swphy0>;

	nvmem-cells = <&macaddr_uboot_1fc00>;
	nvmem-cell-names = "mac-address";
	mac-address-increment = <1>;

};

&eth1 {
	status = "okay";

	phy-handle = <&swphy4>;

	nvmem-cells = <&macaddr_uboot_1fc00>;
	nvmem-cell-names = "mac-address";
	
	gmac-config {
		device = <&gmac>;
		switch-phy-swap = <1>;
	};
};

&uboot {
	compatible = "nvmem-cells";
	#address-cells = <1>;
	#size-cells = <1>;

	macaddr_uboot_1fc00: macaddr@1fc00 {
		reg = <0x1fc00 0x6>;
	};
};

you misplaced the art partition, so it got corrupted, you need to restore art partition from the backup.
from the bootlog above, i see the missing mac address due to art part destroyed.

ag71xx 19000000.eth: invalid MAC address, using random address
ag71xx 19000000.eth: Could not connect to PHY device. Deferring probe.
ag71xx 1a000000.eth: invalid MAC address, using random address

Do you get 30dbm tx power? then art part is okay. you need to do take care of uboot. can you provide uboot log?
In this device mac address are stored in u-boot partition.
to use custom u-boot, you need to cut mac-part from stock u-boot and merge it with custom u-boot. check the src..

may be you damage your uboot. do you have backup of stock uboot?