Skip to main content
Graduate
May 11, 2021
Question

USB Slave - does the code need to change USBDM USBDP (PA11 PA12) to inputs when VBUS_SENSE=0?

  • May 11, 2021
  • 1 reply
  • 1215 views

We are using the STM32 USB Device Library.

This is the USB circuit

https://peter-ftp.co.uk/screenshots/20210511523173514.jpg

Does the STM library implement this, or do I need to detect a drop in VBUS (cable to Controller being disconnected), or is no action required?

The concern is that current can flow from those two lines of a powered 32F417 into an unpowered USB Controller. But maybe this doesn't matter.

Many thanks!

    This topic has been closed for replies.

    1 reply

    PHolt.1Author
    Graduate
    June 11, 2021

    Can anyone offer any input on this?

    There is a 1.5k resistor to +3.3V which is enabled or disabled. This obviously works in normal USB operation where +5V is arriving from the USB Controller, but what if the +5V connection is broken? That is partly what VBUS_SENSE is for - to make sure that resistor is not enabled in that case, because it would feed a bit of current into the controller.