USB power levels - Page 1
Forum section: electronics / projects

author: osmosis321
author_rank: Regular Contributor
timestamp: October 24, 2010, 01:54:49 pm
content: I'm very unclear on how USB provides power to connected devices.For example, if USB detects a device already has a voltage level, what happens then? If USB powers a device, will it always drive it with 5v or can it do another voltage..I ask because I've been scrutinizing the layout of this board I'm working on, and it turns out the USB power is directly connected to the main VDD of the board, and I know the PIC24FJ won't survive that voltage for long.I got lucky - before I became aware of this potential issue I'd connected the USB with the board already powered at 3.3v, and nothing bad happened. Presumably the USB hardware detected the voltage and didn't provide any of it's own? And presumably if I connect the board to USB without it's own power, USB will start providing 5v and my MCU will overheat and die?

author: Unknown
author_rank: Unknown
timestamp: October 24, 2010, 02:06:38 pm
content: USB can only provide 5(ish)V. Not sure about detecting already powered devices, I wouldn't rely on this behavior, unless it's clearly part of the spec (and even then, low-end manufacturers usually only implement part of the spec). I've never heard of this, it may just be a side effect of some other protection circuit (eg. reverse power protection diode in 3.3V regulator conducting and overcurrent protection of the USB port kicking in). You may be able to disconnect the USB power pin for self-powered operation.

author: Mechatrommer
author_rank: Super Contributor
timestamp: October 24, 2010, 02:58:11 pm
content: 5V and always. if your circuit is made poorly, sure it can kill your mcu. and even your PC USB port/hub.

author: migsantiago
author_rank: Frequent Contributor
timestamp: October 24, 2010, 03:48:02 pm
content: Every single USB port must deliver the following power:Low power port: 5V, 100mA maximumHigh power port: 5V, 500mA maximumGood USB ports disable the 5V supply when the computer is turned off(by software or by hardware jumpers). Cheap USB ports always enable the 5V output, even with your computer turned off.If you are going to use a PIC24 and a USB port, use a 3.3V regulator to power the PIC.Make sure that your PIC will not draw more than 100mA.NEVERSUPPLY ANY VOLTAGE OR CURRENT BACK TO THE VBUS PIN (5V pin).NEVERCONNECT MORE THAN 10uF OF CAPACITANCE TO THE VBUS PIN (5V pin).

author: NiHaoMike
author_rank: Super Contributor
timestamp: October 24, 2010, 05:43:37 pm
content: Quote from: migsantiago on October 24, 2010, 03:48:02 pmThe only USB ports I have seen that could remain on with the computer off were in a Dell laptop, and it was marketed as a feature. Basically, the USB ports turn on whenever the AC adapter is plugged in, to allow users to charge cell phones and other electronics from the USB ports without turning the computer on. That feature can be disabled in BIOS.

author: DJPhil
author_rank: Frequent Contributor
timestamp: October 24, 2010, 05:49:06 pm
content: Quote from: NiHaoMike on October 24, 2010, 05:43:37 pmThe last good laptop I worked with was a Compal (not a typo) IFL90, they make very nice ODM laptops that gets rebranded into all sorts of things (Dell and Alienware among them). The IFL90 had an external button and indicator light that would allow 500mA charging on the usb ports, with or without the compter on and with or without power. Very nice feature for emergency cellphone use.

author: RayJones
author_rank: Frequent Contributor
timestamp: October 24, 2010, 06:44:47 pm
content: The 5V that may be present on a USB port with the power off is so features such as wake on mouse or wake on keyboard can actually function.The 5V is actually sourced from the 5V standby line from the power supply, and for us at work it is really handy to power and internal independent watchdog. We build special cables to plug onto an internal USB header and thus power the watchdog without needing to vampire the power supply's purple wire.Your ATX based PC is never OFF, it is in a low power standby when you press that front panel switch, and the power on the USB's (if present) is one and the same.So some may consider it a nuisance, some consider it essential.

