Reference design for an USB charger and VF61

We’re going to develop a portable battery-powered device based on VF61.
We’d like using an USB charger circuit so that the same micro USB connector can be used both for battery charging and for data exchange (basically like tablets and smartphones).

Do you have any reference design for a USB charger circuit/controller that can be interfaced to VF61?
Would you recommend some special tip to proceed in this way?

One additional note: I need to use a battery with high capacity (let’s say 2000 mAh) so I can’t limit the charging current to 100 mA. I need a circuit which uses as much current as possible, based on the power source.

Currently we do not have a USB charging reference circuit. I know that USB charging is not an easy topic, since I am currently working on a demo system which includes a USB battery charging system. Unfortunately, there is no schematic that I can share right now. It is planned to release some schematics probably Q1 or Q2 2017. Nevertheless, I can give you some hints.

The first question you have to answer is whether you are using a single or multiple cell system. USB charger for single cells are way more common since used in almost all smartphones and tablets. In combination with our Colibri Modules, there is a major issue: The discharge voltage range of a lithium cell is from 4.2V to 3.0V (it would be possible to go down to 2.5V, but this is not so common). The Module requires 3.3V +/-5%. This means, you would actually require a buck-boost converter. A cheaper solution is using just a buck converter with high side p-channel FET with low drop out. With such a buck converter, you will be able to discharge the battery to around 3.2V. This means, more than 80% of the capacity of the battery can be used.

Laptop computers have traditionally multiple cell batteries. With the new USB-C connector, more and more laptops will also be charged by USB. Therefore, new buck-boost charger solutions are coming up. On our demo board, we are going to use the intersil ISL9237 with two lithium cells. This is quite a unique device which allows charging 1 to 3 cells with 3.2V to 23.4V input voltage range. Please keep in mind that multi-cell batteries require a cell balancer (often already built in battery packs). The advantage of the higher battery voltage is that simple buck converts for the 3.3V and 5V rail can be used.

You have already mentioned the next problem. In order to be USB compliant, you are only allowed to draw 100mA as long as the port is not enumerated. During the enumeration, the device can ask for up to 500mA. With the USB Battery Charging Specification (BC 1.2), the detection of dumb USB chargers (e.g. cell phone chargers) are now specified. These dedicated USB chargers have the D+ and D- signals shorted which indicates that higher currents can be drawn (normally around 1.5A). So, if you want to charge with more than 0.1A, there must be a mechanism for detecting whether you are plugged into a dedicated USB charger port, or a regular USB port.

One solution is using the built in charger detection mechanism in the Vybrid SoC (see the description of USB_ANALOG_USB0_CHRG_DETECT register in the reference maual). This means, the default charging current limit of the charger has to be set to 0.1A. The module needs to boot up and do either the USB enumeration for announcing 0.5A charging or detecting the dedicated charger for allowing to charge with 1.5A. The problem with this solution is that the module need to be running in order to charge with more than 0.1A. This could be an issue with a completely flat battery, since one has to wait until the battery is charged enough for booting up the module in order to start charging faster.

It is possible to built a software independent solution. There are USB charger detection IC available. For example the TI BQ24392 features a GPIO output which tells whether a dedicated charger is detected. This chip can be used in combination with a charger IC that features a fast charge enable input pin (as an example the TI BQ24266). As long as the dedection IC is not reporting a dedicated charger, it charges only with 0.1A. If a charger is detected, the limit can be set to 1.5A (or another value, depending on the charger).

There are also USB charger available with built in charger detection (for example TI BQ25890). Pay attention of the need of an analog switch for the USB signals if the USB interface is also used for communication.

I hope my answer will help you designing a suitable battery charger solution. I know it is not an easy topic. Please note, the mentioned devices are only examples, there are many other suitable solutions available. I would be very thankful if you can share your experiences and solutions with the community.

Hello Peter,
first of all, thank you for your detailed answer.
It’s clear that you know very well the issues related to an USB charger and your suggestions are really useful.
I think that as a first approach we’re going to investigate the built-in charger detection mechanism in the Vybrid SoC, since it seems simpler.
If some of the disadvantages are not acceptable, maybe we can switch to a software independent solution.

I let you know, so we can share our experience.

I did some test with VF61 256MB IT V 1.2A and Col Evaluation Board V 3.2A.

USB_ANALOG_USB0_CHRG_DETECT register has the description of some bits, but it’s not clear to me how they works. Could you help me explaining the supposed functions of the bits CHRG_DET_CTRL, CHRG_DET_STATUS, EN_B, CHK_CHRG_B, CHK_CONTACT and FORCE_DETECT?
I tried changing their value using Toradex MapMem library, but nothing changes.

Looking to the register USB_ANALOG_USB0_CHRG_DETECT_STATUS I can distinguish 3 different situations:

  • nothing is connected to USB: PLUG_CONTACT = CHRG_DETECTED = DM_STATE = DP_STATE = 1 (all the 4 bits to 1)
  • a dedicated charger is connected: PLUG_CONTACT = CHRG_DETECTED = 0 DM_STATE = DP_STATE = 1 (two bits to 1 and two bits to 0)
  • a host device (my laptop): PLUG_CONTACT = CHRG_DETECTED = DM_STATE = DP_STATE = 0 (all the 4 bits to 0)

