Skip to main content

linux - How to troubleshoot / test / benchmark usb hub (Hubs are acting as bottle neck...Why??)


I am running a Ubuntu 14.04 LTS and some unusual serial hardware, which uses serial to USB converters.


I am unable to plug several slow devices (RS232 to USB 2.0 converter, and RS422 to USB 2.0 converter, and another USB 2.0 device) into a 3.0 hub without having my application crash due to lack of incoming messages. However if all the devices are plugged directly into the PC everything works. Could you please explain why this is happening? Please read on for details...


I bought a 3.0 USB hub made by Orico. It has 4 ports, and it is powered by the USB port it plugs into.


I connected 2 serial converters (with devices to talk to) and a single USB device to it. Here are the details:



  • RS422 to USB (2.0) - configured as /dev/ttyUSB0 at 500,000 8N1.

  • RS232 to USB (2.0) - configured as /dev/ttyUSB1 at 115200 8N1.

  • USB 2.0 device (Labjack U3, which is a general purpose IO system... collects pressed buttons and the like...).


I have observed some very strange behavior that cost me two 14 hour days of turbo high stress until I realized the hub is the issue.


"Bad" Behavior of USB Hub that took some time to discover:



  • when only the RS232 to USB was connected, the serial device I was communicating to was receiving all the data the PC was sending, but all the responses from the device were being dropped by the hub (or more accurately, were dropped as long as the hub was used).

  • When two devices were connected (Labjack USB 2.0 Device + RS422 to USB 2.0) everything was working (messages from both devices were getting to PC at a good rate). If the RS232 to USB converter was connected while the the other two devices were already connected everything was still fine, and I could configure the RS232 port. However as soon as the serial device connected to the RS232 was turned on and started sending "messages", the application running on the PC would crash with an error indicating it was starved for messages from the RS422 device (that should be arriving via the USB hub). This would happen within 5 seconds of turning on (bringing online) the serial device that was connected to the RS232 to USB converter.


I was baffled for a while... until I removed the USB hub and connected all devices directly to the PC... then everything started to work like a charm.


Could you please expalain why this is happening? As well, could you please suggest some tools or a proceedure to help me pinpoint exactly what is going wrong with the USB network?


I need the hub to carry all the serial data that gets converted to USB messages to the PC without a bottleneck; and when we consider that the serial speeds of my RS232 and RS422 devices are so slow (compared to USB... not my troubleshooting speeds...) I would think that any hub will do the trick. Having discovered this issue, I am curious why a hub with speeds much faster than the devices connected to it is acting as a bottle neck.


Please be aware that the hub is not (likely to be) defective... It carries data just fine; until it encounters 2 serial converters and a USB device plugged in all at the same time, at which point it's speed (or perhaps voltage) crashes my robot.


#################EDIT #1

I suspected a voltage drop was causing an issue, so I used a powered 2.0 USB 7 port hub and the results were the same! Application is starved for messages as soon as all 3 devices start sending messages.


###########################################EDIT #2

If I plug the RS422 device direct into the PC, and the RS232 and Labjack USB devices into the USB hub (and then USB hub into PC), the Labjack U3 fails with an error.


Does this mean that a USB hub cannot pass the data passed to it by 2 serial devices and a single USB device at the rate at which the messages are arriving? This sounds really off.


If I can provide more info, please let me know. Thanks in advance.



Answer



The RS232 devices are usually FS devices, with USB protocol running at 12Mbps. When plugged into a hub, USB2 or USB3, the communication goes over special communication processor called "Transaction Translator", or "TT", which is embedded into every USB hub. There are two kinds of hubs, the ones that have only one TT for all ports, and the ones that have individual TT for each downstream port.


If you have several FS devices connected to a single-TT hub, the buffering resource will be starved, and FS bandwidth (12Mbps) will be shared between connected devices. To get full FS bandwidth over each downstream connection you need to have so-called "Multi-TT" hub.


Also, the handling of FS transactions over TT requires special approach on host side, called "split transactions".