author: NiHaoMike
author_rank: Super Contributor
timestamp: October 24, 2010, 07:57:00 pm
content: The main problem with that is powering all the USB ports. If there are 10 USB ports, you'll need a power supply that can supply at least 5A to handle worst case load. I'm not aware of any standard ATX power supply that can supply that much in standby. (Powering only some USBs in standby would work, though.) Not a problem for a laptop since the AC adapter can always supply its full rated current.

author: DavidDLC
author_rank: Frequent Contributor
timestamp: October 24, 2010, 08:15:29 pm
content: If you are designing your own USB device you are responsible to implement it so it will report that is a powered or unpowered device during registratrion.

author: Unknown
author_rank: Unknown
timestamp: October 24, 2010, 08:26:38 pm
content: Quote from: NiHaoMike on October 24, 2010, 07:57:00 pmUSB ports don't have to supply over 100mA unless requested, and they can deny that request, so 1A would be enough for ten ports. Not sure if this handshake is possible without the CPU being enabled, though.

author: migsantiago
author_rank: Frequent Contributor
timestamp: October 24, 2010, 08:38:56 pm
content: Quote from: NiHaoMike on October 24, 2010, 07:57:00 pmA device can only draw 500mA when the OS is running and has configured it, not when the PC is off. The USB port should not provide power when the PC is off because there's no host to manage the current per hub, it's dangerous.Of course, when designers want to use your PC as a USB charger they often ignore the USB standard and do whatever they please.Quote from: alm on October 24, 2010, 08:26:38 pmUSB portsmust alwaysprovide up to 100mA, even before the device has been configured. This behavior enables USB devices "to introduce themselves" to the OS when they do not have an external power supply (i.e. USB memories).Once the device has described itself, it could ask for more current from the host. If the host can provide that current (up to 500mA), then it "configures" the device and lets it draw the current it requires.

author: osmosis321
author_rank: Regular Contributor
timestamp: October 25, 2010, 03:13:10 pm
content: Quote from: DavidDLC on October 24, 2010, 08:15:29 pmI'm using FT232R USB-UART IC. The chip manufacturer supplies basic .inf files, but they just set up a VCP. Registration is taken care of by the chip itself, I believe.

author: cyberfish
author_rank: Regular Contributor
timestamp: October 25, 2010, 04:54:41 pm
content: From the FT232 datasheet, page 14 -http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT232BM.pdfQuote

author: Hewitson
author_rank: Contributor
timestamp: October 28, 2010, 04:16:02 am
content: Quote from: migsantiagoMust? Plenty don't. Motherboard manufacturers rarely pay attention to things like this.Quote from: migsantiagoUnsure where you get that logic from, surely they are supposed to be on so you can turn on the computer with a USB keyboard or mouse.

author: EEVblog
author_rank: Unknown
timestamp: October 28, 2010, 08:12:06 am
content: I've found the 100mA/500mA thing to be generally a rule that is mostly never followed.Every port I have tested has been able to deliver 500mA without asking (i.e. into a dumb resistive load)Dave.

author: cyberfish
author_rank: Regular Contributor
timestamp: October 28, 2010, 08:19:08 am
content: QuoteThat is probably because many products are not compliant (draw 500mA without asking), forcing host implementations to also have to support that. I guess they just don't want to put a USB microcontroller in a cellphone charger that costs $1.I wouldn't be surprised if they remove this requirement in USB 3.0 (did they?). But that will cause problems with unpowered hubs. Who will, I guess, have to detect this overcurrent condition and just shutdown the port.

author: cyberfish
author_rank: Regular Contributor
timestamp: October 28, 2010, 08:21:49 am
content: For another example of where this current limit matters, I am currently working with a single board computer (gumstix) that has a USB OTG port that will only source 100mA, and will blow up if USB slave tries to draw 500mA.My webcam does proper power negotiation, and correctly refuses to work when the host doesn't want to give it 500mA.I had to slice the USB cable and provide my own power from a 7805.

