USB Switch problem

Electronics Computer Programming Q&A
Post Reply
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

USB Switch problem

Post by MrAl »

Hello there,


I recently picked up some switches to use for an old USB hub that had blown out and was
given to me, and i intended to connect some switches to the USB hub after cutting all
the traces. The switches would only switch one USB device on at a time, not allowing
two or more USB sticks to run at the same time. This is what i wanted because i dont
want my USB stick plugged in all the time, only when i need it, and i dont want to have
to keep pluggin and unplugging it back in every signal time i go to use the USB stick.

Problem is, after wiring up one USB connector on the board to one switch in line with the
main connector (for proof of concept) the op sys gives me an error message saying that
the USB device has a problem. I unsoldered the switch and connected the USB connector
directly to the 'feed' connector and the USB stick starting working again.
After playing with it a little more i discovered that the wire length between the two connectors
can only be about 2 inches long. At 3 or 4 inches it stops working. I know it is wired
right because a lower speed device (USB Keyboard) works just find with it. The USB
memory drive needs the highest possible speed however so it fails with wire lengths that
are too long.

I really need maybe 4 inches of wiring or more to wire up two or more USB connectors, so
any ideas how to get around this wire length issue?

I've found USB switches on the web but they are not the kind i want. They all seem to be
for connecting two COMPUTERS to one USB device like a printer. I cant use that at all.
This has to electrically isolate the entire USB device, and that means that an IC chip that
can act as a switch will not work either (such as by Maxim).
I might also note that the sharing switches you can buy probably use chips to do the
switching too, not physical switches that fully isolate each port when off.
LEDs vs Bulbs, LEDs are winning.
SETEC_Astronomy
Posts: 582
Joined: Tue May 09, 2006 12:44 am
Contact:

Re: USB Switch problem

Post by SETEC_Astronomy »

For the data lines are you using a twisted pair? Do you have any size of shielded cable on hand? It might be overkill but if the shoe fits, try it.
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Re: USB Switch problem

Post by MrAl »

Hi Sofa,


That's not a bad idea really...i think i should try it. I actually have some USB cable laying around
too from a broken USB cord (one jack broke right off).
I was thinking it was an impedance mismatching problem so maybe that might help.
I think these switches are the wrong type too though so i might end up changing them
once i get the wire length problem solved.

It's funny too because i looked around quite a bit on the web and could not find anything like
this for sale anywhere, even with just one or two physical switches. I intended to get up
to four ports/switches at some point but would settle for even one or two at this point :smile:
LEDs vs Bulbs, LEDs are winning.
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Re: USB Switch problem

Post by MrAl »

Hi again,


Got it to work finally :smile:

For the wiring i used a short piece of USB cable, from a USB cord with broken connector.
The wires work ok up to about 4 inches, but 6 inches didnt work.

This means all the wiring has to be very short so i am not sure how many switches i will
be able to use. One definitely works, but using two switches will take the wiring to
the max so i guess i'll have to try that next.

If i can get the wiring short enough i might get two sockets/switches to work.
The thing is, in order to wire up the second socket/switch the signal has to
go through the first switch first so that when that switch is 'on' the second
one can NOT be turned 'on'. If i do it any other way like allowing two switches
to be on at the same time im not sure what effect that would have as that would
effectively wire two USB devices in parallel.

Wasnt someone else trying to do this a while back? I seem to remember something
about that unless that was another web forum.

At least now i know at least one USB drive can be switched on/off. That means worst
case i can use two individual ports and two switches/sockets. I would rather use
one port of course though.

In haste (i was doing other things today too) i forgot to try grounding the ground (black)
wire for the 6 inch test. Somehow it should work at least without the switch because
after all the USB spec is 5 meters. Perhaps i need to plug right into the port rather
than an extension that probably pushes the 'legal' length limit. I'll have to try that too.
LEDs vs Bulbs, LEDs are winning.
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Re: USB Switch problem

Post by MrAl »

Hi again,


I just thought i would mention that i looked into this 'problem' a little bit more by comparing the scenario to a transmission line.
The whole circuit enters into the class of a non-lumped circuit (unlike many of the other circuits we look at here) where the
signal wavelength is shorter than the circuit element dimensions.

Looking at it in this light, the signal reaching the receiver (the USB drive) could reach voltages more than 2 times higher than normal, and even worse the signal could ring several times before coming to a steady state. If the ringing lasts too long
(which depends on various things including the signal delay which itself depends on wire length) the ringing could look like
another (one or even more) signal transition which will of course make the host think the receiver does not know how to
respond correctly as to the correct protocol.
A slower device however, will not have this problem because it will not see the extra transitions anyway and so it may work
correctly when a higher speed device fails.

The trick then is to either make sure the impedance of the line doesnt change (hard to do) or else use a terminating
resistor (if power permits) to force the impedance to a more workable level.

Im still not exactly sure what i am going to do yet (probably end up adding resistors) but i havent gotten back to it yet
as some other things came up that of course have priority. The resistor values will probably have to be guessed by
trial and error because i cant measure signals that fast with my cheap scope.
LEDs vs Bulbs, LEDs are winning.
psycho
Posts: 388
Joined: Thu Jan 10, 2008 8:13 pm
Location: Northwest Indiana
Contact:

Re: USB Switch problem

Post by psycho »

I make USB devices all the time (although they are not the highest speed - tho they are 2.0 - don't remember exactly which speed - full??).

I have not run into this problem but I know that shielding is a bigger factor the higher the data rate is. If it were me, I would try better shielded cable first - before trying resistors...

Just my .02

Kevin
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Re: USB Switch problem

Post by MrAl »

Hi again,


I guess i could try shielding next, but i'd have to cut up another USB cord as the one i was currently using
does not have any shielding. It seemed to work ok i guess before cutting it up, but it didnt have any shielding.

ADDED LATER:

Here is a plot of the theoretical response for a typical 3.3v system. A 5v system would have somewhat higher
levels than as shown here. Note that the device would be expecting signal changes at intervals of about 2ns each
but look at the junk it would actually get...

Image
LEDs vs Bulbs, LEDs are winning.
Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests