Table of Contents

TP-Link TL-WR842ND

This is a very similar device to the TL-WR841ND but with:

Supported Versions

Also TL-WR842N(EU) (HW Ver 3.1) is supported (see below)

Unsupported TL-WR842N chinese-only version

Version/Model Release Date OpenWrt Version Supported Model Specific Notes
V1 - V4 2013 probably unsupportable only 2M flash? http://www.tp-link.com.cn/product_298.html
V8.0 ? probably unsupportable Only 2M flash (25q16cs1g). SOC Qualcomm Atheros QCA9535. No USB

Downloads

TL-WR842N(EU) (HW Ver 3.1)

Firmware available now on trunk (Radio doesn't work at july 18 2016Everything seems to work): https://downloads.openwrt.org/snapshots/trunk/ar71xx/generic/openwrt-ar71xx-generic-tl-wr842n-v3-squashfs-factory.bin

Working firmware for TL-WR842N(EU) (I succesfully flashed on HW v3.1 using stock web UI the factory .bin file):

Tested, works ok:

http://dl.eko.one.pl/chaos_calmer/ar71xx/openwrt-15.05-ar71xx-generic-tl-wr842n-v3-squashfs-factory.bin

http://dl.eko.one.pl/chaos_calmer/ar71xx/openwrt-15.05-ar71xx-generic-tl-wr842n-v3-squashfs-sysupgrade.bin

Bigger image, with luci, works ok:

http://dl.eko.one.pl/luci/chaos_calmer/ar71xx/luci-15.05-ar71xx-generic-tl-wr842n-v3-squashfs-factory.bin

http://dl.eko.one.pl/luci/chaos_calmer/ar71xx/luci-15.05-ar71xx-generic-tl-wr842n-v3-squashfs-sysupgrade.bin

Back to stock firmware (without bootloader, not tested): http://tplink-forum.pl/applications/core/interface/file/attachment.php?id=2291

Possible Main Thread about this model (Seems Very Good HW v3.1, 16MB Flash 64Mb DDR2 RAM): https://forum.openwrt.org/viewtopic.php?id=64526

Hardware

Info

Model TL-WR842ND TL-WR842N(EU)
Version v1 v2 v3
Architecture: MIPS 24Kc V7.4 MIPS 74Kc V4.12 MIPS 24Kc
Manufacturer: Atheros Qualcomm Atheros
Bootloader: U-Boot
System-On-Chip: Atheros AR7241 Atheros AR9341 Qualcomm Atheros QCA9531-BL3A
CPU Speed: 400 MHz 535 MHz 650 MHz
Flash chip: Spansion S25FL064P (FL064PIF) Winbond 25Q64FV or Spansion S25FL064 Winbond 25Q128CS16
Flash size: 8 MiB 16 MiB
RAM chip: A3S56D40FTP -G5 Winbond W9425G6JH-5 Zentel A3R12E40CBF-8E
RAM size: 32 MiB 64 MiB
Wireless Atheros AR9287-bl1a Atheros AR9341 Qualcomm Atheros QCA9531
Antenae(s) 2 removables 2 non-removable
Ethernet: 4 LAN, 1 WAN 10/100
USB: 1 x 2.0
Serial: Yes ?

LAN-port mapping

This is only tested on a V2 device.

Note: On (EU) version seems to be 1-4, 2-3, 3-2, 4-1, best check before connecting a cable and using cable detection (on luci>network>switch).

chassis port internal-port
WAN (blue) CPU: eth0
1 (yellow) Switch eth1; Port 2
2 (yellow) Switch eth1; Port 3
3 (yellow) Switch eth1; Port 4
4 (yellow) Switch eth1; Port 1

Note: the default lan interace (VLAN 1) is preconfigured to use eth0 physical interface (cpu untagged in switch configuration). If you want to use more than one VLAN connected to CPU, then CPU port must be tagged. In this case you need to change lan interface from eth0 to eth0.1 (for VLAN id = 1). If using luci, remember to do both changes (switch and lan) before applying any of them.

Flash Layout

Please read the article Flash.Layout for a better understanding. It contains a couple of explanations. Then let's have a quick view at flash layout of this particular device:

TP-Link WR842ND Visual Flash Layout OpenWrt 12.09
Offset 0 128 1071 2944 8128
x64KiB Blocks 2 14. … 29. … 81 1
TP-Link WR842ND Flash Layout OpenWrt 12.09
Layer0 m25p80 spi0.0: s25sl064a 8192KiB
Layer1 mtd0 u-boot 128KiB mtd5 firmware 8000KiB mtd4 art 64KiB
Layer2 mtd1 kernel 943KiB mtd2 rootfs 7057KiB
mountpoint /
filesystem mini_fo
Layer3 mtd3 rootfs_data 5184KiB
Size in KiB 128KiB 943KiB 1873KiB 5184KiB 64KiB
Name u-boot kernel rootfs_data art
mountpoint none none /rom /overlay none
filesystem none none SquashFS JFFS2 none

ART = Atheros Radio Test - it contains mac addresses and calibration data for the wifi (EEPROM). If it is missing or corrupt, ath9k won't come up anymore.

Here is a LibreOffice Calc ODS for better understanding: http://ubuntuone.com/5eT1OJweXjF6aa3lMciaLw .

GPIOs

port.GPIO The AR9341 v3 platform used in the TL-WR842ND provides 23 GPIOs. Some of them are used by the router for status LEDs, buttons and to communicate with the RTL8366RB. The table below shows the results of some investigation:

GPIO Common Name Usage
4 USB Power set to 0 to turn off the usb port, 1 to turn on

Photos

Opening the Case

Loosen the screws under the two rubber foots at the back of the device before (forcefully) pulling the upper and lower shelfs apart.

TP-Link TL-WR842N back of case

Serial connector

WR842ND-V1-serialTP-Link TL-WR842N Serial Connector
TL-WR842ND v1.0 Serial-InterfaceTL-WR842ND v2.1 Serial-Interface

Serial

Pinout
1 2 3 4 V1 V2.1
TXRXGNDVCCSJ1JP1

Pin 1 is clearly marked on the board.

To get the serial connection work reliably, you may have to connect a 10k pullup resistor between the TX and the 3.3V pin (same problem as described in TL-MR3420). For some users the V2.1 models did not need this pullup resistor.

The TX pin is connected via a 10k resistor to ground and via a 100nF capacitor to the serial output of the SoC. This gives a 2.5Vpp swing centered on ground. While this may work with some serial adapters, it is on the low side for most. An advantage of this connection scheme is that it protects the serial output to some degree.

The right settings for accessing the serial console are as follows:

Bits per second: 115200
Data bits: 8
Stop bits: 1
Parity: None
Flow control: None

Password to get into uboot prompt is tpl
Password to get root login is 5up

Recovery (v1)

Using the integrated tftp capability of the router.

First, enter failsafe mode:

Remove the power plug from the router.
Press and hold the WPS/RESET button.
Insert the power plug without releasing the RESET button, wait a moment for the USB LED to begin to blink.
Release the RESET button

No LED besides the one for USB (and maybe for attached ethernet ports) should be lit.

The device now uses the IP 192.168.1.86. It repeatedly tries to download a file named: wr842ndv1_tp_recovery.bin from a tftpd server with the IP 192.168.1.66.

The following steps will serve an openwrt fimrware image to the device:

Download an appropriate firmware file from TP-LINK site.
You might need a "stripped" firmware version (without "boot" in the name). See bottom of this page for details and a download link.
Rename the file, so it matches the name required by the router: wr842ndv1_tp_recovery.bin

Configure your PC lan adapter ip address to IP 192.168.1.66 and connect your computer to one of the LAN ports of the router.

Install a tftp server, for windows you can download one from http://tftpd32.jounin.net/

Run the tftp server and browse for the directory that contains the above firmware image. If necesary allow the connection of the server through your PCs firewall, once configured, shutdown the tftp server program, you will launch it again later.

If you connect your pc directly to a lan port on the router, be sure to put the router into failsafe mode FIRST (press reset button and plug power cable release reset button after 3 second), and then launch the tftp server, otherwise it might have problems trying to bind to the PC network interface.

Right after you launch the tftp server, a couple of blank messages will appear into the log window of the tftp server, this is normal, the third or fourth message will indicate that the process of file transfer is in progress.

After some time you will see all LEDs flashing once followed by a normal restart of the router

Now you can install the openwrt factory image of your liking, via the vendor firmware upgrade web page of the router.

You could try to flash directly using this method, an openwrt factory image (for this model obviously) to the router, for me it did not work, maybe you have better luck.

Recovery (v2)

Using the integrated tftp capability of the router.

First, enter failsafe mode:
I have a question here, why enter failsafe mode, if you are going Failsafe thats another route, all you have to do is whats next here is a example too http://forum.tp-link.com/showthread.php?81462-How-to-recovery-the-router-when-you-bricked-it

Remove the power plug from the router.
Press and hold the WPS/RESET button.
Insert the power plug without releasing the WPS/RESET button, wait a moment for the Lock LED to come on solid.
Release the WPS/RESET button

Connect pc to one of the router LAN ports.

Device IP
router ip192.168.0.86
set your pc ip192.168.0.66

Set pc ip:

ifconfig eth0:1 192.168.0.66/24 up

Router repeatedly tries to download wr842nv2_tp_recovery.bin from a tftpd server running on 192.168.0.66.

Install tftpd server:

pacman -S tftp-hpa

Download TP-LINK firmware to tftp root and rename it to wr842nv2_tp_recovery.bin:

mkdir /srv/tftpd
cd /srv/tftpd
wget http://www.tp-link.com/resources/software/TL-WR842ND_V2_130628.zip
unzip TL-WR842ND_V2_*.zip
mv wr842ndv2_en_3_14_2_up_boot(130628).bin wr842nv2_tp_recovery.bin

You might need a "stripped" firmware version (without "boot" in the name). See below for details and a download link.

Start tftpd server:

systemctl start tftpd.socket
systemctl start tftpd.service

Router must be in recovery mode before starting tftpd server, otherwise it might have problems trying to bind to the PC network interface.

After some time you will see all LEDs flashing once followed by a normal restart of the router.

Unbrick WR842ND V2.x

Once you are connected via serial cable to router you will see this prompt

wasp>

Then type "printenv" to see environment variables:

wasp> printenv  
bootargs=console=ttyS0,115200 root=31:02 rootfstype=squashfs init=/sbin/init mtdparts=ath-nor0:128k(u-boot),1024k(kernel),6912k(rootfs),64k(config),64k(art)
bootcmd=bootm 0x9f020000
bootdelay=1
baudrate=115200
ethaddr=0xba:0xbe:0xfa:0xce:0x08:0x41
ipaddr=192.168.1.111
serverip=192.168.1.100
dir=
bc=ap123
lu=tftp 0x81000000 ${dir}u-boot.bin&&erase 0x9f000000 +$filesize;cp.b $fileaddr 0x9f000000 $filesize
lf=tftp 0x81000000 ${dir}${bc}-squashfs&&erase 0x9f120000 +$filesize;cp.b $fileaddr 0x9f120000 $filesize
stdin=serial
stdout=serial
stderr=serial
ethact=eth0

wasp> setenv serverip <TFTP server IP>
wasp> setenv ipaddr <Temp IP address on my network>
wasp> tftpboot 0x80000000 openwrt-15.05-ar71xx-generic-tl-wr842n-v2-squashfs-factory.bin
done
Bytes transferred = 8126464 (7c0000 hex)

Note the hex value in brackets - "(7c0000 hex)". If you get different value use your value in lines below, otherwise you may irreversibly brick your device.

wasp> erase 0x9f020000 +0x7c0000
wasp> cp.b 0x80000000 0x9f020000 0x7c0000
wasp> bootm 0x9f020000

Back to stock firmware

generic.uninstall

Warning!
This section describes actions that might damage your device or firmware. Proceed with care!

With the TL-WR842ND router, there is a catch: the stock firmware is obtained from the OEM: http://www.tplink.com/en/support/download/?model=TL-WR842ND

The following method applies for the V1, V2 and V3(EU) since the bootloader is the same size.

An example of an image file with the word "boot" in it is wr842ndv1_en_3_12_25_up_boot(130322).bin.

Cut the first 0x20200 (that is 131,584 = 257*512) Bytes from original firmware:

dd if=orig.bin of=tplink.bin skip=257 bs=512

You should transfer the firmeware image to the /tmp folder and revert back to original firmware (if availlable you can flash the firmware via the webinterface as well):

Via the safer method using sysupgrade:

sysupgrade /tmp/tplink.bin

Or you use the mtd method:

mtd -r write /tmp/tplink.bin firmware

It is also possible to revert to the stock firmware using the method with tftp described in "recovery". (you still need the firmware image without the boot part).

OEM TP-Link firmware for the TL-WR842ND with the boot part removed to revert to the original OEM firmware:

Power

General

This device has two main power regulators, one 12V→3V3 for the CPU, memory, wireless and one 12V→5V for USB.

Main 3V3 Power

This is delivered by a switching regulator with up to 2A at 3V3 output. Power is drawn from external input over one 1A Schottky diode (SS14), with a voltage drop of max .45V at 1A. It should be perfectly safe to draw an additional 100-200mA for your own additions from 3V3.

USB Power

USB power is derived from the 12V input over two SS14 Schottky diodes, the one also feeding the 3V3 regulator and an additional one. The output regulator is capable of delivering up to 1.5A, but there is a USB current switch/limiter that limits output current to 1A (and goes into 50% duty-cycle on/off in addition after about 200ms on short-circuit).

It should be fine to draw something like 700mA long-term from 5V USB and up to a bit less than 1A briefly. This is enough to spin-up and power most external 2.5" USB HDDs. You can try it out. The worst that can happen is that it does not work. The USB power-switch is fully protected and the regulator has reserves, as it uses an external PNP power transistor and has its own over-current protection at 1.1A.

I did run it at 750mA current draw from USB for half an hour without the regulator getting too warm. What I measured was 10C below the main SoC. The external 12V/1A PSU should also be fine with these loads. Still, if anything blows up in your face, or your house burns down, I am not responsible…

Tags