VBUS pin questions

Talk about anything you want!
Post Reply
Marevealous
Posts: 17
Joined: Tue Jul 19, 2016 10:41 am

VBUS pin questions

Post by Marevealous » Fri Aug 05, 2016 11:53 pm

Hey
I am in process of designing my own PCB for chipkit board (I will most likely use chipkit-diy bootloader).
I am confused about VBUS pin.
I know that it should be connected to 5V, but when? Does it have to be at 5V level all the time? Or only while using USB? Can it be left floating while not using USB?
Also, what about the case when my board is powered from external power supply but USB is still connected to PC? Should I connect external power supply 5V to VBUS or keep VBUS connected to USB 5V?
Thanks in advance!

User avatar
majenko
Site Admin
Posts: 2164
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: VBUS pin questions

Post by majenko » Sat Aug 06, 2016 12:22 am

VBUS is connected to the 5V pin of the USB. If that 5V pin also happens to be powering the board that's fine. That's known as "Bus Powered". If it's not powering the board then it's known as "Self Powered". It should only get +5V applied to it when the USB is actually connected. It should be disconnected at all other times.

If your board is supplying power and that power is "mixed" with the USB then there should be some form of "back powering" protection. A schottky diode is the simplest method. The highest voltage (board power or USB power) wins and powers the board.
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

Marevealous
Posts: 17
Joined: Tue Jul 19, 2016 10:41 am

Re: VBUS pin questions

Post by Marevealous » Sat Aug 06, 2016 9:39 am

majenko wrote:It should only get +5V applied to it when the USB is actually connected. It should be disconnected at all other times.
Ok, so VBUS will be connected to USB connector 5V+.
majenko wrote: If your board is supplying power and that power is "mixed" with the USB then there should be some form of "back powering" protection. A schottky diode is the simplest method. The highest voltage (board power or USB power) wins and powers the board.
Well, honestly I've been just using a jumper for that in the past, but it was with 8 bit MCUs which did not need another LDO for 3.3V (they worked at 5V). It worked well because I designed the jumper in a way that it has only two positions and one enables USB-powering and second external powering. Can you show example of your schottky solution?

User avatar
majenko
Site Admin
Posts: 2164
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: VBUS pin questions

Post by majenko » Sat Aug 06, 2016 10:37 am

The simplest method is just to "mix" the two 5V signals together before regulating down to 3.3V. Your 5V will be slightly lower than 5V though because of the diode voltage drop, which is why you use Schottky - the forward voltage drop is much lower. Choose ones that have the smallest drop you can find unless you don't need your 5V to be exactly 5V - and anyway, from USB it most likely won't be, since it can be anywhere from 4.75V to 5.25V and still be within the USB specifications.
twopower.png
twopower.png (10.93 KiB) Viewed 597 times
If you need close to zero voltage drop on the USB power to keep as close to 5V as possible then you need a more complex system - the same system that is used on 90% of Arduino and chipKIT boards, involving a reverse-connected P-channel MOSFET and a small op-amp to work as a comparator. The MOSFET is reverse biased and turned off when powered by external power, and forward biased when powered by USB. The body diode in the MOSFET lets through enough power to run the op-amp which then detects that the external power isn't there and turns the MOSFET on bypassing the body diode, which then removes the voltage drop.
3pQ92.png
3pQ92.png (19.54 KiB) Viewed 597 times
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

Post Reply