Design flaw? Polyfuses for USB current limiting


 
246 posts   Page 1 of 10   1, 2, 3, 4, 5 ... 10
by simonbr » Sun May 13, 2012 6:28 pm
Hi,

I encountered what may be a problematic design flaw in the Raspberry Pi Model B.

From the schematic, the output current of each USB port is limited to a nominal 140 mA using a miniSMDC014. Although limiting the current may be a good idea, the side effect is a large voltage drop.

According to its datasheet, the resistance of the miniSMDC014 can be up to 6 ohms at room temperature (I measured the ones on my unit and they are just over 5 ohms).

This means that if you draw 140mA or even some more (which is easily done with a wifi dongle) the USB power supply voltage drops to near 4V which is far outside the USB specs.

For the last few days I was trying, in vain, to get my wifi dongle (RT2770 based) to work. But all the erratic behaviour I was seeing vanished after I ran a wire from the Raspberry Pi 5V input to the USB sockets pins 1 (effectively bridging the fuses).

In conclusion:
1. If you can't get your wifi dongle or other USB device to work with the Raspberry Pi, you might be able to fix it by bridging F1 and/or F2
2. Current limiting on the USB ports (its implementation or even having it at all) may need to be rethought.

Best regards
Simon Brouwer
Posts: 23
Joined: Sun May 13, 2012 5:02 pm
by Gert van Loo » Sun May 13, 2012 7:01 pm
You are taking a schematic and then do some 'reverse engineering'. That is not a good idea in general as you do not get the full design parameters as used by the designers of the hardware. (Which by the way I am one of them).
You should not draw more then about 100mA from the USB ports. At that current the polyfuses will have a negligible resistance.
It is the same with ordinary fuses: You will not load a 3A fuse with 3 Amps. It will blow out. Maybe not immediately but after a very short while.
User avatar
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1982
Joined: Tue Aug 02, 2011 7:27 am
by Morgaine » Sun May 13, 2012 7:53 pm
I can't seem to find a detailed datasheet for the miniSMDC014, just this rather threadbare thing --- http://www.farnell.com/datasheets/88959.pdf --- which just tells us that the resistance can be anywhere between 1.5 and 6.0 ohms, and gives us some idea of trip point. Not exactly detailed.

If its resistance is very non-linear below the trip point as Gert suggests then it would be useful to see proper resistance curves at each temperature. Anyone got a better datasheet or application note for this component?

