Smart multiple USB connectors handling - Page 1
Forum section: electronics / beginners

author: Chillance
author_rank: Contributor
timestamp: May 28, 2019, 12:12:18 am
content: H!So, I have this part of a PCB design that was made earlier for one USB connector. USB mini to be exact. I was thinking it would have been nice to have both USB mini and USB micro in the same circuit, and make it seamless to use either or. As you can see in the attached file, I was first thinking that could kinda work, but I'm guessing if I connect to both at the same time things wouldn't work properly.Looking around how to do this properly I found some USB switches ICs like the TS3USB30, but those don't seem to be smart enough to detect what USB was connected last. The idea is that if someone connects to both, the last one would be the one that works. Essentially disable the other one. And also, since having two connected probably wouldn't work either way, it would have been nice with a solution that can disable one of them in a smart way. The ICs I've found seems to recommend a microcontroller to control which USB to use, but I think it would be cooler if the circuit itself did this automatically in some smart way.And thus, I thought I turn here, to this forum hoping that you here would have bright ideas how to do this properly. Since I haven't found a smart enough ICs for this so far, I'm thinking it might be possible to maybe use the VBUS or and something that could possibly set the pins properly on one of those USB switching ICs to enable and disable the USB automatically.Actually, according to the truth table, I suppose one way to do this would be to put S and OE low having USB1 enabled by default. And then take power from USB2's VBUS (possibly through some regulator to get from 5V to 3.3V) and put that on S to drive that high, which then should enable USB2. Hopefully that will be quick enough for the IC to switch over so the USB communication works properly. Problem here though is that this would mean that as long as USB2 is connected, it wouldn't switch over to USB1 even if I would replug that one.Thoughts? How would you do this?Thanks!

author: Nominal Animal
author_rank: Super Contributor
timestamp: May 28, 2019, 09:02:28 am
content: From a purely user viewpoint, I'd personally rather have a mechanical switch, or a button with an indicator light, to choose the port to use.Heuristics always get it wrong in some use cases, you see.

author: Chillance
author_rank: Contributor
timestamp: May 28, 2019, 06:05:26 pm
content: That is interesting feedback for sure. I'm all for convenience here and I just like the thought of just plugging in and it works, but I suppose a switch and a LED would make things quite clear too.

author: Nominal Animal
author_rank: Super Contributor
timestamp: May 29, 2019, 09:24:50 pm
content: I have a few microcontrollers with different USB connectors (USB 2.0 Mini-B and Micro-B), and I normally use a hub integrated to a splitting cable (with each end being a different port on the hub). I assume you don't want to use an USB hub, because your device is an USB device and not a host, and you wish to use the connectors to potentially different hosts, not different devices.So, considering the reverse case, a single device connected to multiple hosts, I'd definitely prefer the button-to-select-which-one approach, especially if it had a small (not too bright!) LED next to the currently active connector. Any kind of autodetection would most likely surprise me at the worst possible moments; especially if the detection is fooled by host USB PHY powercycling. (I believe those chips would be, for USB ports with proper power control.)However, I also worry about ground loops a lot. If both are connected at the same time, then their grounds are connected; if there is a potential difference in the grounds, trouble.Considering all this, would an USB Mini-B (F) to Micro-B (M) adapter (or short cable), with only Micro-B (most common nowadays) on the device, be the "easiest" option?

author: Chillance
author_rank: Contributor
timestamp: May 29, 2019, 10:19:47 pm
content: Well, sure, I can have only one connector. For what I'm doing now, I really only need one connector, but still, I like this approach in this case. Personally I still prefer Micro USB because it's more robust in my experience. Mini tends to be more flaky after many usages. It's a shame mini "won" that battle.So, this is why I wanted to include both USB connector versions. That way, one have more options regarding what cables you might have at home too.I've actually added the sliding switch JS202011SCQN, that just selects both D- and D+ from one of them. Each VBUS is connected to their own LED (500ohm resistor good enough I suppose). Just before the diode.This should work I think.

