Saturday, July 14, 2012

Using modem/router as a TTL Serial cable

1 comment
Hi all,

Ok here the story. I have another bricked unknown WM8650 android tablet given to me for repair. According to the tutorial found on some forum, first I need to check if the bootloader is still alive or already dead by using serial interface. So I get my Nokia DKU5 cable which were previously showing dead/damaged USB devices symptom - "USB Devices not Recognized" and plug it into my computer hoping that the cable will be detected by windows. Unfortunately windows does not detect it and show the error instead.

I have another serial cable, but its USB to RS232 Serial cable. A counterfeit china made USB to RS232 cable! Why?! I already know this cable uses prolific chip inside. The manufacturer of the cable gives old driver on their site, but I want to use latest driver as I experienced some BSODs previously back in 2010/2011 with old driver. So I browsed the prolific website and notices red text that said "Warning Letter on Counterfeit Products". I don't care and still I downloaded the latest driver from prolific website get them installed on my laptop. When I plug in the USB cable, the drivers install. Unfortunately, it shows as devices not started (Error Code - 10). So I began to reinstall, restarting and trying other driver from prolific website, still same. The device cannot start. Then I remember the red text. I opened the pdf files that comes with the driver and in there its already mentioned that the counterfeit product will show symptom that the device cannot start.

I get angry at both, why there is people making a counterfeit product? Why prolific? why can't just allow the driver to start? Instead of using old driver I began disassemble the driver, find the counterfeit detection and rewrite the jump, sign the driver and reinstall them and the error went away.

OK, enough of side story.

Before I can connect this USB-RS232 cable to the tablet, I need some kind of converter, RS232 to TTL converter. So I googled around and found some random schematics on the internet, do some kind of reading about signal differences between them and while preparing the parts, hey... what about using router serial interface instead?!

I have two unused router, Billion Bipac 5112S (No wireless) which were replaced by D-Link DSL2640T (with routertech firmware) and then replaced again with TP-Link (because it has wireless N). So I opened these routers to expose their internal circuitry and attach jumpers between these routers. The ground pin is connected to each other while the transmit and receive TX/RX pin were crossed so when the other devices is transmitting data via TX, the other devices will received through RX and vice versa.

I powered up my dlink router and connecting my laptop to the router through wireless and then I opened putty and login to my router as root and issuing some command:
cat /dev/tty
Then I switch on my Bipac router, nothing on screen... Changed the jumper connection on bipac, maybe I connect the TX/RX/GND to the wrong pin. Then I tried again, still nothing on screen - just black with blinking cursor. Then I issued some other command
ls /dev
(I tried on each device i found interesting, and it turned out to be /dev/console)
cat /dev/console
Then I turned on the bipac router back, now I have some egyptian-alien hieroglyph coming out on my screen. It must be baud rate mismatch. So I issue another command to change the baud rate:
stty -F /dev/console speed 115200 -cstopb -parenb
Turned off and back on the router, I finally have something that not gibberish on screen. So, I have the screen output, how about sending command back to bipac router? By echoing the command to /dev/console like this: echo the_command_to_send > /dev/console
I was able to send the command to bipac router. But it's not comfortable, as I need to open two putty windows, one for view the bipac router output while the other one to send command.

So I search something and found netcat and then ser2net. I recompiled this both for my dlink router and upload them to my router using WinSCP. Everything is uploaded to /tmp/ folder. Here the two programs available to download:

To use ser2net, a config file is needed, so I made a config file as follow and start the program:
echo 43:telnet:10:/dev/console:115200 NONE 1STOPBIT 8DATABITS XONXOFF>/tmp/ser.conf

./ser2net -n -d -c /tmp/ser.conf
Now I have a wireless TTL Serial cable, I can send command 100 meters away without wire constraint within my laptop.

1 comment :

  1. Your Micro Wireless UNIVERSAL SERIES BUS Adapter (Model TBW-106UB) cpa networks Wireless made it possible for equipment including mobile phones, keyboards and also headsets. How big a penny, simply select that micro-device into a great offered UNIVERSAL SERIES BUS dock on your own laptop as well as computer's desktop and also expertise exceptional Wireless connection.