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
    Why can't you have the MCU perform enumeration and then go to sleep? – Ignacio Vazquez-Abrams Oct 28 '14 at 21:40
  • " 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. – Majenko Oct 28 '14 at 22:01
  • @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. – bitsmack Oct 28 '14 at 22:27
  • @Majenko-notGoogle Good point. I hope there's an easier way :) – bitsmack Oct 28 '14 at 22:29
  • 2
    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. – Chris Stratton Oct 29 '14 at 3:02
up vote 3 down vote accepted

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.

  • 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". – bitsmack Dec 18 '14 at 18:24
  • 1
    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 – endolith Oct 17 '16 at 21:45
  • @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. – mkeith Oct 17 '16 at 23:51
  • 1
    @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 – endolith Oct 18 '16 at 0:16

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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