Modern computers have native FS support through XHCI (USB 3.0) host controllers, so direct connection is handled naturally by XHCI driver. Older computers have the FS support inside their hardware, and muliplex ports to older OHCI or UHCI controllers, so they also have direct support for FS traffic rates.


However, if a hub is in between, the FS traffic must be handled by split-transaction technique, which is solely software-based. The split rules are horribly complicated, and covered by about 150 pages of USB specifications. If your robot driver has poor (or no) support for split transactions, FS and LS devices would fail to work behind a hub, specially if there are many of these devices.


Addition: Orico hub uses VL812 controller IC, which has only one TT in HS path. With (presumably FS) 422-USB device configured for 500,000 bauds and other FS devices, it likely has no bandwidth left, and host has problem with transaction scheduling and barfs on something.


Comments

Popular Posts

How do I transmit a single hexadecimal value serial data in PuTTY using an Alt code?

I am trying to sent a specific hexadecimal value across a serial COM port using PuTTY. Specifically, I want to send the hex codes 9C, B6, FC, and 8B. I have looked up the Alt codes for these and they are 156, 182, 252, and 139 respectively. However, whenever I input the Alt codes, a preceding hex value of C2 is sent before 9C, B6, and 8B so the values that are sent are C2 9C, C2 B6, and C2 8B. The value for FC is changed to C3 FC. Why are these values being placed before the hex value and why is FC being changed altogether? To me, it seems like there is a problem internally converting the Alt code to hex. Is there a way to directly input hex values without using Alt codes in PuTTY? Answer What you're seeing is just ordinary text character set conversion. As far as PuTTY is concerned, you are typing (and reading) text , not raw binary data, therefore it has to convert the text to bytes in whatever configured character set before sending it over the wire. In other words, when y...

linux - Extract/save a mail attachment using bash

Using normal bash tools (ie, built-ins or commonly-available command-line tools), is it possible, and how to extract/save attachments on emails? For example, say I have a nightly report which arrives via email but is a zip archive of several log files. I want to save all those zips into a backup directory. How would I accomplish that? Answer If you're aiming for portability, beware that there are several different versions of mail(1) and mailx(1) . There's a POSIX mailx command, but with very few requirements. And none of the implementations I have seem to parse attachments anyway. You might have the mpack package . Its munpack command saves all parts of a MIME message into separate files, then all you have to do is save the interesting parts and clean up the rest. There's also metamail . An equivalent of munpack is metamail -wy .

ubuntu - Why does my USB hdd returns SG_IO: bad/missing sense data?

I am able to boot and run commands from external USB hdd; the message in question appears for about 45 seconds then booting continues. GRUB2 is installed on internal HDD. When choosing to boot directly to /dev/sdb the message doesn't appear, however boot time is about the same as booting to internal HDD. /dev/sdb: Timing cached reads: 1018 MB in 2.00 seconds = 508.97 MB/sec Timing buffered disk reads: 80 MB in 3.03 seconds = 26.37 MB/sec pfeiffep@de:~$ sudo hdparm -i /dev/sdb /dev/sdb: SG_IO: bad/missing sense data, sb[]: 70 00 05 00 00 00 00 10 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 HDIO_GET_IDENTITY failed: Invalid argument Gparted correctly identifies the drive as SAMSUNG MP0402H. Any ideas how to remedy the HDIO & SG_IO messages?

Desktop reboots itself on sleep or hibernate

I have been using an ASUS M2NPV-VM motherboard for main home desktop workstation, operating Windows Vista x64. This computer has right from day one not been able to enter hibernate or standby; after Windows performs its final actions and brings the machine down, it would automatically revive itself for a reboot. Updating to the second latest BIOS (1201)has not helped (the latest BIOS revision would induce video refresh problems rendering it unusable). I have been reading related discussions on incidents similar to mine to no avail of a true workable solution. They appear to be more speculative guesses rather than actual knowledge on the inner workings of motherboard hardware. Does anybody have any electronic engineering experience on PC energy-saving standards to provide a more informed opinion how to go about getting this to work? More stories: this motherboard could not even reboot properly the first thing i used it. It was due to refresh rate of the onboard GPU, which had no influe...