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:
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.
/*******************************************************************************
* 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).
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.
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?
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
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ā¦