PMIC get/setInputCurrentLimit not setting correctly?

boron
Tags: #<Tag:0x00007fe21f542af0>

#27

Per Datasheet :
During DPM mode (either VINDPM or IINDPM), the status register REG08[3] will go high

To me, that means your source (and/or it’s path) is overloaded.
[Edit]: VINDPM being the culprit is supported by both of our tests, where we were able to get higher charging currents when we reduced the setInputVoltageLimit.

As soon as REG08[3] goes high, you could manually increase the PSU Voltage as a check.

  • Maybe there is a trace getting warm at these high currents, increasing resistance ?
  • Is there any way to read or measure the Vin at the PMIC?

The PMIC has a good reason to reduce the charging current, but it would be nice to figure out what the bottleneck is - even if we can’t mitigate it. :wink:


#28

See I took that to imply that I am getting put into IINDPM mode because ILIM got triggered, and it dropped it back down to a safety current or something. But you’re right, it could be a trace getting warm, but everything feels cool to the touch to me (a very scientific measurement technique, I know). I’m going to try and get around to more testing today but I have another project with a deadline that I’ve been ignoring, so I may have to shelve this for a bit. In any case, thanks for all your help thus far :slight_smile:


#29

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.


#30

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


#31

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.setChargeVoltage(4208);
pmic.setInputVoltageLimit(4520);
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.


#32

@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
  pmic.enableDPDM();  
  pmic.enableBuck();                

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).

1.3.1-rc.1+ change to Boron solar charging (via VUSB) behavior
Boron VIN solar charger problem with firmware 1.4.2
#33

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: https://store.ncd.io/product/feather-screw-terminal-for-particle-and-feather-modules/ 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: https://www.amazon.com/gp/product/B07DWN9GNF/ref=ppx_od_dt_b_asin_title_s00?ie=UTF8&psc=1 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. :-/


#34

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.

#35

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


#36

@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.


#37

They do. Pins 2&3.


#38

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.


#39

Woo! https://github.com/particle-iot/device-os/pull/1846


#40

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


#41

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:

SYSTEM_MODE(MANUAL);
PMIC pmic;
STARTUP( setupPMIC() );

void setupPMIC(){
    pmic.begin();
    pmic.setInputCurrentLimit(20);
}

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.


#42

@dan.s,

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.


#43

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.


#44

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

void setup() {
    detachInterrupt(LOW_BAT_UC);
    // Delay for up to two system power manager loop invocations
    delay(2000);
    // Change PMIC settings
    PMIC pmic;
    pmic.setInputCurrentLimit(100);
}

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.


#45

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?


#46

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