Author Topic: What happens when you draw too much current from a usb port?  (Read 2047 times)

0 Members and 1 Guest are viewing this topic.

Offline chrisb741Topic starter

  • Regular Contributor
  • *
  • Posts: 53
  • Country: au
What happens when you draw too much current from a usb port?
« on: December 22, 2023, 08:33:20 pm »
Hi,

What happens when you draw too much current from a usb port
I'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? 
 

Offline Andy Chee

  • Frequent Contributor
  • **
  • Posts: 686
  • Country: au
Re: What happens when you draw too much current from a usb port?
« Reply #1 on: December 22, 2023, 08:52:44 pm »
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
 

Offline jpanhalt

  • Super Contributor
  • ***
  • Posts: 3479
  • Country: us
Re: What happens when you draw too much current from a usb port?
« Reply #2 on: December 22, 2023, 08:54:04 pm »
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
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8276
Re: What happens when you draw too much current from a usb port?
« Reply #3 on: December 22, 2023, 09:03:09 pm »
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
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26907
  • Country: nl
    • NCT Developments
Re: What happens when you draw too much current from a usb port?
« Reply #4 on: December 22, 2023, 09:05:49 pm »
There are several options for implementers. Gradually lowering the voltage is one of the methods
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline chrisb741Topic starter

  • Regular Contributor
  • *
  • Posts: 53
  • Country: au
Re: What happens when you draw too much current from a usb port?
« Reply #5 on: December 22, 2023, 09:28:21 pm »
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

 
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14481
  • Country: fr
Re: What happens when you draw too much current from a usb port?
« Reply #6 on: December 22, 2023, 09:52:30 pm »
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.
 
The following users thanked this post: Someone

Offline chrisb741Topic starter

  • Regular Contributor
  • *
  • Posts: 53
  • Country: au
Re: What happens when you draw too much current from a usb port?
« Reply #7 on: December 22, 2023, 09:58:15 pm »
The only thing to do is measure current directly with your own tools.

That is what I'm going to do
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14481
  • Country: fr
Re: What happens when you draw too much current from a usb port?
« Reply #8 on: December 22, 2023, 10:03:41 pm »
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).
 

Online langwadt

  • Super Contributor
  • ***
  • Posts: 4427
  • Country: dk
Re: What happens when you draw too much current from a usb port?
« Reply #9 on: December 22, 2023, 11:56:38 pm »
Hi,

What happens when you draw too much current from a usb port
I'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?

unless you ask for it you are not allowed more than 100mA on USB
 

Online tom66

  • Super Contributor
  • ***
  • Posts: 6709
  • Country: gb
  • Electronics Hobbyist & FPGA/Embedded Systems EE
Re: What happens when you draw too much current from a usb port?
« Reply #10 on: December 23, 2023, 12:13:06 am »
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.
 

Online langwadt

  • Super Contributor
  • ***
  • Posts: 4427
  • Country: dk
Re: What happens when you draw too much current from a usb port?
« Reply #11 on: December 23, 2023, 12:29:27 am »
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.

well 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 computer
But think I've heard of MAC users that couldn't get a devkit to enumerate because it used over 100mA

 

Online tom66

  • Super Contributor
  • ***
  • Posts: 6709
  • Country: gb
  • Electronics Hobbyist & FPGA/Embedded Systems EE
Re: What happens when you draw too much current from a usb port?
« Reply #12 on: December 23, 2023, 12:38:38 am »
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.

well 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 computer
But think I've heard of MAC users that couldn't get a devkit to enumerate because it used over 100mA

Yeah, 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.
 

Offline Smokey

  • Super Contributor
  • ***
  • Posts: 2593
  • Country: us
  • Not An Expert
Re: What happens when you draw too much current from a usb port?
« Reply #13 on: December 23, 2023, 02:09:31 am »
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. 
« Last Edit: December 23, 2023, 04:00:22 am by Smokey »
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16620
  • Country: us
  • DavidH
Re: What happens when you draw too much current from a usb port?
« Reply #14 on: December 23, 2023, 02:40:26 am »
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.
 

Offline chrisb741Topic starter

  • Regular Contributor
  • *
  • Posts: 53
  • Country: au
Re: What happens when you draw too much current from a usb port?
« Reply #15 on: December 23, 2023, 03:45:07 am »
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
 

Offline Dan123456

  • Regular Contributor
  • *
  • Posts: 199
  • Country: au
Re: What happens when you draw too much current from a usb port?
« Reply #16 on: December 23, 2023, 04:29:52 am »
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  :P
 

Offline chrisb741Topic starter

  • Regular Contributor
  • *
  • Posts: 53
  • Country: au
Re: What happens when you draw too much current from a usb port?
« Reply #17 on: December 23, 2023, 07:52:19 am »
I've had just a cable intermittently cause a popup saying the last device I plugged in has failed
 

Offline mariush

  • Super Contributor
  • ***
  • Posts: 5029
  • Country: ro
  • .
Re: What happens when you draw too much current from a usb port?
« Reply #18 on: December 23, 2023, 08:10:40 am »
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.
 

Online Buriedcode

  • Super Contributor
  • ***
  • Posts: 1612
  • Country: gb
Re: What happens when you draw too much current from a usb port?
« Reply #19 on: December 25, 2023, 09:12:29 pm »
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.
 

Offline janoc

  • Super Contributor
  • ***
  • Posts: 3785
  • Country: de
Re: What happens when you draw too much current from a usb port?
« Reply #20 on: December 25, 2023, 09:44:17 pm »
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.
« Last Edit: December 25, 2023, 09:48:38 pm by janoc »
 

Offline chrisb741Topic starter

  • Regular Contributor
  • *
  • Posts: 53
  • Country: au
Re: What happens when you draw too much current from a usb port?
« Reply #21 on: December 26, 2023, 01:25:23 am »
I tested with a resistive load. I can't find any 100mA limit.
I'm not testing to failure or destruction
 

Offline janoc

  • Super Contributor
  • ***
  • Posts: 3785
  • Country: de
Re: What happens when you draw too much current from a usb port?
« Reply #22 on: December 26, 2023, 06:00:52 pm »
I tested with a resistive load. I can't find any 100mA limit.
I'm not testing to failure or destruction

100mA 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.
« Last Edit: December 26, 2023, 06:23:19 pm by janoc »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf