You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
app+board+docs: battery SoC% via fuel-gauge-composite + power source (#8)
Add a battery state-of-charge readout (issue #8) using the upstream Zephyr
voltage-only fuel gauge, so no new driver is written. The M5PM1 PMIC exposes
voltages only, so SoC% is derived from VBAT by OCV lookup.
- board DTS: a `vbatt` voltage-divider (UNITY: output-ohms=<1>, full-ohms
omitted -> raw microvolt passthrough) over m5pm1_adc ch1, feeding a
`fuel_gauge` zephyr,fuel-gauge-composite (device-chemistry
lithium-ion-polymer, ocv-capacity-table-0 =
BATTERY_OCV_CURVE_LITHIUM_ION_POLYMER_DEFAULT,
charge-full-design-microamp-hours = 250000 for the 250 mAh cell). Add
m5pm1_adc channel@2 (VIN) for external-power detection. prj.conf turns on
CONFIG_FUEL_GAUGE.
- app: status.c reads fuel_gauge_get_prop(RELATIVE_STATE_OF_CHARGE) + VIN;
battery.c holds the pure soc->bar and VIN->power-source helpers
(tests/drivers/battery native_sim 4/4). PAGE_POWER shows VBAT, SoC% and the
power source; the alive serial line adds bat/soc/vin.
HW-017 (2026-06-05): serial `bat=4170 soc=100 vin=5142`, and the PAGE_POWER LCD
shows VBAT 4172 mV / SoC 100% / src USB 5V. 100% at 4.17 V is the expected flat
top (above the 4.032 V OCV curve top); the OCV interpolation is unit-tested and
upstream-tested. Approximate, voltage-only (no coulomb counter, no load
compensation); "currently charging" is out of scope (no reliable M5PM1
charge-status register). Evidence: evidence/20260605-hw017-battery-soc.log,
evidence/PXL_20260605_070039537.MP.jpg.
Docs: SDD 4.5.1, TDD HW-017 + the battery test, validation matrix, and the
upstream plan (vbatt/fuel_gauge are repo-local until the M5PM1 #109961 bindings
merge).
0 commit comments