6 years, 3 months ago.

USB Enumaration Status

Hello,

Question: I would like to know the status of the USB connection wither its connected or not. Using microcontroller Pin interrupt. Pin value seems to be always high rather than going low when not connected. Is there any way in which I can achieve using interrupt. I would like to use only external interrupt because when USB is disconnected then make the controller to deep sleep mode and when connected wake up from sleep. I would like to in this fashion. Any suggestions would be grateful. Thank you.

VCC USB1 = 5V(from USB when connected provides 5v and disconnected gives 0v) voltage Divider : voltage measured between the 2 resistors.

/media/uploads/sandeepmalladi/connect_status.jpg

1 Answer

6 years, 3 months ago.

So... VCC USB1 goes high when a USB device is connected and low when not? Then solder a wire from VCC USB1 pin to an external interrupt on your micro?

Or maybe I'm not understanding the situation, but in that case let me know what development board you're using.

Accepted Answer

hello Jan,

Thanks for your reply. "So... VCC USB1 goes high when a USB device is connected and low when not?" Yes as per my application I would like to detect the USB connected to PC or not. Using VCC USB voltage level using voltage divider. " Then solder a wire from VCC USB1 pin to an external interrupt on your micro?" I have done connecting a wire to interface with microcontroller but here I am facing the problem. when VCCUSB1 = 5v then i am able to detect the voltage of nearly 3.3 v (Voltage Divider Formula = VCCUSB1 *(r2/(r1+r2))). But when no voltage is applied still I am able to find the 1.8 to 2 v. My question is that do I need to change the before like PULLUP or PULLDOWN State in general what is the mode of every pin before its not been initialize. By the way I am using STM32l073 Controller Custom board for my application.

posted by san m 16 Jan 2018

You'll need to set the pin to PullNone, otherwise the pullup will interfere with the voltage on that pin. Alternatively, you could decrease your resistor values so the effect of a pullup is less. If R10 = 1K and R9 = 2K then the error due to a pullup should be 1/10th as big.

posted by Russ Butler 17 Jan 2018

Hello,

Is Voltage divider circuit is ok to get usb enumeration status while vbus 5v when connected and 0 v when disconnected. Is there any other better way in which i can change my circuit in detecting the usb Enumeration status. Like PWREN pin on FTDI and SLEEP pin. If so could you please help me out. Thank you.

/media/uploads/sandeepmalladi/ftdi.jpg

posted by san m 19 Jan 2018