author: Nominal Animal
author_rank: Super Contributor
timestamp: May 30, 2019, 12:51:20 am
content: I am definitely not an expert, but:A purely mechanical connector might not have clean enough signal paths. Also, that connector does not say whether it is make-before-break or break-before-make; you'll want it to be break-before-make (non-shorting) so that when changing, the two USB cables D+ and D- won't ever be connected together.Personally, I'd try something likeCRFS-2202Winstead (and that assumes you have diodes or P-MOSFETs in diode configuration to protect the two USB +5V lines from being backfed from the other connector). Or, better yet, perhaps a Switchcraft C63212L (either with +5V commoned, or if the device needs less than 300mA, then with +5V and GNDs).That 4PDT Switchcraft C63212L, assuming the device needs less than 300 mA, would probably soothe my paranoid mind the most, switching all four USB lines (+5V, D+, D-, GND). That way, if I accidentally connected the two cables to two different computers in different ground potentials, no harm no foul; the switch would completely isolate the unused connector.Again, I'm just a bumblef*ck, and have no idea if any of those switches actually work.

author: Chillance
author_rank: Contributor
timestamp: May 31, 2019, 12:33:01 am
content: Oh, thanks for the heads up. Seems like JS202011SCQN is make-before-break, which is bad. I was also looking at MFS401N-2-Z which has the same issue... C63212L seems better, but is so expensive... Guess I need to research some more here... 4PDT switch certainly seems like a better solution overall, but hard to find good parts that aren't too expensive and/or too large. I just want it to be on the smaller side, but the handle itself to be large enough. That is why I liked JS202011SCQN and MFS401N-2-Z.

author: Nominal Animal
author_rank: Super Contributor
timestamp: May 31, 2019, 10:37:05 am
content: Consider latching push-button switches too. For example, PBH4UEEKZXNAG is deep, and only rated for 100mA, but otherwise should work; and it's less than a dollar at Digikey. I suppose latching 4PDT relays are out due to size?It is surprising how such small/simple things affect the overall design. I have an Odroid HC1 SBC I want a microcontroller (Teensy 3.2) to interface to via 1.8V UART, with P-MOSFET power control, voltage and current sensing (for glitches/spikes), some buttons, and a small OLED display (for status and alerts); with the native USB interface to use with another machine as a serial console. It's not a complicated board, just some level shifters and an instrumentation amplifier (for current sensing) and such, but I've been doodling with it off-and-on for over a year now, with two prototype boards (off EasyEDA/LCSC.com), hoping to get it right with the third...

author: Vcky_electro
author_rank: Contributor
timestamp: August 07, 2019, 05:57:11 pm
content: Hi"Seems like JS202011SCQN is make-before-break, "..I'm new to here. Can anyone pls clarify me how would you say that this above quoted part is make before break ?ThanksVicky

author: TimCambridge
author_rank: Regular Contributor
timestamp: August 07, 2019, 09:06:51 pm
content: An unconnected host end pulls down D+ and D- with 15K on each. Via light pullups, or a similar technique, you should be able to detect these pulldowns.I expect you know that maintaining signal quality demands some care, particularly on high speed USB.

author: Chillance
author_rank: Contributor
timestamp: August 08, 2019, 12:05:57 am
content: Hi all, thanks for feedback so far.I got a bit of a lightbulb and am now using BSS138 MOSFETs with a Multiplexer to do this, andI thinkit's correctly setup.I must say that this solution ended up quite nice. Essentially power from USB connector #2 will have priority if connected, but what is cool is that both USB connectors will power a led to indicate which one is active so that will always be shown. Then the the MOSFETs will set the multiplexer to choose which lines that are active from either USB connector.

author: Chillance
author_rank: Contributor
timestamp: August 08, 2019, 12:10:15 am
content: Also, shoutout tohttps://www.falstad.com/circuit/circuitjs.htmlfor helping out with experimenting with n-MOSFETs!