OpenWrt Forum Archive

Topic: TP-Link WR703N Serial Over USB (Issues with non-USB 2.0 converters?)

The content of this topic has been archived on 30 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi all,

This is my first time using OpenWrt. I have a TP-Link WR703N in client mode, with an Arduino Uno connected to its USB port. I want to run ser2net on the WR703N so I can access the serial interface of the Arduino remotely. I have it mostly working, but when I use telnet on my laptop to connect to ser2net on the WR703N, the telnet connection just kind of dies after a while. Sometimes I can continue writing, sometimes I can't, but reading always fails.

In another thread, I read about an issue with another TP-Link router, where, in order to work reliably, serial interfaces required the insertion of a USB 2.0 hub between the USB-to-Serial module and the router. I tried that, and it works! Been blinking a LED and reading temperature data off it at a 1s interval continuously for a couple days now as a stress test.

From what I can gather, the issue is that the Arduino is a USB 1 device, and the Atheros chip REQUIRES a USB 2.0 device, so connecting a USB 2.0 hub solves the problem. Is this correct?

I'd like to put together 10+ of these WR703N & Arduino combos for home automation. This means I'll also have a bunch of bulky hubs to fit in the final case. To keep the physical size of the final units as small as possible, I'm considering just buying bare ATMega328s and assembling my own Arduinos, which wouldn't be too difficult. But this leaves the issue of the USB interface.

If my assumption about the USB 1 incompatibility being the root of the problem is correct, using a USB 2.0 capable serial to USB module should eliminate the need for a hub, right? I found this one on eBay that says it's USB 2.0, and should be supported by kmod-usb-pl2303: http://www.ebay.com/itm/PL2303-USB2-0-t … 43a941fb51

It'll take a couple weeks to reach me for testing, so in the meantime I was wondering if I'm on the right track. Does anyone have experience with a true USB 2.0 to serial module that I could use for my DIY-Arduinos, and eliminate the bulky hubs?

Thanks!

PS: If anyone else is interested in a project like this, I'm using a Ruby gem called 'dino' on my server for communicating with the remote Arduinos: https://github.com/austinbv/dino

It's early days for this gem, but it's been working great so far, and I've written a TxRx class that connects over telnet instead of a local serial device (all the gem currently does). Will push it to my Github account and submit a pull request shortly.

vixm wrote:

From what I can gather, the issue is that the Arduino is a USB 1 device, and the Atheros chip REQUIRES a USB 2.0 device, so connecting a USB 2.0 hub solves the problem. Is this correct?

Well, kind of wink

There is a lot of confusion between USB versions and speed ratings, you have:

  • USB 1.1, which defines both low-speed (1.5 Mpbs) and full-speed (12 Mpbs)

  • USB 2.0, which defines high-speed (480 Mbps)

Usually, USB 2.0 root hubs take care of high-speed using an EHCI device, and hand off both low and full-speed to an OHCI (or sometimes UHCI) device.

Unfortunately, in the Atheros AR9331 chip which is the heart of the TL-WR703N router, it looks like there is only an EHCI device and no OHCI. For some unknown reasons, full-speed devices seem to work somehow, but very unreliably, like what you observed with the Arduino communication. It looks like that this phenomenon is linked to the WiFi operation, as if you turn it off, you don't have problems.

Adding a high-sped hub in-between also solves the problem, as you have seen by yourself.

vixm wrote:

If my assumption about the USB 1 incompatibility being the root of the problem is correct, using a USB 2.0 capable serial to USB module should eliminate the need for a hub, right? I found this one on eBay that says it's USB 2.0, and should be supported by kmod-usb-pl2303: http://www.ebay.com/itm/PL2303-USB2-0-t … 43a941fb51

No: even if it is sold as "USB 2.0", it is probably (read: with 99% of chances) a full-speed device only, so you get the same problem.

The confusion comes from the fact that a full-speed device is BOTH USB 1.1 and USB 2.0-compliant, but if like here the host is ONLY USB 2.0 compatible, you are still stuck sad

Marketing will kill us wink

Thanks for the clarification Squonk. So USB 1.1 devices shouldn't really work at all with this router, but they do somehow, and adding the hub creates a proper OHCI device that reliably handles 1.1 devices that get attached to the hub?

I've observed the same thing you mention when disabling WiFi. Here are the results of my testing in case anyone else is trying to figure out the seemingly random behavior:

1) I can connect to ser2net reliably if my laptop is hooked up to the Ethernet port on the WR703N, and the Arduino is connected directly to to the WR703N USB (no hub), and WiFi is disabled.

2) For the previous setup, but with WiFi enabled (i.e. WiFi enabled, but still connecting to ser2net over Ethernet), it's more reliable than connecting over WiFi, it just takes much longer to die. Adding the hub to this setup makes it reliable.

3) In order to make ser2net anything near reliable while connecting over WiFi, the USB 2.0 hub is necessary.

