I'm trying to implement USB OTG design with STM32L4R5ZIT6P .

  1. What's the difference between self-powered and bus-powered? What I'm trying to achieve here is that the board will be able to switch between host and device. When a host device is plugged in, it will detect the host and act as a device, and vice versa. Is this a bus or self powered?

  2. I'm trying to look through their Nucleo board schematic, but it seems like different Nucleo board has difference implementation. It's also different from their USB hardware design training course on their website.

Nucleo board L4R5ZIT6P enter image description here

Nucleo board L4R9I enter image description here

  1. If you look at both schematic from different nucleo board, it seems like there's a VBUS_DET on the first schematic, what's the purpose of that pin?
  2. And do I just connect the VBUS pin directly to the VBUS of the USB connector? However, on this page , it shows that I will need a voltage divider at the VBUS pin, is that the same as the "VBUS_DET" pin?

Thank you.


Added my current schematic for checking. enter image description here


1 Answer 1

  1. In the role of USB device, your board can be bus-powered (power is supplied by the host via the USB cable) or it can be self-powered (power is supplied by a power supply directly connected to the board). In host mode, your board needs to provide power to the USB bus. So none of the two terms is used in this mode. The combination of OTG and bus-powered is rare as an OTG device needs to have its own power supply anyway. Both designs look as if they are self-powered as they lack a voltage regulator between VBUS and VCC (it's not shown at least). Instead, they both have a power switch for supplying power to the USB bus if and when they have the host role.

  2. There are many USB scenarios and thus several valid designs. Nucelo boards often try to be everything at once. Thus they also contain configurable parts ("Solder for USB device only").

  3. VBUS_DET is to detect whether power is provided over the USB bus (via the VBUS pin). The voltage is divider is needed in many cases as VBUS voltage is 5V but not all STM32 pins are 5V tolerant. You would typically connect this to the VBUS sensing pin of the MCU. I thinks it's mainly needed for self-powered devices to detect that the device has been connected to a host. It might not be needed for a full OTG implementation as the connection is detected through a combination of the other USB wires. But I'm unsure about this.

  4. VBUS on the USB bus side is the wire for sourcing or supplying 5V. On the MCU side, the VBUS pin is an analog input to measure the voltage on the USB bus (VBUS sensing). The regular VBUS sensing pin (PA9) is 5V tolerant. So no voltage divider is needed. You can directly connect them.

Generally, you can simply follow the instructions and design in chapter 3 of USB hardware and PCB guidelines. Unless you want to implement the bus-powered mode as well, you can omit the voltage regulator.

  • \$\begingroup\$ I'm still confused about self powered and bus powered. What do you mean by "it takes power from VBUS", is it the VBUS from the MCU itself or? The main purpose of my USB is to act as a device when a host plug into the connector and act as a host when a device plug into the connector, I updated the question with my own schematic, can you help me to check if my circuit will have this function? Thank you \$\endgroup\$
    – cy1125
    Commented Aug 29, 2021 at 21:14
  • \$\begingroup\$ I've updated the description to better explain what self- and bus-powered is. Your design looks ok but it's not possible to fully validate it unless you describe the power supply scenarios you want to support (incl. if your device works in bus and self powered mode or both (as a device)) and show or describe what MCU pins the signals are connected to. \$\endgroup\$
    – Codo
    Commented Aug 30, 2021 at 6:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.