USB host detection

Status
Not open for further replies.
You could try reading the usb_configuration variable from deep within the USB code.

That variable gets set to non-zero near the end of the USB enumeration process, so it's a very good indication is a host has "connected". But some hosts, especially Windows, have extra delays before they load their drivers that talk to the USB interfaces/endpoints, so I suppose it all depends on what you think "connected" means.

The trouble with this variable is it's not 100% reliably returned to zero when the USB disconnects.
 
Here's a crazy thought: if you could get by with just detecting whether or not the Teensy is plugged into a USB port, even though the devices it's plugged into might not be turned on, you could try the following:

Wire one of the Teensy pins capable of touchRead() to a resistor and then to ground nearest the USB connector. Plugging the cable in should significantly increase the capacitance reading.

Caution: I haven't tried this and I'm not an Electrical Engineer, so give the wiser people on the board some time to shout if this is a very bad idea.
 
Here's a crazy thought: if you could get by with just detecting whether or not the Teensy is plugged into a USB port, even though the devices it's plugged into might not be turned on, you could try the following:

Wire one of the Teensy pins capable of touchRead() to a resistor and then to ground nearest the USB connector. Plugging the cable in should significantly increase the capacitance reading.

Caution: I haven't tried this and I'm not an Electrical Engineer, so give the wiser people on the board some time to shout if this is a very bad idea.

You might as well just sample the +5 volt lead on the USB connector with a resistor connected to a Teensy digital pin. You would need a higher value pull down resistor on that pin to keep it normally low.
 
I just went through 2 hours of tearing my hair out when a USB cable was the culprit. I find that the MicroUSB is far less reliable than the MiniUSB and not much smaller on the PCB, I never use it on my own projects because of that . Is it possible to migrate Teensy boards to this connector?
 
Status
Not open for further replies.
Back
Top