I’ve got two devices in the field (out of 1000+) that seem to be having an issue with their PMICs providing bad data. Our devices sleep often and are attached to both their LiPo battery and through external circuitry a 12V SLA battery.
We use the following (simplified) code to put the device back to sleep if our LiPo is under 20% and we do not have good power from the PMIC:
if (fuelgauge.getSoC() < 20 && pmic.getSystemStatus() & 52) {
System.sleep(SLEEP_MODE_DEEP, 1200);
}
*Instead of 52, we should be using 4, but it shouldn’t affect the outcome here
My questions are:
- If there is an issue with the PMIC, what would the return value be here? A
0
response would put our device to sleep for forever, and I think this is what device-os responds with - If I know that
0
is the bad value I need to protect my firmware from, how can I guard against it? Obviously I could change topmic.getSystemStatus() & 52 || pmic.getSystemStatus() & 0
but this doesn’t seem very elegant - On the bq24195, if I’m powering the device through VIN, is there a way to have a legitimate reading of 0 from the bq24195?
- Any other ideas on how I might guard against this?