author: Mechatrommer
author_rank: Super Contributor
timestamp: October 28, 2010, 01:23:28 pm
content: my PC USB will reset the device/itself if accidental short is occured. did that while poking around Arduino, luckily it didnt blow up.

author: migsantiago
author_rank: Frequent Contributor
timestamp: October 28, 2010, 02:56:39 pm
content: Quote from: Hewitson on October 28, 2010, 04:16:02 amYeah, must... and plenty don't. The USB specification is not followed at 100%, I know.For example, my laptop disables its USB ports when it's turned off. USB power must not be supplied when the host is not working... but as you said before, the manufacturers don't do so.

author: RayJones
author_rank: Frequent Contributor
timestamp: October 28, 2010, 08:10:00 pm
content: Quote from: migsantiago on October 28, 2010, 02:56:39 pmAny citation for such a statement?I'd consider a good USB port to be one that allowsthe individual userto choose whether the power stays or goes with power off.Enforcing one form or the other will always get one type of customer offside.

author: migsantiago
author_rank: Frequent Contributor
timestamp: October 28, 2010, 09:38:00 pm
content: Quote from: RayJones on October 28, 2010, 08:10:00 pmHello. This is the complete USB 2.0 standard (usb_20.pdf).http://www.usb.org/developers/docs/usb_20_081810.zipI am afraid there's no direct citation for what I said, but it can actually be deduced from the following text.QuoteIf the host is not working, current control is not guaranteed, and the possibility of damaging the USB port is present. Therefore, power should not be supplied.QuoteThe hub should not supply any current if the host will not manage it. Therefore, if the host is turned off, every USB port power should aswell be turned off.Please view the Table 7-7 I attached. As you can see, a managed USB port should only provide 100mA of current when a device is not configured (not enumerated). After the device has "spoken" with the host, the host lets it withdraw up to 500mA of current (high power port only).What actually is happening is that MoBo manufacturers do not implement the current measuring and host controlling. If a PC is turned off, then its host (chip controller) is turned off, and no power should be delivered.

author: cyberfish
author_rank: Regular Contributor
timestamp: October 29, 2010, 02:38:56 am
content: I don't think "software control" is required for host if the host can put out 500mA.It doesn't make sense for the host to limit current output to 100mA if it can put out 500mA.The software handshake is for when the host can't source 500mA. That's why the specification says the client has to ask before drawing >100mA, not the host has to limit the current to 100mA before the client asks.If a host can source 500mA, it can just ignore the high current request, and always grant it.On the other hand, a host that can only source 100mA will just always decline the request. Again, no change in electrical behaviour.So a motherboard that will source 500mA without the client asking is standard compliant, but a client that draws 500mA without asking is not.

author: EEVblog
author_rank: Unknown
timestamp: October 29, 2010, 03:56:34 am
content: Quote from: cyberfish on October 29, 2010, 02:38:56 amGosh darn it, my latest project is not compliant!Dave.

author: migsantiago
author_rank: Frequent Contributor
timestamp: October 29, 2010, 03:08:31 pm
content: Yeah, the USB standard is perfect in every way... but we designers just ignore it.There's a special USB State called suspend in which the device must reduce its consumption to 2.5mA. The USB libraries that the CCS compiler ships do not implement that power consumption, it's up to me... but I've never done so.Most students nowadays use the USB port as a plain power supply, they plug whatever they need and sink any current they want.So, USB powers are ideal... in reality, you do whatever you want with themEDIT: It seems that in the latest version the CCS compiler actually implements suspensionCode:/*******************************************************************************/* usb_isr_uidle()/*/* Summary: USB peripheral detected IDLE. Put the USB peripheral to sleep./*/********************************************************************************/void usb_isr_uidle() {UIR_UIDLE=0;bit_set(UCTRL,1); //set suspend. we are now suspendedbit_clear(UIR,2); //clear activity interept flagbit_set(UIE,2); //enable activity interrupt flag. (we are now suspended until we get an activity interrupt. nice)}