1
\$\begingroup\$

I'm working on a project that has a USB port connected to to a PIC32MX460F512L. The 5v for the USB is currently coming straight from the VREG. The port is only designed to accept USB flash drives, but it occurred to me that someone might decide to plug in a higher power device. I'm using a linear 5v regulator in my design, and it will definitely overheat if a device tries to draw say 2A from the USB port.

If something besides a flash drive is plugged into the port, I don't care if it charges, or functions. I just want to make sure neither the device nor my circuit will be damaged.

Here's some options I'm considering.

  1. Use a dedicated protection IC. for example: AP21510FM-7

These look perfect, but I can't find any that will limit the current to less than 400ma. That's still too much for my reg so I would have to move to a switching regulator.

  1. Use a simple resistor. Would that work?

  2. Use a PTC with a load rating just above whatever flash drives typically draw.

This is kind of crude, but it should at least protect my VREG.

  1. The most likely device that could be plugged in will be a cellphone I think. I know there are some standards for resistors on the datalines setting the current capacity. So will phones even try to charge from this port? All I currently have on my data lines is a TVS.
\$\endgroup\$
  • \$\begingroup\$ How about adding current limiting to a 317? See 9.2.11 Current-Limited Voltage Regulator \$\endgroup\$ – lakeweb Jan 25 '18 at 23:05
  • 1
    \$\begingroup\$ The simplest solution (other than a dedicated protection IC) is to use a small low-dropout voltage regulator (LDO) rated for, say, 200 mA. It will basically be operating in dropout mode and just used as a current limiter. Check the datasheet on the voltage drop at max current you're designing for. These LDOs are short-circuit, overcurrent, and overtemperature protected. I see one that is 8 cents for 1k quantities so quite cheap. \$\endgroup\$ – Vince Patron Jan 25 '18 at 23:14
  • \$\begingroup\$ The reason why you can't find any under 400 mA is that devices take it for granted that 500 mA is available. The Adata plugged into my computer claims 500 mA, and a Sandisk wants 400 mA. If you limit to less than 500 mA, users will have intermittent failures. \$\endgroup\$ – user71659 Jan 25 '18 at 23:56
  • \$\begingroup\$ What about - use an appropriate PTC thermally coupled with your regulator? \$\endgroup\$ – immibis Jan 26 '18 at 4:10
1
\$\begingroup\$

It looks like you are designing so-called "low-power host". In accord with USB 2.0 specifications, Section 7.2.1, such embedded hosts have a right to exist. You can limit ports on this kind of host to 100 mA, it will be formally ok. It will be also OK if your software stack will connect only to certain class of devices, and reject anything else, as long as the list is declared in device specification. But if your device takes power from external power adapter from AC outlet, there is no excuse - all USB ports must hold VBUS for at least 500 mA load.

If you really want a USB-compliant device, there are hi-side power switches with programmable current limit. For example TPS2552D can start from 75 mA and up.

In case of 100 mA limit, your host software stack should implement strict power policy: during enumeration it should check for power requirements, and n ot configure the attached device if it reports higher than 100 mA consumption. It is likely that vast majority of flash drives might be rejected by this policy, but this seems to be your design choice.

As a last resort, you can try to use a resistor to limit power draw, but it will protect your circuitry only from intelligent devices as smartphones. Current VBUS requirements are as low as 4.4V, so if you have +5V internal source, you can put a 6-Ohms resistor in series. So any device within 100 mA power range will see dropping voltage, but all within USB specifications. If a phone is connected, it will reduce its power intake to maintain VBUS above 4.4V. It is likely too low to charge it, so it will drop off. But some devices might ignore this voltage drop, and load your circuit to full 1 A or something. So a resistor would be one ugly hack.

Also, feeding USB port directly from vital system power rail is a dangerous proposition. You will need to somehow de-couple the USB port from system rail, put a sizable low-ESR capacitor (~120 uF), to protect your internals from inrush currents (which could be up to 5 - 8 A spikes) when a device is hot-plugged in.

\$\endgroup\$
1
\$\begingroup\$

A standard practice here is to use a polymeric PTC, often referred to as a "polyfuse". You may have seen these on devices before -- some versions of the Raspberry Pi used two to limit current to the USB ports, for instance, which can be seen as the green devices in the image below. (Ignore the wire drawn below them.)

enter image description here

\$\endgroup\$
  • \$\begingroup\$ I have seen these before on my own USB boards. I believe they are rated for 500 mA maximum current. They are re-settable fuses. \$\endgroup\$ – Sparky256 Jan 26 '18 at 1:52
  • \$\begingroup\$ They're available in all sorts of different values. 500 mA is common for use in USB hosts, but it's by no means the only one. \$\endgroup\$ – duskwuff Jan 26 '18 at 5:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.