Update:
I’m testing the new API and the “old” way (direct PMIC calls).
Both modes will continue to Operate the Charging During an EN Pin Shutdown in the last setting before Shutting Down (Enable/Disable Charging), as expected. Reminder: we need to check the enclosure Temperature immediately after a EN Pin Shutdown or Standby Sleep Mode, to decide if charging should be enabled or disabled.
Both modes also appear to recharge the Li-Po appropriately.
The one difference that I’ve noticed is in my “Mode 2” below (direct PMIC calls), the charging current is determined at Boot/Startup. This is not expected, from what I remember from the PMIC datasheet.
In the Field, this means lower Li-Po charging current if the Panel isn’t producing when the Boron Starts.
Due to this, I prefer the new API mode (SystemPowerConfiguration
), or Mode “1” in the code snip below:
SYSTEM_THREAD(ENABLED);
PMIC pmic;
SystemPowerConfiguration conf;
//////////////////////////////////////////////
SYSTEM_MODE(MANUAL);
int myTestMode = 1; // 1 = API 2 = PMIC
//////////////////////////////////////////////
STARTUP( selectMode() );
void selectMode() {
// (1) API MODE
// Known: 3.78V Li-Po, 850 mW Available from Panel @ 5.08V on TEST STAND, 50 mW used by Boron in Manual Mode, OLED, & INA219
// Charging Results : 3.84V @ Li-Po, 208 mA, 790 mW , Panel Output (Vusb) holding at 5.07V AS EXPECTED
if (myTestMode == 1) {
conf.powerSourceMaxCurrent(900)
.powerSourceMinVoltage(5080)
.batteryChargeCurrent(1024)
.batteryChargeVoltage(4208)
.feature(SystemPowerFeature::PMIC_DETECTION)
.feature(SystemPowerFeature::USE_VIN_SETTINGS_WITH_USB_HOST) ;
System.setPowerConfiguration(conf);
}
// (2) PMIC Mode
// Known: 3.78V Li-Po, 850 mW Available from Panel @ 5.08V on TEST STAND, 50 mW used by Boron in Manual Mode, OLED, & INA219
// Charging Results: 3.82V @ Li-Po, 114 mA, 435 mW , Panel Output (Vusb) holding at 6.45V, DPDM Not Working
// After Reset : 3.84V @ Li-Po, 195 mA, 750 mW , Panel Output (Vusb) holding at 5.07V AS EXPECTED
// After more testing, the PMIC Mode will default to the lower charging depending on if the Source is present (Panel Producing) at Startup or Not.
// Reset or EN Pin Shutdown while the Panel is operating is why the 750 mW charging is reached in PMIC Mode
if (myTestMode == 2) {
conf.feature(SystemPowerFeature::DISABLE);
System.setPowerConfiguration(conf);
pmic.begin();
pmic.setInputVoltageLimit(5080);
pmic.setInputCurrentLimit(900) ;
pmic.setChargeVoltage(4208);
pmic.setChargeCurrent(0, 0, 1, 0, 0, 0);
pmic.enableDPDM();
pmic.enableCharging();
}
}
Mode 1 will still obey your call for pmic.disableCharging();
when enclosure temperature is too high.
I’ll perform similar charging tests with the Sleep Modes next to see if any differences show up between the API and PMIC code.
Thanks again @avtolstoy, and everyone else involved.