We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Does anyone know how I can detect if my USB device is connected to a Host or not?
Thx Steven
Hi Milorad
I previously used USB_Configured and it works as you discribed but the problem is that when the host gets disconnected (pulling off the cable) this function still returns 'true'.
Yes, that is because of board design, there is USBLC6-4 chip which serves for protection of USB lines but combined with schottky diode D2 or D3 it prevents VBUS voltage to drop low when USB cable is disconnected and that is the reason why driver can not recognize the disconnect event thus it never provides it to middle layer which does not reset the configured information and keeps returning "true" on USBD_Configured.
my fault, I should have read the beginning of your post. The ESD diode was keeping Vusb high. Thx for all!