PMIC get/setInputCurrentLimit not setting correctly?

If you don’t mind sending me your code, I’ll run some tests.
I’ll ramp up the Supply Voltage when REG08[3] goes high to confirm.

I’ve got to go do some paying work today, so it would be this weekend.

Very interesting experiments.
A search on TI E2E forum did not turn up something directly related, but they seem to listen and answer questions.

So this all seems directly related to the D+/D- pins and the BQ recognizing everything as a USB host and limiting it to 500mA. I was able to test this morning with a meter inline with the VUSB pin and just the following settings for PMIC:

pmic.setChargeCurrent(0,0,1,0,0,0); // 1024mA charge current

This is with a battery that reads around 50% full by the fuel gauge, voltage was around 3.85-3.9v

If I leave nothing in the microusb port of the Boron, I get around 466-467mA current draw.
If I plug a modified microusb cable in with D+/D- bridged and restart the device, I get 952mA.
Pull the microusb cable out and reboot, back to ~465mA
Plug back in, back to ~950mA

I checked the system status register and with the microusb cable out, it says the charge source is “01” which is USB Host. When I have the microusb cable plugged in with D+/D- bridged, I get “10” which is “adapter port”. I also tested with a 5v/2.5a microusb power supply plugged in (doesn’t have d+/d- lines) and it also identifies this as a USB Host.

I tested this with a solar panel as well and got the same results. Around 960-970mA in full sun, but dropping to 465mA without the modified usb cable plugged in (4.5v input voltage)

So there is something wrong with how the boron/bq24195 are recognizing the charge source, and any external supply plugged in through VUSB pin is getting recognized as a USB Host and limited to 500mA charge current.

Unfortunately when I set input voltage to 4840mv, it only pulls in around 256mA either way and makes no difference.

1 Like

@abatardi That’s good info. I think we’re getting close.
I’m getting 850 mA without touching the Data Wires. I’m powering the Boron w/ the USB Connector, since that’s how I’ll connect a Solar Panel in the field.
But connecting the Data wires and Restarting had no impact on my measurements, when using the USB connector for power.
I cut the USB cable that’s included with the Boron, and used the Black and Red Wires to power the Boron on it’s USB connector from a PSU.

HOWEVER, if I land my power on the V(USB) and Ground Pins, instead of using the USB connector; I get similar results as yours:
450 mA when D+/D- USB wires NOT connected
1030 mA when D+/D- USB wires ARE connected
So it matters where we land our Power Source.

[Back to my results from today using the USB connector]
I’m able to maintain 850mA charging using the following PMIC Settings and a PSU in Constant Voltage Mode on the USB Connector, charging a 10,000 mAh Li-po @ 3.90 resting voltage, Boron LTE 0.9.0 Manual Mode w/ Modem OFF drawing 7 mA, D+/D- USB wires not connected :

  pmic.setInputVoltageLimit(4200);    //  
  pmic.setInputCurrentLimit(2000) ;   // 2000 mA 
  pmic.setChargeVoltage(4208);        //  Set Li-Po charge termination voltage to 4.21V, CAUTION! not for everyone
  pmic.setChargeCurrent(0,0,1,1,1,0); // 1408 mA [0+0+512mA+256mA+128mA+0] + 512 Offset

The PMIC will start to reduce the charging current if/when the VUSB drops to 4.35V (using pmic.setInputVoltageLimit(4200)). That’s not the supply voltage, but the measured operating voltage at the VUSB pin. I’m supplying power at the USB Connector.

V(PSU)    V(USB)   I(charging)   Notes
5.20V     4.35V      830 mA       This is where DPM kicks in and reduces charging current
5.40V     4.50V      850 mA       850mA appears to be the max for this particular setup
6.25V     5.30V      850 mA       Increasing Supply Voltage doesn't increase charging current beyond 850 MA

My assumption is that in the first line of the results, V(USB) = 4.35 is related to the setting pmic.setInputVoltageLimit(4200). I guess there is a small voltage reduction from V(USB) to the PMIC, because the Current gets reduced when V(USB) drops to slightly higher (~0.15V) than the setInputVoltageLimit setting.

I don’t know why 850 mA is the actual limit when everything “appears” to be good for 1408 mA.

I changed back to pmic.setInputVoltageLimit(5080); which should be the best available setting for a 6 Volt Solar Panel, and the charging current is still 850 mA :sunglasses:
I slowly reduced the Supply Voltage until the PMIC started to reduce the Charging Current.
The V(USB) was 5.20V when this happened, reinforcing the above results.
The Dynamic Power Management of the PMIC kicks-in when V(USB) falls to about 0.10 to 0.15 V above the set-point of pmic.setInputVoltageLimit(x)

