I'm designing a device with USB communications, using an STM32F105 microcontroller. It has a LiPo battery, which charges from the USB port using an LTC4077 charge controller. It will generally use a high-current charging port to charge the battery, but will sometimes be plugged into a PC for data communications.

To stay within the USB specification, the charge controller initially allows a charge current of 100mA. If the STM32F enumerates with an appropriate USB host, it asserts a logic line telling the charge controller to take 500mA.

I have a power switch in between the battery/charger and the rest of the circuit. When the switch is off the microcontroller doesn't have power, and the battery will charge at 100mA.

Q: How do I charge at a higher current without microcontroller intervention?

The USB Battery Charging Spec 1.2 (found here) gives different hardware options for charging ports, to allow "Portable Devices" (like mine) to determine the capabilites of the charging port without enumeration. For example, a "Dedicated Charging Port" (with no communications capability) puts a 200-Ohm resistor between D+ and D-. If the Portable Device detects this connection, then it can assume the device can supply higher current.

I have found some charge-management IC's, such as the MAX77301, which handle this detection and set their charge current levels appropriately. However, they do their own enumeration, and do not pass through the USB data. I assume they can't be placed in parallel with the data communications path.

What am I missing? What is considered good practice, to accomplish what I am looking to do?


  • 2
    \$\begingroup\$ Why can't you have the MCU perform enumeration and then go to sleep? \$\endgroup\$ Oct 28, 2014 at 21:40
  • \$\begingroup\$ " I assume they can't be placed in parallel with the data communications path." Nope - think again. You'd need to embed a USB hub in there to share the USB port. \$\endgroup\$
    – Majenko
    Oct 28, 2014 at 22:01
  • \$\begingroup\$ @IgnacioVazquez-Abrams Thanks! I'll generally be connecting to a Dedicated Charge Port, which is detected by looking for the 200-Ohm connection between D+ and D- (not by enumeration). I was hoping there was some charge-management solution that didn't require me to build the sensing circuitry into the USB path. \$\endgroup\$
    – bitsmack
    Oct 28, 2014 at 22:27
  • \$\begingroup\$ @Majenko-notGoogle Good point. I hope there's an easier way :) \$\endgroup\$
    – bitsmack
    Oct 28, 2014 at 22:29
  • 2
    \$\begingroup\$ No, a hub is most definetely NOT the solution (the resistor detection wouldn't work through it anyway). Do the sensing with your stm32 instead. \$\endgroup\$ Oct 29, 2014 at 3:02

1 Answer 1


You can put a charge detector in parallel as long as you keep the stubs extremely short. I have done this before with a Fairchild charge detector. Don't remember the exact part number off the top of my head.

Or you could take a look at the BQ24392 from TI. It does its own enumeration (well, not enumeration... it does the charger detection upon initial connection, then connects the USB bus to the host), but it passes the detection results out, and it incorporates a USB bus switch so that the USB traces pass through it to the host. No stubs. It is specifically designed with USB 2.0 in mind. It correctly detects every type of charger in the known world, whether the charger is compliant with USB specifications or not.

But there may be a simpler option. How big is your battery? For smaller batteries (say less than 1 Ah) it may be easiest to simply always enable the 500 mA of current draw from USB. Of course, this means you will not comply strictly with the USB spec which dictates that until a profile is assigned, you have to stay under 100 mA. But in practice, it will work OK. It is rare, nowadays, to find a host which will object to the 500 mA being pulled from the USB port.

  • \$\begingroup\$ Thanks mkeith! The BQ24392 is exactly what I was looking for. I didn't know they existed :) For anybody reading this: there are a bunch of different, similar devices out there, generally called "Charger Detectors". \$\endgroup\$
    – bitsmack
    Dec 18, 2014 at 18:24
  • 1
    \$\begingroup\$ BQ24392 doesn't enumerate, though, so it can't detect a computer that's ok with you drawing 500 mA. You still need to do that yourself with an MCU \$\endgroup\$
    – endolith
    Oct 17, 2016 at 21:45
  • \$\begingroup\$ @endolith, a lot of people just ignore that nowadays. For strict compliance, you are certainly correct. But some people opt to draw 500 mA regardless. \$\endgroup\$
    – user57037
    Oct 17, 2016 at 23:51
  • 1
    \$\begingroup\$ @mkeith Yes, I know. I've tested 6 bus-powered hubs from different brands, and they all lie and claim to be self-powered so they can draw ~2 A from the computer. :D \$\endgroup\$
    – endolith
    Oct 18, 2016 at 0:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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