EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: OnCor on October 19, 2022, 06:46:26 pm

Title: Incorporating USB switch into hub
Post by: OnCor on October 19, 2022, 06:46:26 pm
Hi all. I designed a powered USB hub that allows me to connect multiple devices to a FPGA development board through a micro USB port. The hub and the FPGA sit inside an enclosure along with some other peripherals connected to the hub. Occasionally I would like to access the hub/peripherals externally using a Windows PC which will be done while the FPGA is powered down. I wanted to incorporate a switch into the hub that will allow me to connect the PC to an external USB port through a 5 pin extension. I discovered the FSUSB30 IC in this (https://electronics.stackexchange.com/questions/328697/designing-a-usb-switch-schematic-done-wanting-a-second-opinion) post where the user is trying to accomplish a similar task to mine. I've revised my schematic to include it, but wanted feedback to see if I have any gaps/flaws in the design. The FSUSB30 requires a supply voltage between 3 and 4.3VDC. I added the LD1117V33 voltage regulator to drop 5V to 3.3V. This supplies the IC and is also switched to provide the "high" voltage to the S pin of the chip in order to access the data lines of the external USB port. When the switch is disabled, the OE and S pins will be grounded to be "low" so that the data lines for the FPGA will be active. I've seen mention of pulldown resistors on those pins to ensure the "low" logic is enforced. Is that necessary? If so, are the 2K ohm resistors from the article I referenced adequate? By the way my hub uses external 5V from a power supply and I do not plan to have the power pins connected on the internal micro USB or the external USB ports to avoid power feedback to the hosts.
Title: Re: Incorporating USB switch into hub
Post by: ataradov on October 19, 2022, 07:59:53 pm
Your 1117 part is completely wrong. Lookup and schematic for an voltage regulator and see how the capacitors are connected there.

And after you fix that, your switch would short out ground and 3.3 V when turned on. You need to use pull-down resistors on E and OE. Or just ground the OE and use pull-down on the switch.

Although I would reverse the logic and use a permanent pull-up with a switch grounding the pin.
Title: Re: Incorporating USB switch into hub
Post by: OnCor on October 19, 2022, 09:17:07 pm
Your 1117 part is completely wrong. Lookup and schematic for an voltage regulator and see how the capacitors are connected there.

And after you fix that, your switch would short out ground and 3.3 V when turned on. You need to use pull-down resistors on E and OE. Or just ground the OE and use pull-down on the switch.

Although I would reverse the logic and use a permanent pull-up with a switch grounding the pin.

Great catch on those capacitors! That was a very rookie mistake.  :-[

I revised the schematic to use a pull-up resistor on the S pin and switch going to ground. I also grounded OE as suggested. Does this approach seem more reasonable? If so, what value of resistor should I consider using?

Title: Re: Incorporating USB switch into hub
Post by: ataradov on October 19, 2022, 09:35:34 pm
I don't see why you would need R1 at all. For R2 anything in the range 1-100 kOhm would work. Just pick like 10 kOhm and you will be fine.
Title: Re: Incorporating USB switch into hub
Post by: OnCor on October 19, 2022, 10:47:39 pm
I don't see why you would need R1 at all. For R2 anything in the range 1-100 kOhm would work. Just pick like 10 kOhm and you will be fine.

Thanks. I'll go with the value you suggested. The data sheet for the switch IC recommended the 100 ohm resistor as part of the USB 2.0 standard. I'm not sure if it's absolutely required, but I figured it couldn't hurt.  :)

Title: Re: Incorporating USB switch into hub
Post by: ataradov on October 19, 2022, 11:06:31 pm
Ok, if they recommend it, then it is fine. 

It could hurt because it would drop some voltage, but I guess current consumption of this IC is not significant enough for this to matter.
Title: Re: Incorporating USB switch into hub
Post by: MrAl on October 20, 2022, 08:10:29 am
Just a quick note.

If you use a switch to switch a USB signal you have to wire it up somehow and that means some sort of wire has to join the switch to the hub.  Depending on how you wire it the computer may not recognize the hub anymore.  You should keep the wires as short as possible and wired as direct as possible.  The switch may be a problem too you may have to try different switches to get it to work.  Small Bat handle switches seem to work, and possibly very small rocker switches.
Title: Re: Incorporating USB switch into hub
Post by: OnCor on October 20, 2022, 06:47:35 pm
Just a quick note.

If you use a switch to switch a USB signal you have to wire it up somehow and that means some sort of wire has to join the switch to the hub.  Depending on how you wire it the computer may not recognize the hub anymore.  You should keep the wires as short as possible and wired as direct as possible.  The switch may be a problem too you may have to try different switches to get it to work.  Small Bat handle switches seem to work, and possibly very small rocker switches.

The FSUSB30 chip that is doing the actual "switching" on the data lines will be incorporated into the hub's PCB. I will use a small wired rocker switch connected to a header on the PCB which is "wired" to the logic pin on the IC that triggers that process.