cancel
Showing results for 
Search instead for 
Did you mean: 

Question about VBUS behavior in STM32 USB OTG and impact of externally supplied VBUS

afedffwerf
Associate

Hello,

I would like to confirm how VBUS behaves in STM32 USB OTG depending on the Host/Device mode.

Specifically, I would like to ask the following:

  1. When STM32 is configured as Host mode, should the STM32 source 5 V onto VBUS?

  2. When STM32 is configured as Device mode, does it only sense/monitor VBUS as an input?

  3. Is this behavior handled automatically by the internal OTG controller, or does it require an external VBUS power switch or additional external circuitry?

Additionally, I would like to ask about a hardware configuration where an external 5 V supply is always present on VBUS, regardless of the STM32 Host/Device configuration.

In this case, I would like to confirm:

  1. Whether this could cause any issues when STM32 operates in Host mode

  2. Whether it could affect Host/Device role detection or OTG behavior

  3. Whether USB enumeration and normal data communication would still function correctly

In other words, I would like to know whether a design where VBUS is always supplied by an external 5 V source is suitable for STM32 USB OTG operation, and what the recommended hardware implementation for VBUS control is.

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
Gyessine
ST Employee

Hello @afedffwerf 
>When STM32 is configured as Host mode, should the STM32 source 5 V onto VBUS?
when STM32 is configured as host you need to configure a specific pin as output (based on your product) to power the device part through the Vbus sensing pin
for example PG7 if you are using Nucleo-H755 :
Capture d'écran 2026-03-11 091953.pngCapture d'écran 2026-03-11 092045.png

>When STM32 is configured as Device mode, does it only sense/monitor VBUS as an input?

There are two use cases:

  • If the USB device is bus-poweredVBUS sensing is NOT mandatory: USB is connected all the time when the device is powered
  • If the USB device is self-poweredVBUS sensing is mandatory

>Is this behavior handled automatically by the internal OTG controller, or does it require an external VBUS power switch or additional external circuitry?
If I understood your question correctly, the internal OTG controller handled it automatically through its registers like VBDEN bit in the OTG_GCCFG register


>I would like to know whether a design where VBUS is always supplied by an external 5 V source is suitable for STM32 USB OTG operation, and what the recommended hardware implementation for VBUS control is.

Well first, like @waclawek.jan the voltage on even 5V tolerant pin must not exceed 4V against VDD.

It should work, since in most cases we don't even enable Vbus pin(PA9) in device mode functionalities
You can use one of our reference boards schematics as reference  
and in general, to understand more the ID pin detection and Vbus sensing concept and their implementation in STM32 products you can read the USB_OTG section in this reference manual for example

BR
Gyessine

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

2 REPLIES 2
waclawek.jan
Super User

Which STM32?

There is no way any STM32 can *source* 5V.

VBUS is input to a comparator, its output can be read as a bit in some of the OTG registers, and if set as interrupt source, it can trigger that interrupt. That's all. Now how you treat this signal/bit/interrupt in your code - and "your code" includes any library you are using - is up to you.

Note, that voltage on even 5V tolerant pin must not exceed 4V against VDD, even when the mcu is powered down.

You may want to check schematics of some of the STM32 demo boards such as Disco, for inspiration.

JW

Gyessine
ST Employee

Hello @afedffwerf 
>When STM32 is configured as Host mode, should the STM32 source 5 V onto VBUS?
when STM32 is configured as host you need to configure a specific pin as output (based on your product) to power the device part through the Vbus sensing pin
for example PG7 if you are using Nucleo-H755 :
Capture d'écran 2026-03-11 091953.pngCapture d'écran 2026-03-11 092045.png

>When STM32 is configured as Device mode, does it only sense/monitor VBUS as an input?

There are two use cases:

  • If the USB device is bus-poweredVBUS sensing is NOT mandatory: USB is connected all the time when the device is powered
  • If the USB device is self-poweredVBUS sensing is mandatory

>Is this behavior handled automatically by the internal OTG controller, or does it require an external VBUS power switch or additional external circuitry?
If I understood your question correctly, the internal OTG controller handled it automatically through its registers like VBDEN bit in the OTG_GCCFG register


>I would like to know whether a design where VBUS is always supplied by an external 5 V source is suitable for STM32 USB OTG operation, and what the recommended hardware implementation for VBUS control is.

Well first, like @waclawek.jan the voltage on even 5V tolerant pin must not exceed 4V against VDD.

It should work, since in most cases we don't even enable Vbus pin(PA9) in device mode functionalities
You can use one of our reference boards schematics as reference  
and in general, to understand more the ID pin detection and Vbus sensing concept and their implementation in STM32 products you can read the USB_OTG section in this reference manual for example

BR
Gyessine

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.