Why Battery Levels Are Just a Guess and everything you want to know ( and some you probably didn’t ) about State of Charge on the H700+AXP717
Anbernic devices using the H700 SoC rely on the AXP717 charge controller and power management integrated circuit (PMIC). For detailed information, you can refer to the AXP717 datasheet here. However, the datasheet lacks detailed information on battery capacity and state-of-charge (SoC) estimation, and it does not mention current sensing or provide much beyond voltage-based data.
This means that the AXP717 is a relatively simple PMIC compared to modern counterparts. It lacks current-sensing capabilities, which limits its ability to accurately estimate battery SoC.
Voltage-based SoC Estimation vs. Coulomb Counting
Modern devices typically use Coulomb counting, a method that tracks the electrical charge entering or leaving the battery to calculate its SoC accurately. This method requires knowledge of the battery’s capacity, real-time current draw, and other parameters. The AXP717, however, uses a simpler voltage-based approach. It relies on the pmu_bat_para*
lookup table in the device tree (DT), which maps voltage levels to approximate SoC values.
These values are stored in hexadecimal format, which can be difficult to interpret. To make them more accessible, here is the converted list of values in decimal:
pmu_bat_para1 = 0;
pmu_bat_para2 = 0;
pmu_bat_para3 = 0;
pmu_bat_para4 = 0;
pmu_bat_para5 = 0;
pmu_bat_para6 = 0;
pmu_bat_para7 = 2;
pmu_bat_para8 = 3;
pmu_bat_para9 = 4;
pmu_bat_para10 = 6;
pmu_bat_para11 = 9;
pmu_bat_para12 = 14;
pmu_bat_para13 = 26;
pmu_bat_para14 = 38;
pmu_bat_para15 = 49;
pmu_bat_para16 = 52;
pmu_bat_para17 = 56;
pmu_bat_para18 = 60;
pmu_bat_para19 = 64;
pmu_bat_para20 = 70;
pmu_bat_para21 = 77;
pmu_bat_para22 = 83;
pmu_bat_para23 = 87;
pmu_bat_para24 = 90;
pmu_bat_para25 = 95;
pmu_bat_para26 = 99;
pmu_bat_para27 = 99;
pmu_bat_para28 = 100;
pmu_bat_para29 = 100;
pmu_bat_para30 = 100;
pmu_bat_para31 = 100;
pmu_bat_para32 = 100;
Each pmu_bat_para#
value represents a percentage of the battery’s total charge, with each corresponding to a certain voltage level. Essentially, these values define a look-up table that the PMIC uses to estimate how full the battery is based on its voltage.
Battery Percentage Estimation
However, voltage-based estimation comes with several limitations:
-
Voltage under load: The battery voltage can sag under load, meaning the current voltage may not accurately reflect the actual state of charge.
-
Battery aging: As the battery ages, its internal resistance increases, causing greater voltage sag under load. This leads to inaccurate SoC readings.
-
Static capacity: The configured battery capacity (
pmu_battery_cap
) in the device tree is static. It does not dynamically adjust based on actual usage or battery condition, which further contributes to imprecise estimations.
Thus, the AXP717’s reported battery percentage is a rough approximation. For a more accurate assessment of the state of charge, it’s often better to monitor the battery’s actual voltage.
Why Charge to 4.1V Instead of 4.2V?
One question that arises is why the device charges the battery to 4.1V instead of the typical 4.2V. This decision prioritizes safety and battery longevity. This wasn’t a decision the muOS team made, but one that the platform designers (Allwinner or Anbernic) made because of how they implemented the PMIC.
-
The key reason for this is that charging requires the system to be powered on, meaning the battery is under constant load during charging. This load includes the SoC, peripherals, and other components. Under load, the battery voltage sags below its true open-circuit value.
-
If the system were to charge the battery to 4.2V under load, the open-circuit voltage (after removing the load) could exceed 4.2V, leading to overcharging. Overcharging can cause significant damage to the battery, reduce its lifespan, and even result in safety hazards such as swelling, leakage, explosion or fire.
-
By limiting the charging voltage to 4.1V, the system ensures that the battery’s voltage remains within safe limits, even after the load is removed and the voltage rebounds. This trade-off results in slightly less runtime per charge but provides much better battery safety and longevity.
Conclusion
The AXP717 PMIC provides only a basic battery management solution. Its state-of-charge readings are imprecise, and this is the result of relying on voltage estimation without current sensing. Charging to 4.1V ensures the battery stays within safe limits and prevents overcharging, even under load.
For users seeking more accuracy, it’s recommended to monitor the battery’s voltage directly, as the SoC estimation provided by the PMIC is best seen as a rough approximation.
While we have to make do with the limitations of the AXP717, understanding its weaknesses can help set more realistic expectations about battery behavior on devices using this PMIC.