Switch between two USB sources without direct access to teensy; best way to...?

Status
Not open for further replies.

JBaughb

New member
Hey guys. I have a question that I’m hoping will be easy for someone to answer. I’ve been coming to this forum for the past couple years every time I have a teensy related issue but this is the first time I’ve felt the need to post something myself.

I need to integrate a teensy into a custom computer project so the computer will have device access to the teensy and also be able to reprogram it. Once its built into the box access to it will be difficult so I’ll be connecting external push button switches for reset and boot loader access (incase theres a problem with the software loading a sketch automatically). In addition to this I’ll need to be able to disconnect it from the computers USB to allow external access to the teensy via a seperate USB port build into the case of the project.

My idea was to wire a 4PDT switch to switch between the internal computers USB access to the teensy (D+/-, 5v, GND )and a separate USB port that will be build into the outside of the case. Power would be supplied from the computer when its attached internally via usb and then it will be powered by whatever device its connected to externally when I switch to the external USB port.

Is there a better way of doing this? Thank you.
 
You only really need to switch two lines, D+ and D-. I wonder if you can't add a solid state switch that is enabled by power on the external USB bus power being present.

Thus, when you connect the external USB cable, the internal data lines are automagically disconnected and switched to the external USB interface instead.

I haven't used such a solid state switch but they must exist, I'd check digikey. I wonder if they would be classified as a mux/demux chip.

I doubt the old Arduino serial trick with 1kOhm resistors on the serial line would work with USB signaling.

Be sure to put a Schottky or similar on each USB 5v power line going to the teensy so the two power supplies don't potentially fight each other.

A small Polyfuse (1/2a or less) for each power line is also a good idea. However even a single fuse post the Schottky diodes would likely suffice.

Edit: checked digikey , they have them. Look for USB switch. Then fikter for a 2:2 configuration. Fsusb30 from Fairchild and many other options exist.
 
Last edited:
Okay, wow. Thank you all for replying. I didn't even know there was such a thing as a solid state usb switch. Looking at the data sheet I think I'm getting there with the info I need but if someone could clarify a couple things. I've attached a quick drawing of the IC, the teensy and the two USB connections. Hopefully that helps with my question.

The functionality I want is for the Teensy to be connected to the internal hardwired USB at all times UNLESS it detects a USB cable plugged into the external USB port. Based on the truth table of the IC, this would require me to pull the select pin 'S' high...which I suppose can be done using the 5V from the USB cable that was just plugged in? I'd like this still to work if the main computer attached to the internal hardwired USB is powered down.

Where do I need to attach Schottky diodes to make sure the internal computer 5V and the 5V coming in from a external USB don't interfere with each other? How do I make the select pin go high only when 5V is coming in from the External USB port and not from the internal 5V if those two 5V lines connect together to each power the teensy. I have a feeling the answer to these two questions are related....I just have limited experience with custom circuits.

teensyusb.jpg
 
I would use a pulldown resistor on S (10K from S to GND) to drive it to use your internal USB, and then hook only the 5V of the external USB to the S pin. If the external is not connected, you get a "low" on S, and if the external is connected, S will be "high". Looks like the control pin is spec'd up to VCC (5V), so that ought to work.

A Schottky coming off each 5V USB port line will be needed before the two signals join. Similar to how the Vbat is hooked up on the Teensy, where it uses either a 3V coin cell or the 3V3 coming off the voltage regulator, without the two voltages fighting:
schematic32.gif
 
Status
Not open for further replies.
Back
Top