What happens when you draw too much current from a usb port? - Page 1
Forum section: electronics / general

author: chrisb741
author_rank: Regular Contributor
timestamp: December 22, 2023, 08:33:20 pm
content: Hi,What happens when you draw too much current from a usb portI've heard reports from people having issues with their development boards when they connect high powered things like relay, servo or a motor up to their board when its powered by a PC/laptop usb port.I tried to replicate this with a bench power supply set to 5V and 500mA. Unless I connect up significantly more devices I dont seem to have a problem.What exactly is happening?It seems that the usb supply from the computer is significantly more sensitive to oversupply or current and will momentarily cut all power much faster when too much current is supplied. Is this what happens?

author: Andy Chee
author_rank: Super Contributor
timestamp: December 22, 2023, 08:52:44 pm
content: Current limiting is part of the USB specification.I don't know the specific document, but I'm sure someone here does!https://www.usb.org/documents

author: jpanhalt
author_rank: Super Contributor
timestamp: December 22, 2023, 08:54:04 pm
content: According to this, they are supposed to be "protected from shorts." That doesn't mean the port you are dealing with meets that specification.https://electronics.stackexchange.com/questions/541851/can-a-short-circuit-kill-the-usb-port-of-a-pc

author: amyk
author_rank: Super Contributor
timestamp: December 22, 2023, 09:03:09 pm
content: You can look at some typical mobo schematics and see for yourself:https://www.eevblog.com/forum/projects/simplest-way-to-get-500ma-out-of-usb/msg4970242/#msg4970242

author: nctnico
author_rank: Super Contributor
timestamp: December 22, 2023, 09:05:49 pm
content: There are several options for implementers. Gradually lowering the voltage is one of the methods

author: chrisb741
author_rank: Regular Contributor
timestamp: December 22, 2023, 09:28:21 pm
content: There is a lot to read and a lot of discussion about it.Might be easier to just run my own tests on actual usb PC hardware and hubs, no one has ever reported a burnt out port and certain I've over powered a usb port before.The only issue I'll have is I can only test my own USB ports, not anyone else's. The possibility of the mentioned 100mA limit would fit my testing when I supplied a lower current from the bench supply. That did result in the very similar issues other were reporting with the same equipment attached

author: SiliconWizard
author_rank: Super Contributor
timestamp: December 22, 2023, 09:52:30 pm
content: The standard gives requirements in terms of what a device should draw in a given condition. In terms of device, it's maximum values. In terms of host, it's obviously the converse, minimum values. The standard doesn't mandate anything about how a host should handle it. So don't make any assumption, it's entirely implementation-defined. Measuring what happens on a particular host will not help you. That's just the definition of a particular case.The bottom line is that, as a USB device designer, you *should* comply with the maximum values specified in the standard. If you don't, you're on your own, and don't expect that to never break. It's like relying on undefined behavior in software programming.If you want to test that you device(s) comply, relying on a host's behavior, due to the above, won't help. The only thing to do is measure current directly with your own tools.

author: chrisb741
author_rank: Regular Contributor
timestamp: December 22, 2023, 09:58:15 pm
content: Quote from: SiliconWizard on December 22, 2023, 09:52:30 pmThat is what I'm going to do

author: SiliconWizard
author_rank: Super Contributor
timestamp: December 22, 2023, 10:03:41 pm
content: Since the measurements don't need to be ultra accurate, what I recommend is just using a small shunt in series with VBUS and taking scope captures. That'll make you see the dynamic current consumption, particularly interesting when plugging in the device and until it enumerates, but also during other phases just to see what the max is (and possibly when that happens).

author: langwadt
author_rank: Super Contributor
timestamp: December 22, 2023, 11:56:38 pm
content: Quote from: chrisb741 on December 22, 2023, 08:33:20 pmunless you ask for it you are not allowed more than 100mA on USB

