Bug 9789 - Mugen battery: HAL not getting correct capacity and current states
: Mugen battery: HAL not getting correct capacity and current states
Status: RESOLVED INVALID
Product: System software
HAL
: 5.0/(3.2010.02-8)
: All Maemo
: Unspecified normal (vote)
: ---
Assigned To: unassigned
: hal-bugs
:
:
:
:
  Show dependency tree
 
Reported: 2010-03-31 23:01 UTC by zimon
Modified: 2010-08-23 20:42 UTC (History)
5 users (show)

See Also:


Attachments
lshal after battery has been removed for a moment and cold boot, and then after soft reboot (2.62 KB, text/plain)
2010-03-31 23:07 UTC, zimon
Details


Note

You need to log in before you can comment on or make changes to this bug.


Description zimon (reporter) 2010-03-31 23:01:51 UTC
SOFTWARE VERSION:
(Settings > General > About product)

Linux Nokia-N900-42-11 2.6.28-omap1 #1 PREEMPT Thu Dec 17 09:40:52 EET 2009
armv7l unknown

lshal version 0.5.12

EXACT STEPS LEADING TO PROBLEM: 
(Explain in detail what you do (e.g. tap on OK) and what you see (e.g. message
Connection Failed appears))
1. Install Mugen 2400 mAh battery into N900.
2. Boot N900 up.
3. See "lshal | grep battery" on terminal. Seems to be OK and values also
updating when battery charge is dropping.
4. Reboot N900 without taking the battery out.
5. See battery information from HAL again. They are wrong and not changing
anymore (current, charge_level.current). However battery.voltage.current is OK
and keeps updating.

EXPECTED OUTCOME:
Get correct battery.charge_level.current and battery.reporting.current values
from HAL.

ACTUAL OUTCOME:
After (soft) reboot, the mentioned values are wrong.

REPRODUCIBILITY:
always

OTHER COMMENTS:

User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8)
Gecko/20100216 Fedora/3.5.8-1.fc12 Firefox/3.5.8

[url=http://talk.maemo.org/showthread.php?t=38068&page=16]Discussion about the
problem here also.[/url]
Comment 1 zimon (reporter) 2010-03-31 23:07:37 UTC
Created an attachment (id=2558) [details]
lshal after battery has been removed for a moment and cold boot, and then after
soft reboot
Comment 2 Jan Knutar 2010-04-02 17:24:52 UTC
This would be a "bug" in bme, not hal.

Neither outputs are correct anyway.

The design capacity is misread from the battery (or the bug is in the battery
misreporting design capacity), and the problems start from there.

On the mugen "2400mAh" battery I measure 105 kOhm BSI (battery size indicator?)
to GND on a cold battery, and 85kOhm when the battery is warmed up a bit (about
28C).

A BP-4L 1500mAh battery at 24C measures exactly 120kOhm. At 30C it still
measures 120kOhm.
A BP-5L 1500mAh battery at 23C measures exactly 120kOhm. At 27C it still
measures 120kOhm.
Two different BL-5C batteries (1000mAh?) at 23C measure 75kOhm. No tempereature
variation here either.
A third party BL-5C compatible "720mAh" battery measures 68kOhm. No, or very
little, tempereature variation. 

To summarize data gathered from other batteries:
1500mAh = 120
1000mAh = 75
720mAh = 68
Mugen = 85 (variable)

Thus, the misread capacity is probably due to design flaw in the mugen battery.
They used a thermistor instead of a resistor. The reported design capacity will
be lower the warmer the battery is, which the reporter is indeed experiencing.


As a result of the design bug in the mugen battery, the battery meter exhibits
the following behaviour:
The measured available capacity battery.reporting.current decreases in the
short term just as fast or faster, under similar load, as with the original
Nokia battery.
Periodically the charge meter seems to correct itself, either by outright
increasing battery.reporting.current making it look like the device is being
charged, when there's no charger attached, or by just freezing it until it's
closer, percentage-wise, to the truth.

On the whole, though, the battery meter is still performing admirably at its
task of giving the user a warning before system shutdown, and the system as a
whole is able to use the full capacity available from the mugen battery, as
battery low and shutdown thresholds are voltage based and not based on
calculated State of charge.

tl;dr: Resolution: Invalid
Comment 3 Lars Gunther 2010-04-03 13:28:43 UTC
This seem to affect Batterygraph as well, possibly also batteryeye (untested by
me).

May I also add that my Mugen battery seemed to be at 100% for three full days,
then dropped to 0% in a matter of minutes! (That was before I installed
Battterygraph, so I have no data about it.)
Comment 4 Joerg Reisenweber 2010-04-03 18:38:56 UTC
whatever BME is doing to give estimations about remaining charge, it for sure
doesn't know about mugen and it's quite expected behaviour for batmeter to fail
with mugen battery. The 'bsi' or whatever it's called is not standardized in
any way whatsoever, it used to be a thermistor for sensing cell temperature,
until it became obvious with modern cell chemistry there's no such thing like
cell overheating on normal charging usually. You can't assume there'll be any
relation between battery designed capacity and size of this resistor.
One of the components inside N900 involved in battery management is a bq27200
battery gauge, which has a designed capacity value preprogrammed to eeprom,
this for sure won't meet the mugen.
Comment 5 Andre Klapper maemo.org 2010-04-06 16:45:23 UTC
Also see bug 8163 and bug 7636 which might provide some background here.
Comment 6 zimon (reporter) 2010-04-12 21:12:44 UTC
One possible kludge solution would to change (somewhere) the battery bars
indicator to monitor voltage output of the battery rather than current it is
doing now?

Is the default Desktop panel's battery indicator widget in an open source part
of the system?

Or, if one would be brave enough hacker, what is the formula for the resistor's
resistance which a battery with 2400 mAh (3.7 V) capacity should have inside so
current N900 software would see it right?

This non standardized issue is little annoying as the battery indicator level
is for me also full 8 for 1.5 days or 2 days, then suddenly drops to 1 and
there is very little time to recharge it and keep it alive after that.
Comment 7 Andre Klapper maemo.org 2010-08-23 20:42:33 UTC
As written this seems like a bug in the mugen battery. Nokia does not plan to
provide software workarounds for this. Closing as INVALID.