cancel
Showing results for 
Search instead for 
Did you mean: 

Detecting USB connection status

trevor1
Associate II
Posted on August 21, 2009 at 17:51

Detecting USB connection status

3 REPLIES 3
trevor1
Associate II
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

eng22
Associate II
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

16-32micros
Associate III
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 ]