author: tom66
author_rank: Super Contributor
timestamp: December 23, 2023, 12:13:06 am
content: In my experience, most USB ports have a hard current limit (greater than the 500mA specification) and cut the power to the port, or sometimes all ports on a device, when that limit is exceeded. If you do this on a Windows PC, you'll usually get a notification about a device malfunctioning, and then wonder why you can't type on the keyboard any more. In many cases, this can only be recovered from by hard power cycling the whole PC (suspend is not sufficient).Very few (I've never encountered one) actually meter the current or implement the unit load limiting as specified by USB-IF, so whatever the limit is applies regardless of whether the device has negotiated. Personally, I'm not a fan of the way USB negotiates power, it should have been designed to always be a guaranteed x mA output current, though admittedly USB hubs do make this problem more difficult. As implemented, it prevents moderate power system-on-chip devices from complying to the USB specification, since these devices have to boot themselves up to negotiate the current required - a little tautological. So, it's good that the limit just appears to be a single hard limit - though of course you're on your own here if anything goes wrong.

author: langwadt
author_rank: Super Contributor
timestamp: December 23, 2023, 12:29:27 am
content: Quote from: tom66 on December 23, 2023, 12:13:06 amwell USB does guarantee a current, 100mA and more would be problem because as you mention what would you do if every port on a hub uses 500mA?what PC actually do varies, I've had a laptop that seemed to have not limit at all, shorting the usb bus would just instantly shut down the whole computerBut think I've heard of MAC users that couldn't get a devkit to enumerate because it used over 100mA

author: tom66
author_rank: Super Contributor
timestamp: December 23, 2023, 12:38:38 am
content: Quote from: langwadt on December 23, 2023, 12:29:27 amYeah, the trouble is 100mA isn't enough for a lot of modern devices. Even some mid-tier microcontrollers are approaching limits like that, so you have to be careful to keep things like e.g. display backlights off when powering up over USB to avoid exceeding it. We make devices with a Zynq in them - operating current is about 300mA - no way to negotiate that via USB without having the Zynq on so we're just stuck violating the spec.

author: Smokey
author_rank: Super Contributor
timestamp: December 23, 2023, 02:09:31 am
content: I recently made a device that constant current charges an internal battery over USB2 (MicroB). I was not initially doing any enumerating/signaling with the host/adapters, and I never had a single host/adapter restrict me to 100mA.

author: David Hess
author_rank: Super Contributor
timestamp: December 23, 2023, 02:40:26 am
content: I have seen all kinds of behavior.The oldest Intel USB ports that I had reported current draw in the driver interface down to the milliamp, and if the device violated 500 miliamps, or 100 milliamps if not enumerated, then power to that port was removed. You can find USB power controllers which support this.Strict protection seems to have been dropped, and later ports I used had a polyfuse at most, and sometimes nothing, so enumeration for 500 milliamps was irrelevant.Now everything seems to expect at least 900 milliamps without enumeration.

author: chrisb741
author_rank: Regular Contributor
timestamp: December 23, 2023, 03:45:07 am
content: I have test equipment to accurately test load, as long one port limits power to 100mA I'm satisfied that's the limit for these other people reporting problems. As mentioned even the basic uC dev boards use 50-75mA. Does not leave much from 100mA

author: Dan123456
author_rank: Regular Contributor
timestamp: December 23, 2023, 04:29:52 am
content: I had the mother board fail on my work laptop not too long ago and it took the dongle for my headset out with it.I don’t know exactly what went wrong with it but plugging the dongle into a different laptop gave me a pop up saying “USB port drawing too much current” and that would keep popping up every 10 seconds or so.As it was work equipment, I didn’t want to / wouldn’t be allowed to mess around with it / dig further but I would guess maybe the computer was getting the message that it was pulling to much current, killing power to the port, then retrying after a set period of time.Ether that or the dongle had an intermittent fault

author: chrisb741
author_rank: Regular Contributor
timestamp: December 23, 2023, 07:52:19 am
content: I've had just a cable intermittently cause a popup saying the last device I plugged in has failed

author: mariush
author_rank: Super Contributor
timestamp: December 23, 2023, 08:10:40 am
content: I've seen resettable fuses on motherboards ...for example a 2.4A fuse on 4 usb 2.0 ports or 2 usb 3.0 ports.

author: Buriedcode
author_rank: Super Contributor
timestamp: December 25, 2023, 09:12:29 pm
content: All host posts I've seen (not charging ports from plug in PSU's) have had both resetable SMD fuse and a USB power distribution switch that monitors current and allows software control of the power to that port. The current limits aren't particularly accurate, and provide a single pin state output for overcurrent. Those IC's also have thermal shutdown and short circuit protection.These are generally "good enough" to protect the host from shorts, and will have some leeway as to the maximum current. In the past decade or so I haven't seen a host limit to 100mA but I'm only going for the PC's, lpatops and tablets I've used.

author: janoc
author_rank: Super Contributor
timestamp: December 25, 2023, 09:44:17 pm
content: I have seen USB port controllers or even entire motherboards fried by overcurrent/short on USB ports, so don't assume they are protected against it or that you can blindly draw more than 500mA. Even that is often too much on older devices, esp. anything powered from batteries (older laptops).Also assuming that all manufacturers of every gadget or gizmo having a USB port actually follow the standard and sane design practices instead of pinching pennies on overcurrent protection is foolish ...E.g. if the only protection is a polyfuse then you are at risk - that is a rather slow device and a large current spike may kill something on the board before the fuse has time to react and disable the power.And powering anything like a motor, servo or solenoid from a USB port of a laptop is asking for a very expensive repair. The issue isn't only the current but also the high voltage spikes due to the back-EMF from these devices - and USB ports are rarely protected against them. A lot of people have fried ports or entire laptops like this. Just don't do this.If you really must deal with a project like this, use at least a disposable USB hub between your laptop and the project, so when something gets fried, it will be likely the easy to replace hub and not your computer. Even better would be to use a cheap USB isolator and power the load from an external supply instead.

author: chrisb741
author_rank: Regular Contributor
timestamp: December 26, 2023, 01:25:23 am
content: I tested with a resistive load. I can't find any 100mA limit.I'm not testing to failure or destruction

author: janoc
author_rank: Super Contributor
timestamp: December 26, 2023, 06:00:52 pm
content: Quote from: chrisb741 on December 26, 2023, 01:25:23 am100mA is not a hard limit but a specification. A bus powered device on an USB A port is not allowed to draw more than 100mA before enumeration and asking for more via the descriptor (USB C has the PD spec and negotiation but that's a different system). Most devices will tolerate drawing up to 500mA without negotiation but it does violate the USB spec. E.g. if you will try to get the USB certification because you want to carry the official logo or apply for a VID, then you will fail it if the device behaves like this.That you didn't hit that limit on your device or nothing happened (port switching off, etc.) doesn't mean that it is OK to do this or that it won't happen on another hardware.Usually on a old style USB 1.x ports the limit is around 500mA - if you exceed it the port will most often cut out and your OS will report an error, often indicating that a device has malfunctioned or that there was an overcurrent event. Desktop computers may deliver more current even though spec only says 500mA - but one can't rely on that, it is far from universal.On more modern machines some USB A ports can handle up to 3/5A. However, without enumerating and getting it actually confirmed by the host that it really is capable of supplying that current (and it is not only an old school 500mA capable port) it is dangerous to attempt to exceed those 100mA/500mA - there are plenty of poorly designed ports around and you can easily blow them out.