Now I'm considering soldering directly to the serial port on the WR703N board. I've been trying to avoid this, since I've never soldered anything that small before, but it'll make the final design even simpler I guess. Just need some practice first.

Thanks for all the help!

vixm wrote:

Thanks for the clarification Squonk. So USB 1.1 devices shouldn't really work at all with this router, but they do somehow, and adding the hub creates a proper OHCI device that reliably handles 1.1 devices that get attached to the hub?

EHCI (high-speed), not OHCI (low/full-speed), but yes, it is correct otherwise.

Thank you for confirmation of the problem, it is helpful!

Regarding fine-pitch soldering, it is not that bad: use a good soldering iron (if possible temperature-regulated), solder with included flux or a separate flux pen, and lens magnifier (head-mounted, stereo microcscope, etc.).

I suggest taking the ground on the shield pad close to the JP1 shunt: it is both large and garanteed to be at ground potential, unlike the connector shields, which aren't.

The largest problem you will face with the console serial port is that it spits characters during boot because of U-Boot, then Linux console. You need to turn both off to get a clean UART.

I wish we could find a cheap, single-port, "inline" USB high-speed hub...

Of course, we can still build it ourself using a $2 GL850G quad high-speed USB hub chip, a crystal, 2 USB connectors and a few passive components... This chip is the one used in the $3.25 "octopus hub".

Or you can get small dual-port + microSD high-speed hubs for < $10:
http://www.pearl.de/images/large/px5294_2_2.jpg

Available from here (in French) or here (in German), and probably from more places too.

Thanks for the soldering advice Squonk. I will try both: soldering onto the board, and taking apart a small USB hub that will fit into the case. I was ordering some cables from monoprice.com the other day when I noticed this one which looks pretty small:

http://www.monoprice.com/products/produ … rmat=6#faq

so I got one to try out. Should have it by next week. W.r.t. using the built in serial interface, U-Boot shouldn't be an issue, since it will be out of the way by the time ser2net runs. I can probably get away with disabling the Linux console on the serial interface as well, since these are going to be purpose built little boxes.

On another note, my UNO works perfectly. But recently I got a Nano ATMEGA328 (not an "original" Gravitech, but it has a true FTDI FT232RL chip). I'll sometimes have to connect it to WR703N's hub multiple times for it to be recognized, and even then it's just as unreliable as the UNO when the UNO is connected directly.

If I hook the nano to either my MacBook or Ubuntu server and use ser2net, it works just fine. The only thing that's really changed when going from UNO to Nano on the WR703N is the use of  kmod-usb-serial-ftdi instead of kmod-usb-serial-acm for the USB-to-serial interface. Could this be the culprit?

(Last edited by vixm on 5 Jan 2013, 00:13)

vixm wrote:

W.r.t. using the built in serial interface, U-Boot shouldn't be an issue, since it will be out of the way by the time ser2net runs.

... Except if your Duino is also expecting commands sent by the router: in this case, you will have to make provision for garbage characters too.

vixm wrote:

If I hook the nano to either my MacBook or Ubuntu server and use ser2net, it works just fine. The only thing that's really changed when going from UNO to Nano on the WR703N is the use of  kmod-usb-serial-ftdi instead of kmod-usb-serial-acm for the USB-to-serial interface. Could this be the culprit?

I used both with a genuine Arduino Duemilanove w/ Atmega328 and a Leonardo-comaptible Vinciduino board and din't noticed any difference in behavior or failure rate between the two...

For your test, I suggest to disable WiFi, just to make sure the problem is not caused by spurious RF emissions.

I am experiencing similar problems with wr703n and Arduino.

I have tried with Arduino nano (clone) and with Freetronics Eleven both with similar results.

I have also tried a few different USB to serial adaptors with different chip sets.

I can get both the Arduino and the wr703n to operate correctly  when connected to a PC and when running emulations on Docklight, but cannot get the any of the Arduinos and wr703n to play nice together.
Wireless IS turned off in the wr703n, although ultimately I will want to utilise it.

If I attach the RX of a TTL-USB2 converter to the arduino I can see that it is getting a properly framed message from the wr703n when probing the TX line the Arduino replies are intermittent. The wr703n does not see any Arduino replies.

I am suspecting timing issues but don't have my DSO or an analyser handy to confirm at the moment. I have tried setting the link up at 115200 and at 9600 baud with similar results.

I will keep trying but maybe a greater mind than mine will get some clues from my results thus far.

PS: yes all these tests have been tried with and without a USB 2.0 hub with similar results.

stevensofa wrote:

Hi,guys.I found a portable power bank specifically designed for TP-Link mini wireless router WR702N and WR703N,you can order it at http://igg.me/at/sofa/x/989539.

Steven,

The provided link doesn't work (you have a period at the end of the URL).

Also, if you are the designer of this device (which I suspect given your name), please say it so, not that you have "found" it wink

hi! finally do you get project of join router-WR703N and ATMega308?? i see that is very interesting because you can get one router + Ardu small and cheap!. i have search info but i dont find nothing.

thanks

The discussion might have continued from here.