Reading the description of CHRG_DETECTED and PLUG_CONTACT bits it seems that they are at the opposite to what described in the reference manual.
Is there something wrong in my approach?

This are indeed strange results. I have tried to analyze them from a hardware perspective. As far as I know, we did not test this feature so far. I do not know whether there is a customer which has used the USB charging detection feature so far on a Colibri VFxx.

The first problem we have is that the the USB0_VBUS_DETECT of the SoC which is available at pin 137 of the module edge connector is used differently than original intended by NXP. In the original NXP design, this pin is connected directly to the 5V of the USB connector in order to detect whether the client port is connected to a host. Unfortunately, the Colibri module standard does not know such a pin, neither has any 5V logic level on the module itself. Pin 137 of the Colibri standard is intended to be used to detect the present of the USB Voltage, but it is only 3.3V and it should also be GPIO capable. Therefore, we had to connect beside the USB0_VBUS_DETECT also a GPIO pin (PTC29) for fulfilling the backward compatibility with other Colibri modules. More information, you will find in section 5.4.2 of our Colibri VFxx Datasheet.

As we know that difference, we can back to the register description in the Reference Manual. The VBUS is normally used for starting the charger detection process. In the USB_ANALOG_USB0_VBUS_DETECT register, the detection of the VBUS is controlled. The VBUSVALID_THRESH sets the threshold for a valid voltage. Unfortunately, this level can only be set down to 4.0V. This means, it is not going to work on the Colibri module since the voltage cannot be higher than 3.3V. Therefore, in our image, we overwrite the detection manually for the regular USB client operation.

This means, also the charger detection need to be started manually. As mentioned in the beginning, we have never tested it, so everything is just speculations. It should be possible to detect the plugging in of the USB charger by using an interrupt routine on the rising edge level of PTC29 GPIO. It seems to be possible that you can start now the detection in this ISR by setting some bits in the USB_ANALOG_USB0_CHRG_DETECT register (FORCE_DETECT).

I hope this additional information can help getting the USB charger detection running. Again, it would be helpful to get any feedback.

If I set FORCE_DETECT bit in the USB_ANALOG_USB0_CHRG_DETECT register I’m able to distinguish three different conditions:

  • nothing is connected to USB: PLUG_CONTACT = CHRG_DETECTED = DM_STATE = DP_STATE = 1 (all the 4 bits to 1)
  • a dedicated charger is connected: PLUG_CONTACT = 0 CHRG_DETECTED = DM_STATE = DP_STATE = 1 (three bits to 1 and one bit to 0)
  • a host device (my laptop): PLUG_CONTACT = DM_STATE = DP_STATE = 0 CHRG_DETECTED = 1(three bits to 0 and one bit to 1)

This seems a good starting point, but some others questions came out:

  1. how does bit CHRG_DET_STATUS in USB_ANALOG_USB0_CHRG_DETECT register works? This is a read-only bit, but it’s always zero (even if the charger is conneted).
  2. how can I distinguish a host device with a limit of 100 mA from a host device with a limit of 500 mA?
  3. is there a way to get the allowed current from a dedicated charger?

To be honest, I do not have more information about the CHRG_DET_STATUS register than the description in the reference manual. I would join your assumption that it should indicate the present of the charger. Since your tests show a different result, it might related to the different voltage level of VBUS. But I really do not have more information. I have checked in the NXP community page and could not find an answer. You might want to rise such a question on your won in the NXP community

In order to distinguish between 100mA and 500mA, you have to enumerate correctly as USB client and ask for 500mA. If the host grants 500mA, you can start drawing the current. This is how it works on a regular USB port.

The USB BC 1.2 specifications describes that dedicated USB charger can be distinguish by detecting the shorting of the D+ and D- signals. Unfortunately, this detection does not have a mechanism to read the exact current rating of the charger. The official procedure is to increase the current draw until the voltage drops under a certain level (normally 4.5V). This means, the device needs to test how much current the wall charger and the cable are able to provide. Again, this leads to the problem that the Colibri module is not able to detect the correct VBUS voltage. Here ideas for resolving this problem:

  • Almost all dedicated USB charger are able to provide 1A, most of them even 1.5A. If you are limiting your device to 1A or 1.5A, it will work with most of the chargers. Compliant wall chargers should be equipped with a non destructive over current protection.
  • Limit the charging current to 500mA. All adapters are able to provide at least 0.5A
  • Knowing your adapter. Allow users only to use the wall adapter you deliver with your product. You can set the charging limit to the capabilities of your charger
  • Use an external USB charger detection IC which is able to read the VBUS voltage correctly

I posted my question to NXP community some days ago, but that community doesn’t seem very quick giving feedback, unfortunately