Morgaine.
Intolerance is a failure of education. Education is predicated on tolerance of the uneducated.
User avatar
Posts: 141
Joined: Mon Mar 12, 2012 1:13 am
by jbeale » Sun May 13, 2012 7:55 pm
The recommended way to run devices needing more than 100 mA is to use an external powered hub. It is also possible to make a "cheater" USB cable which takes a separate +5V power feed (essentially a poor-man's 1-port powered hub). That's almost what you did, except doing it on the board can present some other issues, eg. overloading the main input fuse and starving the Pi for voltage.
User avatar
Posts: 1964
Joined: Tue Nov 22, 2011 11:51 pm
by simonbr » Sun May 13, 2012 8:10 pm
Hi Gert,

I'm sorry, but I don't agree with your statement that the resistance of the polyfuses will be negligible at 100 mA.
As mentioned the polyfuses on my unit were a bit over 5 ohms (resistance measurement with a multimeter, not calculating from a voltage drop at significant current).
Even at 100 mA that already results in a voltage drop of more than 0.5V.

Best regards
Simon
Posts: 23
Joined: Sun May 13, 2012 5:02 pm
by simonbr » Sun May 13, 2012 8:25 pm
jbeale wrote:It is also possible to make a "cheater" USB cable which takes a separate +5V power feed (essentially a poor-man's 1-port powered hub). That's almost what you did, except doing it on the board can present some other issues, eg. overloading the main input fuse and starving the Pi for voltage.


Actually I took the 5V from in front of the main input fuse. A switching AC adapter will have overcurrent protection as well, anyway.

And if I didn't: I am pretty sure that the main fuse has a maximum resistance of at most a few hundred milli-ohms, which results in voltage drops of only tens of millivolts for each additional 100 mA, unlikely to result in problems.

Best regards
Simon
Posts: 23
Joined: Sun May 13, 2012 5:02 pm
by mahjongg » Sun May 13, 2012 10:44 pm
I agree, using a 140mA (poly)fuse at that point seems to be creating a lot of problems at the moment, just read the forum and you will find many problems related to the polyfuse causing a noticeable drop causing many peripherals, including keyboards and WiFi adapters to malfunction.
The FAQ is recommending the use of a keyboard with a built in HUB, but that means that keyboard+hub+whatever-you-connect-to-the-hub will draw far too much current through the single polyfuse.If you take reasonable estimates, a keyboard will be 35mA, a HUB maybe 50, and a mouse perhaps 20, it will quickly add up to over a hundred milliamps, far too near to the tripping point of the polyfuse. I would recommend using a polyfuse that trips only at a short circuit condition, say at least 3 to 5 times the normal operating current. People tend to forget that (poly)fuses by nature use the energy lost in the fuse when near its tripping point to heat up the device, this uses a non negligible amount of power, so if you operate it anywhere near it tripping point it will dissipate almost a hundred milliwatt (0,5 Volt x 140ma = 70mW) and will drop the output voltage far below the allowed minimum of 4.75 Volt for most 5V devices.

The only solution is to use a far higher rated fuse (or none at all).
In any case for a polyfuse to not cause problems at 100mA its "cold resistance" must be guaranteed to be below 3 Ohm, but that is still living near the edge, it will still cause problems if the input voltage is slightly below 5.00 Volt.

An article about using polyfuses to protect USB ports can be found here:
http://www.ce-mag.com/archive/2000/mayjune/hapan.html

The core of the article is that USB asks for a limiting of the current to be below 5A to protect the contacts in the connector. So using a 2 or 3A polyfuse should be possible. In this case the best choice would probably be a 1A polyfuse, same as on the power input.
User avatar
Forum Moderator
Forum Moderator
Posts: 4886
Joined: Sun Mar 11, 2012 12:19 am
by jojopi » Sun May 13, 2012 11:59 pm
mahjongg wrote:In this case the best choice would probably be a 1A polyfuse, same as on the power input.

What a silly suggestion. The purpose of F1 and F2 is to trip the power to a peripheral without crashing the entire board. If they were as high a value as F3 then F3 would be most likely to open instead. You might as well do away with F1 and F2 as increase them.

The USB2.0 spec allows low-powered ports to provide a Vbus of 4.4V minimum. So there is a reasonable margin for voltage drop on F1 and F2 at 100mA.

Incidentally, you can check the reported maximum current values for the current USB peripherals with "sudo lsusb -v |grep MaxPower". If any of these are over 100mA then they are not suitable for direct connection to the Pi.
User avatar
Posts: 1953
Joined: Tue Oct 11, 2011 8:38 pm
by milhouse » Mon May 14, 2012 1:25 am
jojopi wrote:If any of these are over 100mA then they are not suitable for direct connection to the Pi.


This seems like bad advice, as "lsusb -v|grep MaxPower" informs me that a tiny 8GB USB memory stick (image) has a max power of 500mA yet it works perfectly in a RasPi:

Code: Select all
Bus 001 Device 004: ID 18a5:023c Verbatim, Ltd
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x18a5 Verbatim, Ltd
  idProduct          0x023c
  bcdDevice            2.3c
  iManufacturer           1 Verbatim
  iProduct                2 micro USB Flash Drive
  iSerial                 3 10082613030274
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
Posts: 552
Joined: Mon Jan 16, 2012 12:59 pm
by Morgaine » Mon May 14, 2012 5:58 am
I can't say I like this concept of destroying USB voltage regulation just to give us some current limiting. It can have all manner of nasty consequences on downstream USB devices that are expecting a well regulated supply rail.

Morgaine.
Intolerance is a failure of education. Education is predicated on tolerance of the uneducated.
User avatar
Posts: 141
Joined: Mon Mar 12, 2012 1:13 am
by cheery » Mon May 14, 2012 6:23 am
Morgaine: Seems like many keyboards with LED displays and such also don't like about that concept. There's about tons of troubled messages about this kind of problems on these forums.
User avatar
Posts: 219
Joined: Wed Jan 25, 2012 9:39 pm
by simonbr » Mon May 14, 2012 8:23 am
mahjongg wrote:The USB2.0 spec allows low-powered ports to provide a Vbus of 4.4V minimum. So there is a reasonable margin for voltage drop on F1 and F2 at 100mA.


Well not quite, if you take into account that the input power supply voltage may be slightly lower than 5.0 V.

Assuming there are good reasons for keeping this protection, I think a simple improvement would be to use a single polyfuse, with double the current rating, shared by both USB ports. A comparable polyfuse with double the current rating should have a resistance that is around 4 times as small (since dissipation is I*I*R).

So in the worst case (two USB devices are used that draw equal amount of current) you will only have half the voltage drop.

In addition, when using one USB device that draws little current, more current will be available for the second one.

As a bonus it would reduce the component cost.

Best regards
Simon
Posts: 23
Joined: Sun May 13, 2012 5:02 pm
by mahjongg » Mon May 14, 2012 10:18 am
Protection from a (poly)fuse is intended as a safety measure, to protect from dramatic destruction of the device it protects (in this case the R-PI), not to secure normal operation when you plug in a shorted keyboard, so there is nothing "silly" about using a 1Amp fuse, its there only to protect against burned connectors and evaporated tracks not against "business as usual" when you plug in a keyboard with a short.
I have a fairly typical Mac keyboard with two built in USB ports (to connect a mouse to), and its rated 200mA @5V.
A typical DELL keyboard without any bells and whistles is rated 100mA @5V. I do not think its going to work with 4.4 Volt!

Please read the white paper I linked to, it gives calculating examples on how to calculate the allowed resistance of the whole chain of the power link, including ferrite beads, connector contact resistance and also the polyfuse, and allowed voltage drops in these devices is expressed in mere millivolts.

Using a single polyfuse for both USB connectors isn't recommended practice, but in this case its better as one of them is likely to be used for a mouse, and they tend to be less current hungry (although a typical one is also rated 100mA @5V).
User avatar
Forum Moderator
Forum Moderator
Posts: 4886
Joined: Sun Mar 11, 2012 12:19 am
by Neil » Mon May 14, 2012 11:25 am
mahjongg wrote:Protection from a (poly)fuse is intended as a safety measure, to protect from dramatic destruction of the device it protects (in this case the R-PI), not to secure normal operation


Exactly. It sounds like those polyfuses are speced way too small.

When a USB device is first connected it must be in a low-power mode, consuming a few tens of milliamps. Then it starts enumeration. In the early stages of USB enumeration the device says how much power it wants. The host then either grants it, and connection ensues and the device ramps up its power consumption up to what it asked for, or the host denies it, and the OS usually pops up a little box or something to say you're plugged in a power-hungry device into a low-power port, and the device doesn't enumerate, doesn't consume maximum power, doesn't do squat.

So there is no need to use a polyfuse to enforce the USB power management scheme. The polyfuse is to protect the power supply from shorts on any connected USB cables. That's all.

Neil
Posts: 89
Joined: Thu Sep 29, 2011 7:10 am
by MrEngman » Mon May 14, 2012 3:14 pm
Interesting.

Personally I am not convinced that there is any design flaw as such. Using polyfuses for protecting the USB is I believe a fairly common practice. There are, however; several issues that need thinking about the PSU being a significant one, but there are also others just as relevant.

I think a major issue, however, is that most people just know the term USB and don't realise there is a low power version (max current 100mA) and a high power version (max current 500mA) so people just plug in their devices and expect them to work. And anyway how do you find out if your device is compatible with a low power port or not. There is certainly no mention of power requirements for my device in any of the documentation I seen and searched through. Then of course there are software problems to contend with as well. Making people aware if these issues is important.

Using "lsusb -v|grep MaxPower", thanks Jojopi, shows my Wifi adapter, Micronet SP907NS, uses a max 500mA but it works fine plugged directly into the Pi USB port. The adapter uses the rtl8188cus and a spec for this device that I found actually suggests a max current of 129mA at 87Mbps. Measuring the current the maximum I've seen is around about 118mA. So even though it is classed as a high power device it works OK in the Pi's low power port.

The MaxPower value I expect is there to show whether a device is low power USB compatible (100mA) or high power compatible (500mA) and not that this is the real max current it will take. Anything that may take more that 100mA will show up as 500mA and as some of us are finding so called high power devices will work directly plugged into the Pi so presumably the actual power required is likely to be not much over the 100mA limit. However, if MaxPower does show 500mA and it does not work then you will need to try a hub to connect it to the Pi, or you may just be having a software problem or a combination of both if you are unlucky.

Voltage levels at the USB port are not determine solely by the voltage drop across fuses F1 and F2 as there is also the drop across the main power fuse F3 and the cable from the PSU to take account of. And of course what is the voltage output from the PSU. Currently my PSU, an old switched mode supply, is set to 5.4v and the voltage across TP1-TP2 is 4.99v when Pi is idle. The voltage drop across fuse F3 is about 0.15v, and across the power cable about 0.25v. With the wifi active TP1-TP2 drops to around 4.9v. Using a different much more substantial and shorter USB cable, from a USB powered DVD writer, to supply the main power reduces the voltage drop from PSU to TP1 by about 0.2v producing a much more stable voltage across TP1-TP2 under varying loads.

The main power connector is of course a micro USB connector and I believe this has been fitted to allow PSU's like mobile phone chargers to be used. This is the only area where I have doubts about the design as I doubt phone chargers are as stable as are really needed and could give significant voltages drops when under load. I believe something more substantial should be recommended. And the power lead should be as short as possible and reasonable wire gauge.

Now a suggestion about fuses. How about changing the USB fuses so they match the requirements for 500 mA USB power. These would probably then need to be 750mA. This would also require changing the main power fuse to at least 2.0A although 2.6A would probably be better choice. A significant advantage would be a big reduction in the resistive value of the higher current fuses compare with the ones currently used and consequentially a more stable supply voltage. The max resistance of the current fuses is 6ohms for F1 and F2 and 0.21ohms for F3 (from Littlefuse specs). For 750mA fuses the max resistance is 0.45ohms and for the 2.6A fuse 0.047ohms, a very significant reduction in resistance.

Gert, FYI I measured the restance of both F1 and F2 on my Pi with no power on the board and no usb devices plugged in and F1 measured 4.8 ohms and F2 5.2 ohms, not that insignificant.

Now for the PSU. How about a small DC-DC converter taking input from something like a laptop PSU or something similar and outputting 5.1v-5.2v to take account of the voltage drop across the power input fuse, F3. The design should be fairly straight forward. In fact I think if you look at Texas Instruments or one of the other companies producing DC converter chips you will find they produce a number of small units for testing their DC converter chips and one of those may be suitable. They even supply samples for free.

Finally a suggestion for the software guys so you don't feel left out. For the current version of Pi why not, when initialising the USB devices, read the MaxPower value and if it is 500mA output a warning on the screen that the device may have problems unless it is connected via a hub rather than directly to the PI's USB port. Rather Pi specific but I don't recollect seeing a low power USB port before.

So, in conclusion, for a stable system with the current revision of Pi a PSU outputting at least 5.2v and a short and substantial PSU cable. A warning on the screen if the USB device needs to use a 500mA USB port that it should be connected via a hub. For a new revision of Pi a change to fuse values to allow higher powered USB devices to be connected.
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra
Posts: 1760
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK
by Dave_G_2 » Mon May 14, 2012 3:30 pm
I understand why the 140mA polyfuses are used, but surely this makes the Raspi's USB ports
non-standard as the USB spec states that devices may "ask" for 500mA if required and many devices do.
Surely the polyfuses should be 550mA (or closest) which would still afford protection whilst making the
USB ports 100% compatible with the USB spec.

By the way, running lsusb does not show the actual current the device is physically drawing but rather
what it could draw as a maximum.
I have seen many USB flash drives reporting 500mA (via lsusb) but when I measured the actual current
it was only around 220mA.
I suspect many manufacturers simply hardcode 500mA into the appropriate register which is not a
real indication of what the device draws.
User avatar
Posts: 196
Joined: Sat Apr 14, 2012 7:04 pm
by xtramural » Mon May 14, 2012 3:46 pm
This whole thread has ben very informative and interesting. As someone in possession of a Pi that seems to hang after a few minutes I had initially considered that it might have a PSU issue but had ruled this out since I had tried a generic powered hub, a Belkin PSU rated at 5V 1A and a Nokia AC-10X rated at 5V 1200mA - all to no avail. WIth all three power PSUs the voltage across TP1 and TP2 seemed to be well within spec and other Pi owners seem to have had success with the likes of the Nokia charger.

What I would really like to see is a definitive statement about the PSUs that are known to be good and/or official PSUs from Farnell or RS that are guaranteed to work. As it is, I'm still unsure of whether or not my Pi woes are power-related and, if so, how I can really tell without the need to invest in bench supplies, test kit over and above a multimeter, etc.
Posts: 104
Joined: Thu Dec 29, 2011 11:16 pm
Location: Scotland
by mahjongg » Mon May 14, 2012 4:06 pm
MrEngman wrote:Interesting.

Personally I am not convinced that there is any design flaw as such. Using polyfuses for protecting the USB is I believe a fairly common practice. There are, however; several issues that need thinking about the PSU being a significant one, but there are also others just as relevant.

I think a major issue, however, is that most people just know the term USB and don't realise there is a low power version (max current 100mA) and a high power version (max current 500mA) so people just plug in their devices and expect them to work.


These are USB-2 ports, only USB-1 ports are expected to only support low power (low speed) devices.

Using Polyfuses to protect USB ports is common practice, but they are supposed to have resistances in the milli ohms, so that only a few tens of millivolt drops over them at ranges a few 100mA. The only way to accomplish that is to have polyfuses that trigger only at much higher currents.
User avatar
Forum Moderator
Forum Moderator
Posts: 4886
Joined: Sun Mar 11, 2012 12:19 am
by Morgaine » Mon May 14, 2012 4:30 pm
+1 to mahjongg's last point.

Which takes me back to my initial quest for fully detailed information on the electrical characteristics of these polyfuses. That brief PDF I linked is far below what is considered detailed design information in the industry. I expect parametric curves for pre-trip operation at the very least, so that a designer can target a desired safe operating region without using guesswork. And the post-trip holding current curves would be useful too.
Intolerance is a failure of education. Education is predicated on tolerance of the uneducated.
User avatar
Posts: 141
Joined: Mon Mar 12, 2012 1:13 am
by Dave_G_2 » Mon May 14, 2012 5:33 pm
Below is a link to a pdf by Micrel which has some interesting info on USB power protection.
See first 2 pages:

http://www.micrel.com/_PDF/Analog-Solutions/as-02.pdf
User avatar
Posts: 196
Joined: Sat Apr 14, 2012 7:04 pm
by mahjongg » Mon May 14, 2012 6:05 pm
Dave_G_2 wrote:Below is a link to a pdf by Micrel which has some interesting info on USB power protection.
See first 2 pages:

http://www.micrel.com/_PDF/Analog-Solutions/as-02.pdf


Yes, the standard solution for USB protection is using a silicon (chip) current monitor, fault detector and current turn off solution. There is a plethora of such devices, but they all cost a few dimes, while a polyfuse costs mere cents. Also, a chip USB protector needs at least an input and an output GPIO, and software support (in the kernel).

Also, the exact same problem, but seemingly much less problematic, is F3, the fuse in the power input, it is likely that this fuse also can cause a little power drop, but this polyfuse is rated 1,1A, so it is bound to have a much lower internal resistance.

The polyfuses are not identified by brand or order code, F3 is identified as "miniSMD" and "1A1 6V", and the USB polyfuses are marked "miniSMDC014" and "140m 60V".
So its not a simple case of looking up the exact specs of these fuses.
Last edited by mahjongg on Mon May 14, 2012 6:15 pm, edited 1 time in total.
User avatar
Forum Moderator
Forum Moderator
Posts: 4886
Joined: Sun Mar 11, 2012 12:19 am
by MrEngman » Mon May 14, 2012 6:11 pm
Morgaine wrote:+1 to mahjongg's last point.

Which takes me back to my initial quest for fully detailed information on the electrical characteristics of these polyfuses. That brief PDF I linked is far below what is considered detailed design information in the industry. I expect parametric curves for pre-trip operation at the very least, so that a designer can target a desired safe operating region without using guesswork. And the post-trip holding current curves would be useful too.


Try here http://www.littelfuse.com/resettable-ptcs.html
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra
Posts: 1760
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK
by Morgaine » Mon May 14, 2012 6:20 pm
Dave_G_2 wrote:Below is a link to a pdf by Micrel which has some interesting info on USB power protection.
See first 2 pages:

http://www.micrel.com/_PDF/Analog-Solutions/as-02.pdf

Thanks Dave, that is indeed an interesting article.

Micrel's USB power distribution/protection is actually quite reasonably priced even for the small volumes listed. At Farnell:

Worth noting: "On State Resistance: 0.04 ohm".

PS. Not suggesting this is an appropriate device, only that it's an example of what is available for USB power management.

Morgaine.
Intolerance is a failure of education. Education is predicated on tolerance of the uneducated.
User avatar
Posts: 141
Joined: Mon Mar 12, 2012 1:13 am
by Morgaine » Mon May 14, 2012 6:46 pm

Thanks MrEngman, some good info there, if we can assume (for now at least) that their devices are electrically roughly similar to ours.

The specific Littelfuse range closest to our application area seems to be "Lo Rho Surface Mount PPTC" ---- http://www.littelfuse.com/data/en/Data_ ... ho_PTC.pdf . Even their lowest rated device appears to have a trip current of 1.5A though.

Morgaine.
Intolerance is a failure of education. Education is predicated on tolerance of the uneducated.
User avatar
Posts: 141
Joined: Mon Mar 12, 2012 1:13 am
by Dave_G_2 » Mon May 14, 2012 7:16 pm
Tyco make polyfuses with trip currents as low as 150mA (the MICROSMD005F-2)

http://www.te.com/content/te-connectivi ... vices.html

Interestingly, the Rmin resistance is quoted as 3.6 ohms which is not far off the measurements taken
by MrEngman on his Raspi.
User avatar
Posts: 196
Joined: Sat Apr 14, 2012 7:04 pm