Monday, September 10, 2018

Router Serial or UART Port: How to find and Configure

I received several e-mails regarding how to find out the serial port on the router motherboard or PCB.  It's actually very easy on most routers.

Disclaimer : Modification of Hardware or Software has a possibility of Bricking an Embedded Device, such as a router. Please do the Below Procedure(s) on your own risk...

Test Case Tp-link archer c50 AC1200 routers.

If you look close into the image, You will clearly see a 4 pin connector, most of the times all 4 pins connectors are serial risers.  In recent routers almost all routers got 4 pin serial connectors like this.
All you have to do is, find the Tx/Rx and Ground pins.  Vcc is not required but good to know which of the 4 pins is a vcc.  We shall note it and no connect any pins to it!!
You will need a multimeter to test to know which of the pins are tx/rx and ground/vcc.  

1. First try finding the ground pin of the UART.  Keep router powered off.  Get a Multimeter and get it into Diode test/Continuity test/Short test mode. Connect one pin of MM to one of the pins of the UART and Another(gnd/black) connect to one of the Antenna connector or Antenna connector solder point(whichever available for your router). In our archer c50 case there is Antenna connectors but not the cheaper antenna solder point.  Here we are using Antenna connector as the ground plain of the router.  If There is continuity from antenna connector to the UART pin that is connected to MM then that is our UART Ground point, if not test all of the pins one by one to find which is Gnd(ground), MM will provide a continuous Beep and Diode test light will light up depending on the MM, while MM connector is on the ground pin of the UART. This test is actually checking which pin is connected to the router boards ground plain. It's like connecting one single wire in two different points and MM starts to beep/light as these two points/pins are shorted to ground i.e. ground pin. 
2. Now Try find the Vcc pin.  We must know which pin got constant voltage of V3.3. Now Connect MM Black lead to the Antenna connector And another to one of the 3 remaining pins.  Now Connect the router to power and observe very carefully what happens. Keep an eye on the leds of the router.  As soon as Led shows power on...Very carefully observe if we are getting Voltage of 3.3 Consistently throughout the Entire boot process of the routers.  You will know your router, as soon as booting finish all the light starts to blink or some constantly lit. The pin that got consistent 3.3volt(or close), no change in voltage, is your UART VCC pin.
3. Now try finding the Tx or Transmit pin, this is the pin router sends data through the Serial UART.  Now again connect MM Black/Gnd Lead to Antenna point and Another to one of the 2 remaining pins of the UART.  Now, Power on the router. Observe very carefully, if you find voltage spikes throughout the boot process of the router, then that is your Tx pin of the UART.  As data passed through the Serial port, Voltage will go up and down and as such get voltage reading ranging from few milivolts to full 3.3 volt. After booting finish voltage should stabilize at somewhere around 2/3 of the full 3.3 volt. But as it's a router, as soon as connected to internet user programs starts to connect to net & voltage spiking may not stop. so common to have 0.5 volts to 2.xx to 3.3 volts. on Tx pin.
4. Remaining pin is very tricky.  Rx pin can have same voltage as Vcc or it can go short to ground or remain/hang in somewhere in between 0.5 to 3.3 volts.
But we already got the Gnd, Vcc and Tx pin. If Tx/Rx is wrong, no problem, You will get garble from the serial port to your Serial comm program.  If so just swich Tx/Rx and should get clear text while booting.

Problems in Soldering :: If u still get garbled text then may be ground pin of the serial UART not soldered properly.  Try resolder all pins. If You can see text clearly in the comm program but whatever is typed isn't shown, then probably poor soldering quality.  Either you shorted Rx pin to ground or Dirty solder at Rx pin!! Re-do your soldering.

Your Serial comm program should be in Baud rate of 115200 and 8-n-1. Do not turn on Hardware flow control, as we are not using DTS/RTS pins, not available, as it's not a real modem!!
Software flow control should also be turned off by default.

Test case 2 Tp link tl-wr802-v1

If you see the image on your left, it's a tiny  little older tplink router with USB ports.   Here is no clearly pointed out Serial UART port.  But It's more visual finding the correct serial pinout spread all over the tiny board.
There are 4 pins clearly marked. 
1. Tp_out, which is Rx pin, Tp_In, which is Tx pin of the router. There is Tp3v3, which is Vcc of 3.3volts.  There is another one which is TP3, Verify with MM whether it's connected to ground plain i.e. The Antenna connector and other exposed metal like the outer shell of the USB or UTP Connector(Network connector) port(outer shell only). If it passes continuity test then use TP3 AS your ground.
TP3V3 has to be measured while router is booting.  If as usual you find consistent 3.3 volt in TP3V3 then that is your Vcc. Try finding the other pins as outlined in the First router case.

Test case 3 Xiaomi mi router 3

This is a Mediatek router made by xiaomi.  Here the UART is clearly marked.  But as wise men say, always verify what is said is true or not!!  So, verify the pins as per test case 1 and 2, or else if u connect your Serial TTL converter to vcc, your router may burn out or to the least your serial converter will short out for sure.






Test Case 4 Tp-link Tl-wr840n-V4(EU)

As seen on Last case No 3, this tp-link router also have it's serial port UART marked clearly.  All pins are marked.  But as said before You must verify as what is marked on the router.  Verify all the pins i.e. Tx - Rx - Gnd -Vcc, as like test case No.1




