go_away

Author Topic: Quick quesiton: can you detect if USB is connected to Axon2?  (Read 1388 times)

0 Members and 1 Guest are viewing this topic.

Offline KurtEckTopic starter

  • Robot Overlord
  • ****
  • Posts: 217
  • Helpful? 12
Quick quesiton: can you detect if USB is connected to Axon2?
« 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

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: Quick quesiton: can you detect if USB is connected to Axon2?
« Reply #1 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
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline KurtEckTopic starter

  • Robot Overlord
  • ****
  • Posts: 217
  • Helpful? 12
Re: Quick quesiton: can you detect if USB is connected to Axon2?
« Reply #2 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

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,702
  • Helpful? 173
    • Society of Robots
Re: Quick quesiton: can you detect if USB is connected to Axon2?
« Reply #3 on: January 31, 2010, 11:03:09 PM »
Quickly skimming the CP2102 USB datasheet, 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.

 


Get Your Ad Here

data_list