0
\$\begingroup\$

I have been eyeing USB communication in microcontrollers especially the dspic33 series. Now, when I looking over the physical connector of the USB, I came to know that there are 5 pins used.

VBUS,D+,D-,GND,USB ID pins. In these 5, I got little confusion about the VBUS pin. As per the datasheet of the MCU I am using, it is not self-powered for the VBUS pin. We have to supply externally 5V to the VBUS pin.

On seeing the architecture of the USB engine, the supply given through the VBUS pin is passed to the analog comparator. This is because the VBUS pin in the MCU is to monitor the state of USB communication, stated in the datasheet. No more info.

So, what are the roles played by the VBUS pin in the USB communication? The microcontroller I am using is capable of playing OTG role.

From the above info I gathered, I need clarifications on these three points.

  1. What is the use of VBUS pin in the microcontroller if it is used as a host? What are the operations are done by USB engine when MCU acts as host?

  2. What is the use of VBUS pin in the microcontroller if it is used as a device? What are the operations are done by USB engine when MCU acts as device?

  3. How the Vbus pin is used in OTG mode?

The answer need not to be MCU oriented. The relevant and general answers are also welcome.

Thanks for the help!!!

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$
  1. A host must provide 5V power supply to device. A host will wait for a device to appear before doing any communications to device. Host always initiates any communication.

  2. A device can use 5V for powering itself, or if it is self-powered, simply sense when host connection is made or disconnected. A device will always wait for communication from host.

  3. OTG device must output 5V when in host mode and not output 5V when in device mode. In device mode it can use it for sensing connection or charge batteries.

\$\endgroup\$
3
  • \$\begingroup\$ Hi, thanks for the crispy answer. I want to make one more thing clear. When My microcontroller is the host and I am connecting a self-powered USB device with it. What should I do in that scenario? Do i need to connect the vbus of the pin of MCU to the device? \$\endgroup\$
    – CNA
    Jan 14, 2021 at 7:43
  • 1
    \$\begingroup\$ A small addition to 2 -> A self-powered device must disconnect 1.5k resistors from D+ & D- lines as soon as it detects the absence of VBUS. It's required by the USB spec. \$\endgroup\$
    – Tagli
    Jan 14, 2021 at 7:48
  • \$\begingroup\$ @Tagli is correct. A self-powered device will fail USB certification if it leaves the pull-up resistors connected when VBUS is absent. \$\endgroup\$
    – Adam Haun
    Jan 14, 2021 at 7:52

Your Answer

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

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