Now I have my serial UART port figured out, What and how I'm going to use it.  It's a bit tricky and risky now.  First You need to solder a 3 pin riser to the Serial port you have seen so far.  It's same for all modem.  If you are unable to do soldering or are afraid, which is to be expected, You can go to a local Electronic repair shop and request to connect the pin header or some wires to the UART/Serial Interface, and you are done.

Now You will need a USB to Serial TTL Level shifter/converter.  You can order in your local electronic shop.  Best so far are CP2102 for Tp-link, Tenda or asus or any other router. There is also pl2303 which also will work.  Last but not the least is the ch341a which is a TTL Level shifter along with a SPI(Serial Programming Interface) programmer, that you can use to program the routers flash chip and all above are very very cheap around $2.50 to $3.00.  Here are the photos of them here,

Left is cp2102
Right is ch341a
Bottom pl2303

You will see pin header/connector in all of the above, just connect your router's UART or Serial Port Tx/Rx and Ground pin like this, Router Tx->Converter Rx, Router Rx->ConverterTx, Router Gnd->Converter Gnd.

WARNING!: Some people reported they fried their router connecting the voltage pins despite it isn't necessary. NEVER connect voltage pins when using USB adapters unless you know what are you doing. Unless you need to power the device, you don't have to connect the voltage pins. And you usually don't need to power it this way - use the router power supply.
Pls. Do not connect any pins or headers to the router or the Converter's  VCC connector. This is very very Important, otherwise Your converter or  router or both may be damaged/burned/shorted.




Please review the Image above, one is cp2102 another is ch341a used as a TTL Converter Instead of a Programmer

Now You need to Install a Communication program if in windows.  There is one Modem dialer but prefer Putty, Download and install from here,
https://www.putty.org/

Now After connecting the TTL Converter to Router and Computer, Pls. keep the router turned off.  Now Check in windows "Device Manager", In which port the TTL Converter connected, if nothing shown, then You will have to install the Driver for cp2102 or ch341a from internet.  Just search in google "ch2102 Driver download" or "ch341a Driver Download" and go to the First available link to download them, You have to install the driver and then Disconnect and reconnect the TTL Converter/adapter, while keep Device manager window open and you will see live the device connecting!! to virtual com port assigned to the serial adapter.

If you do not install driver it should be like above, not detected properly



If you install serial adapter driver it should look like above

For Linux if you got Latest 4.xx kernel then no worries it got drivers in the lib. and dmesg it to see in which port connected, usually ttyUSB0 or ttyACM0 etc. Like below,

Now you need to start putty and then setup serial connection to the converter port i.e. port com5 or so(whatever reported in device manager)...for linux just start minicom with ttyUSB0 etc.

After startup the Putty or Minicom now switch on the router, TTL Converters light will get lit and watch the router boot log live in the serial port window like below,

For Myself I Also use TL866 II plus programmer as seen here


































































If you need firmware for some Tp-link routers(popular) please visit this page.

===================================================================
My Profession : By trade I'm a Software Engineer.  But I Love trading currency or Forex markets and trade mostly eurusd markets.  So I needed a reliable and dependable router system that I think openwrt or tomato can provide with a good ISP.  I trade with reputable International Forex brokers.

To know how to do Forex Trading go here : Forex Trading: My regular source of income

For signals on eurusd go here My Forex Trading Journal

5 comments:

  1. Hi and thank you for the fact finding about router mod project.

    I was else thinking about Securifi Almond (2012) with the lcd touch screen. I did found four pins and the pcb board shows RX, TX, 3.3v and GND.

    Any ideas about this? I like to screw around the router since I bought this for one dollars and hope to crack the memory of chip so that I can write the html from the router.

    ReplyDelete
    Replies
    1. Those are router testing points found in most router boards. Engineers test boards for updates/errors etc. You can update/mod router firmware with Rx/Tx. Re-read article how to do that.

      Delete
  2. Hi, I have a kinda unknown repeater / router here.
    It's called Airlink 817, I tried finding more information about it, but it's not on FCC, as it doesn't have a FCC number, only ANATEL (the brazilian equivalent of the FCC) but there's not much information there about it's hardware.
    Anyway, I decided to open it and it already have a 4 pin connector soldered to the board, do you think it's the serial connector?

    I'm trying to make it work like a portable NAS with a portable HDD.
    The device have one ethernet port and 2 usb ports, one for power 2.1a and another for USB file sharing or 3G modem.
    It's a AIO device, assembled like a sandwich where the PSU outputs 5v to a 2 pin connector on the router board, pretty neat stuff.
    But the thing is it's firmware, it doesn't have any form of file sharing server, no FTP, SFTP, SMB, or Webdav, nothing, only its own custom web based file sharing interface.
    So I'm trying to maybe dump whatever it is necessary to try and compile a custom firmware to it to have at least some decent form of file sharing.

    What do you think? Should I go for it or just try to buy something on the same form factor that actually already works?

    ReplyDelete
    Replies
    1. U got an interesting device there. Yes it's possible to add file sharing modules from linux i.e. openwrt. But before try, u must make sure u can replace the flash chip, as most have 1 or 2 or 4 mb, not enought for larger kernel with extra stuff. Bofore anything u must know, how to compile openwrt with yr pc, that probably should run some form of linux(it would be much easier), if windoz, u will have a lots of compatibility problem.

      Delete
  3. Hi. can this boost signal strength?

    ReplyDelete