Go Down

Topic: How To Tell If USB Is Connected.... (Read 149 times) previous topic - next topic

RayLivingston

Is there any way to determine, on either the Programming Port or Native Port, if there is an active USB connection, WITHOUT sending or receiving data.  In particular, I'd like to be able to detect if either port is connected to a PC, and the PC COM device opened.  Perhaps there is some way of detecting a toggle on one of the (virtual) handshake lines, like CTS?

Regards,
Ray L.

LMI

If you mean tell in the Arduino board, perhaps someone in AVRfreaks forum could tell.

Okio

Don't know if this would work, but could you try connecting one of the USB data pins to a digital input?

LMI

USB data voltages are differential and around about 1-2V. Using digital input like that probably would not work

Okio


LMI

There is a pull up resistor in one dataline. That tells the host there is something connected.

Read the datasheet of the chip which handles the USB bus. I think in DUE it is the CPU ATSAM3X. So, read the USB part of the datasheet and ask about this AVRfreaks forum.

Collin80

The equality operator is overloaded for SerialUSB so you can just see if it is true. If it's true then there is something connected to the USB board. If it is false then there isn't.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy