2020-05-05 06:36 AM
According to https://community.st.com/s/article/FAQ-Management-of-VBUS-sensing-for-USB-device-design the software handling of VBUS presence event needs to be implemented by the customer.
How can I implement VBUS sensing on another pin SW wise? VBUS is connected to a GPIO through a resistor divider.
2020-05-05 07:14 AM
> How can I implement VBUS sensing on another pin SW wise?
In general, keep the USB disabled until the pin is high, and when the pin goes low, disable the USB. You could monitor the pin manually or using EXTI.
2020-05-05 09:20 AM
VBUS in the OTG only throws an interrupt anyway (albeit based on a comparator), so you can use any pin in this quality.
JW
2020-05-05 10:02 AM
Thanks for your answers. And who controls the pull up/down resistors on the DP/DM lines to indicate the host a device is connected? Do I have to take care of that separately or is it handled by the driver when I enable the USB?
2020-05-05 12:46 PM
I don't know what's your driver, but the DP pullup is controlled by OTG_DCTL.SDIS.
Pulldowns are for host operation. There's no pullup on DM, as the OTG module in device mode is FS only.
JW