I believe to rate any particular 6V Solar panel for a Boron, we’d check the current produced by the Panel at 5.20V, since that’s the highest “actual” Input Voltage that the firmware allows the PMIC to attempt to maintain in DPM when recharging via Solar. This rating would be limited to 4.4 watts maximum for the Boron LTE, per my results if connecting the solar Panel via the USB connector. The Boron LTE is still a good fit for a 6-watt panel if needed.

// This can provide (up-to) 850 mA of Charging Current on my test rig, using the USB connector:
  pmic.setInputVoltageLimit(5080);    // 6V Solar Panel, actual condition is ~ 5.20V for DPM
  pmic.setInputCurrentLimit(2000) ;   // 2000 mA, higher than req'd 
  pmic.setChargeVoltage(4208);        // Set Li-Po charge termination voltage to 4.21V, CAUTION: You MUST Monitor TEMP!
  pmic.setChargeCurrent(0,0,1,1,1,0); // 1408 mA [0+0+512mA+256mA+128mA+0] + 512 Offset
  pmic.enableDPDM();                  // This may be a default, and not req'd

/* Notes: When using pmic.setInputVoltageLimit(5080), the Boron LTE may no longer Boot when only powered from a USB port on some Computers.  
You will need to attach the Li-Po when re-flashing, etc, since some USB ports have trouble maintaining the Voltage when using this setting.   

It appears the charging current can be increased to 1000 mA if you don't use the USB connector, using V(USB) and GND Pins instead.
But you must tie the USB data lines (use a dummy usb connection) together for the PMIC to allow higher than 500 mA in this case. 

Li-Po Charging Results for Boron LTE, when the source has sufficient Voltage & Current Capability:

  • 850 mA using a USB Cable/Connector for recharging, Red and Black wires Only
  • 450 mA using V(USB) and GND Pins for Recharging
  • 1000 mA using V(USB) and GND Pins for Recharging, using a dummy USB that connects the Data Lines together (Green and White).

Very nice, thank you for doing all that and posting. My application is going to be using the VUSB/GND pins to power the Boron, as we have a secondary PCB that will be used and the boron seated on that via the header pins. Basically something like this: but a modified version to include the INA226 we were testing with earlier to be able to track the input current. I guess we could power directly to the microusb port, but we’d lose that.

So right now the plan is just to buy some of these: and solder the data pins together and pop them into the boron microusb port.

I’m not sure if it would be possible to fix this via firmware, or if it would require a hardware change on the boron. For all I know this is a ‘feature’, although I can’t imagine the rationale behind that and why you’d want to artificially limit the input current via the header pins. Seems like a small design flaw. Hopefully one that can be fixed via software, but in the meantime, a 50 cent microusb connector and a blob of solder will be my solution. :-/

1 Like

I just measured the current through the Li-Po wire when using the NCD board you referenced.
Using pmic.setInputVoltageLimit(4840); since the NCD board maintains 5V to V(USB) :
The Source is 12V input to NCD board.

  • 530 mA into the Li-Po
  • 1030 mA into the Li-Po with USB Data wires connected and reboot.

FYI, looking at the schematic, there’s a diode from the USB connector’s power pin to Vin, which is what goes into the PMIC (Vbus pin). The Vusb connector pin is the same as Vin, i.e., it doesn’t go through a diode to reach the PMIC (Vbus pin). The schematic doesn’t say what kind of diode, but it’s not a shottky symbol, so I suspect that explains the 0.5V-0.8V drop observed by @Rftop, specifically between what he labeled as V(PSU) vs V(USB).

Something that strikes me as interesting from the datasheet is:

The bq24195L, bq24195 follows battery charging specification 1.2 (bc1.2) to detect input source through USB D+/D– lines. After the input current limit detection is done, the host can write to REG00[2:0] to change the input current limit.

The interesting part being the “after…”. This implies there’s a way to override what it detects.

Another option could be to program the D+/D- pins on the nRF to be outputs and to game the detection that way. I believe that would require setting D+ LOW and D- HIGH.

Yet another thing that came up above is the external resistor on the ILIM pin that sets the input current limit. The datasheet says:

The actual input current limit is the lower value between ILIM setting and register setting (REG00[2:0]).

The schematic shows a 333Ohm resistor, which sets a limit of (1V/333Ohm)*530 = 1.6A

1 Like

@tve - thanks for the info – correct me if I’m wrong but I don’t believe the D+/D- lines actually go to the BQ chip, I think they go to the nRF directly (and are then maybe connected to the bq from there – not sure)?

In terms of setting it after, we’ve tried changing the settings after a delay, as well as part of the loop and not just in setup, doesn’t seem to make a difference, and yes you’re correct it is maxed out at 1.6A regardless.

Another option could be to program the D+/D- pins on the nRF to be outputs and to game the detection that way. I believe that would require setting D+ LOW and D- HIGH.

Any idea how to do this? I’d give it a try. Currently my microusb connector w/ solder blob works but it’s kind of ugly.

They do. Pins 2&3.

This is the response I finally got after weeks from Particle Support:

I tested on the Boron as well, and the results were the same as the E series, which is not surprising.

I was unable to get an actual charge current of more than 500 mA as measured by the current going into VUSB, regardless of the settings.

So, it seems there is no resolution there.


On the Boron I was seeing 800mA during Charging when the USB voltage was 5.45v. The higher voltage seems to increase charging current.

Hi guys, just gone through this thread and now understand problem and solution for increasing the input current limit from default. However…
How about the opposite problem? I have a battery which lasts much longer with a consistent load (without spikes), so want to limit the current to 20mA. I cannot understand why the following code does not work:

PMIC pmic;
STARTUP( setupPMIC() );

void setupPMIC(){

void setup() {}
void loop() {}

Still getting around 250mA current draw!
Please can someone tell me what I’m missing here?

Also, I noticed in the bq24195 datasheet has:

– Input Current Limit: 100 mA, 150 mA, 500 mA, 900 mA, 1.2 A, 1.5 A, 2 A and 3 A

Does this mean there are only predefined values which can be set?
Many thanks in advance.


setInputCurrentLimit(x) sets the maximum current for the VUSB (Vin) source.
In other words, your pmic.setInputCurrentLimit(20); call would “attempt to” limit the USB source to 20 mA, not the Battery.
Whenever the Boron requires More than 20 mA, the Battery would be used to supplement the USB source. However, 20mA isn’t a valid setting.

The values are defined in spark_wiring_power.cpp, beginning at line #243.

 * Function Name  : setInputCurrentLimit
 * Description    : Sets the input current limit for the PMIC
 * Input          : 100,150,500,900,1200,1500,2000,3000 (mAmp)
 * Return         : 0 Error, 1 Success

Also, are you sure that 250 mA isn’t going into your battery?

If you explain your Case in more detail we might can help with suggestions.

Sorry, I should have stated…
By battery I mean our much larger Li-SOCI2 battery supplying VIN.
The method is to use the smaller 2000mAh LiPo battery by default to handle spikes when powering up and connecting over cellular. Most of the time, we will be in deep sleep < 1mA.
However, our tests are showing that VIN is being used up to about 250mA as the primary power source, when really all we want is to have it trickle charging the LiPo (as Li-SOCI2 batteries last much longer without spikes).

As you can see, 20mA would be optimum.
But we also tried pmic.setInputCurrentLimit(100); with no luck.

You can try this workaround for the 100 mA to “stick”, found here :

void setup() {
    // Delay for up to two system power manager loop invocations
    // Change PMIC settings
    PMIC pmic;

I guess in a perfect world, you would use setChargeCurrent(20) and physically switch the Li-COSl2 source occasionally, but the minimum offset is 512 mA (hardware defined IIRC), from Line # 588

* Function Name  : setChargeCurrent
* Description    : The total charge current is the 512mA  + the combination of the
                    current that the following bits represent

I remember a few discussions attempting to perform something similar to your Use Case.
I don’t remember the solution(s) though.

Thank you that workaround does the job! Shame the lowest we can go is 100mA, but it’s better than nothing.
I tested with both STOP mode sleep and DEEP sleep and in both modes worked fine, waking from the former did not need to be recalled, but it does take a few seconds after waking from deep sleep to enter setup and call it. Unfortunately we cannot use this in STARTUP so I guess we will have to live with the fact it will draw 250mA for a few seconds every time it wakes up from deep sleep.

Can you tell me what detachInterrupt(LOW_BAT_UC); does, and will we need to catch anything because of using it?

@dan.s, This post contains the majority of what I “know” about the issue:

Ok thanks for your help.
Still quite confused on what it does exactly though. Maybe there will be a docs update which will explain soon :crossed_fingers:

In light of this, we’re now thinking of actually just inserting a resistor in series (100 ohms seems to work nicely) to restrict the current, and not even update the firmware.

Just an update - simply using a resistor in series to restrict the current did not work, in fact it made the battery life worse. So back to the drawing board…