Society of Robots - Robot Forum

Software => Software => Topic started by: KurtEck on January 31, 2010, 12:22:18 PM

Title: Quick quesiton: can you detect if USB is connected to Axon2?
Post by: KurtEck on January 31, 2010, 12:22:18 PM
Is there a quick and easy way to detect if the USB is connected to something on the Axon2?  Not a big thing, but for example may change my debug code that if nothing is connected, no use in outputting something...

Thanks
Kurt
Title: Re: Quick quesiton: can you detect if USB is connected to Axon2?
Post by: Webbot on January 31, 2010, 01:55:53 PM
Not to my knowledge!

Since your code is going to need to be built with the debug message in it then you can always send over USB anyway (they just plop out the USB connect and fall on the floor).

So perhaps processing speed is your concern (ie why waste time sending stuff that isn't received). In which case how about sending something from the PC/terminal to say 'Send debug on' or 'Send Debug Off'. Bit like software RS232 handshake. ie assume Xoff at power up (ie dont send stuff) - if you receive an Xon then start sending.

Just a thought
Title: Re: Quick quesiton: can you detect if USB is connected to Axon2?
Post by: KurtEck on January 31, 2010, 04:12:46 PM
Thanks,

I was first thinking about it as to not waste time, but also later maybe to choose an input method.  Currently just using a debug terminal.

It was no big deal, I was just wondering if the USB powered up some IO pin that I could query...

Thanks again
Kurt
Title: Re: Quick quesiton: can you detect if USB is connected to Axon2?
Post by: Admin on January 31, 2010, 11:03:09 PM
Quickly skimming the CP2102 USB datasheet (https://www.silabs.com/Support%20Documents/TechnicalDocs/cp2102.pdf), nothing popped out at me to do it purely in software . . .


Quote
I was just wondering if the USB powered up some IO pin that I could query...
Yeap, this is easily doable. To the left of the USB chip you'll see a 3-pin IC angled at about 45 degrees. One of the three pins only goes high to 5V when the USB is plugged in, and is otherwise 0V with no USB plugged in.

Simply solder a wire to that pin, and plug that wire into a digital or ADC pin on your Axon/Axon II.