Skip to main content
trevor1
Associate III
August 21, 2009
Question

Detecting USB connection status

  • August 21, 2009
  • 3 replies
  • 762 views
Posted on August 21, 2009 at 17:51

Detecting USB connection status

    This topic has been closed for replies.

    3 replies

    trevor1
    trevor1Author
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:50

    Hi All,

    I'm using a modified version the ST USB virtual com port firmware with some of Lanchon's VCOM incorporated also. What I need is way of knowing when there is a USB connection and when there is not.

    I'm having problems when USB is disconnected because when I try to send more data bad things happen.

    I have monitored bDeviceState but this does not help as it only changes state on a new connection -- it does not change on disconnection. I have also placed debug in many of the USB setup functions and again nothing happens on disconnection. How can I prevent problems due to sending data when there is no USB connection present? A solution where the data just gets dumped when no USB connection is acceptable.

    Thanks

    Trevor

    16-32micros
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:50

    Hi ,

    You can refer to this FAQ :

    http://www.st.com/stonline/faq/faqview.php?ids=1230

    The preferred way is to use a GPIO to detect Vbus Line( 5-volts) coming from the USB cable.

    Cheers,

    STOne-32.

    [ This message was edited by: STOne-32 on 21-08-2009 21:21 ]

    eng22
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 12:50

    Hi Trevor, I´m just facing the same issue here.

    How did you solve this problem?

    Thanks.

    Bruno