For tabs with battery drainage problem... or how to calibrate

Search This thread

Vlad_z

Senior Member
Mar 25, 2011
506
178
I want to give you guys updates on my findings regarding fuel gauge chip Samsung is using in our tabs.

It's MAX17042. I spend lots of time looking for datasheet but cannot find it. I found some very similar chip but still not exact. It looks like this chip was specially designed for Samsung by Maxim. So any further knowledge was derived from looking at various drivers for different Samsung devices.

Ok, looks like max17042 is utilizing combination of coulomb-counter with impedance tracking algorithm. What does it practically mean?

There is "quick start"/"quick charge estimate" software function but it's not accessible without special cable or kernel software change. If someone wants to try this I can elaborate on that more.

What can we do without any special thingy?

Tab needs to be at rest (turned off) for at least an hour when its empty and then when it charged back. This will let chip to make 2 open circuit voltage measurements.

How to make sure that tab is discharged enough for calibration to take the place? If capacity is off big time then gauge may report SOC 30% but in the fact battery is in 70%, so chip will not execute calibration procedure.

The most sure way to check this is in terminal, execute this command:

cat /sys/class/power_supply/battery/voltage_now

or through adb:

adb shell cat /sys/class/power_supply/battery/voltage_now

your good discharged start point should be anything below 3700 (3.7V). If your tab is telling that you have 0% capacity but voltage is more then 3700 then keep rebooting tab (this will refresh counter for a moment) or just boot in CWM and let tab run/sit there for some time.

Then charge it with power adapter to 100%, you can check voltage at this point - should be around 4100, usually you should be good.

Then shutdown tab for another hour or two.

That's it. You should be good now unless you are still using certain custom kernels.


PS: I have heard cases when SOC miscalculation occurred on totally stock devices, well, I have no explanation for that, but with custom kernels which allow to charge through USB cable - there is a code path to write wrong data into remaining capacity counter stored in the fuel gauge chip.

After it happens and even when you are back on stock kernel then it will take some time for the chip to slowly correct itself or you need to force recalibration outlined above.

Btw, resent custom kernel (from pershoot) does not include charging by USB functionality. Well, there is nothing wrong with that idea. It just Samsung implementation of charging algorithm is not good if such function will be allowed.
 

wlighter

Senior Member
Aug 9, 2011
233
26
lolz.. problem with currentwidget is the report is in V instead of mV. Its useless for our purpose...
 

jfcooley

Senior Member
Jul 15, 2011
638
193
Charlottesville Va
OK I'm trying to understand how to do this. I have a question or two.

I tried the terminal command and got not found. I don't know if it matters but ATM I'm using bonsai. I'm dl'ing stock right now.

Tried batter monitor widget and noticed that my GT box says 7,000 mAh battery, but battery widget says 1500 mAh.

So, now I'm more confused than when I started. Can someone set me straight?
 

Vlad_z

Senior Member
Mar 25, 2011
506
178
OK I'm trying to understand how to do this. I have a question or two.

I tried the terminal command and got not found. I don't know if it matters but ATM I'm using bonsai. I'm dl'ing stock right now.

Tried batter monitor widget and noticed that my GT box says 7,000 mAh battery, but battery widget says 1500 mAh.

So, now I'm more confused than when I started. Can someone set me straight?

yes, it matters, means you are using different kernel and I don't now what battery monitor doing in the background (I can disassemble it and take a look but it would take a time)

post result of this command:

ls -l /sys/class/power_supply/battery
 

jfcooley

Senior Member
Jul 15, 2011
638
193
Charlottesville Va
Thanks for replying, but I have the stock installed now. Going to try terminal in a few minutes.

Your command yielded this.

127|app_109@android:/ #ls -l sys/class/power_supply/battery
lrwxrwxrwx root root 2011-08-18 17:26 battery -> ../../devices/platform/p3-battery/power_supply/battery

Edit again: original command works. I didn't notice the space after "cat" . Sorry, clearly I'm a newb with the terminal.
 
Last edited:

jfcooley

Senior Member
Jul 15, 2011
638
193
Charlottesville Va
I want to give you guys updates on my findings regarding fuel gauge chip Samsung is using in our tabs.

It's MAX17042. I spend lots of time looking for datasheet but cannot find it. I found some very similar chip but still not exact. It looks like this chip was specially designed for Samsung by Maxim. So any further knowledge was derived from looking at various drivers for different Samsung devices.

Ok, looks like max17042 is utilizing combination of coulomb-counter with impedance tracking algorithm. What does it practically mean?

There is "quick start"/"quick charge estimate" software function but it's not accessible without special cable or kernel software change. If someone wants to try this I can elaborate on that more.

What can we do without any special thingy?

Tab needs to be at rest (turned off) for at least an hour when its empty and then when it charged back. This will let chip to make 2 open circuit voltage measurements.

How to make sure that tab is discharged enough for calibration to take the place? If capacity is off big time then gauge may report SOC 30% but in the fact battery is in 70%, so chip will not execute calibration procedure.

The most sure way to check this is in terminal, execute this command:

cat /sys/class/power_supply/battery/voltage_now

or through adb:

adb shell cat /sys/class/power_supply/battery/voltage_now

your good discharged start point should be anything below 3700 (3.7V). If your tab is telling that you have 0% capacity but voltage is more then 3700 then keep rebooting tab (this will refresh counter for a moment) or just boot in CWM and let tab run/sit there for some time.

Then charge it with power adapter to 100%, you can check voltage at this point - should be around 4100, usually you should be good.

Then shutdown tab for another hour or two.

That's it. You should be good now unless you are still using certain custom kernels.


PS: I have heard cases when SOC miscalculation occurred on totally stock devices, well, I have no explanation for that, but with custom kernels which allow to charge through USB cable - there is a code path to write wrong data into remaining capacity counter stored in the fuel gauge chip.

After it happens and even when you are back on stock kernel then it will take some time for the chip to slowly correct itself or you need to force recalibration outlined above.

Btw, resent custom kernel (from pershoot) does not include charging by USB functionality. Well, there is nothing wrong with that idea. It just Samsung implementation of charging algorithm is not good if such function will be allowed.

Followed this procedure last night. Fired up this morning and have been browsing/reading news for an hour or two. Battery drain seems to be back to normal, around 79% as I type this.

Thanks earned and given. This issue has annoyed me since it occurred. I can trace it back to installing a custom ROM. Will be staying on stock rooted for time being.

Thank you again.
 

pokey9000

Senior Member
Apr 17, 2007
767
396
Austin
This is the same battery monitor used on the Nook Color. Periodically the Nook would do a dump of some registers holding the battery state, and on boot the file was loaded into the device. More here.
 

pellegj

Senior Member
May 18, 2011
73
7
For what it's worth, my tab is now fine from this problem after calibration. I'm on BroodComp ROM with pershoots kernel for the 7500.
 

galaxy_lighthouse

New member
Aug 20, 2011
1
0
ok looks like I've got the same problem on the p7510. Can anyone post me a guide or link to "how do I flash the kernel"? Would be very grateful as I have no idea how to do it the right way.


thx
 

verusevo

Senior Member
Jun 23, 2010
220
43
Is there really no other way todo this. Is soooo EFFing frustrating. My battey goes from 100 to zero in MINUTES not hours. I cant just sit here rebooting my tab 1000 times until the battery finally dips below 40%. Ive already tried this method once and i dont know what i did wrong but it didnt work. There relly has to be a better option than me wasting about 8 hours of my life just tryingto calubrate a friggin battery
 

nikzDHD

Senior Member
Apr 2, 2011
4,547
1,207
London
Is there really no other way todo this. Is soooo EFFing frustrating. My battey goes from 100 to zero in MINUTES not hours. I cant just sit here rebooting my tab 1000 times until the battery finally dips below 40%. Ive already tried this method once and i dont know what i did wrong but it didnt work. There relly has to be a better option than me wasting about 8 hours of my life just tryingto calubrate a friggin battery

What kernel are you on? After following this method my battery is back to normality.

Sent from my GT-I9100 using XDA App
 

Vlad_z

Senior Member
Mar 25, 2011
506
178
Is there really no other way todo this. Is soooo EFFing frustrating. My battey goes from 100 to zero in MINUTES not hours. I cant just sit here rebooting my tab 1000 times until the battery finally dips below 40%. Ive already tried this method once and i dont know what i did wrong but it didnt work. There relly has to be a better option than me wasting about 8 hours of my life just tryingto calubrate a friggin battery

instead 1000 times rebooting you may just boot once onto recovery and let tab stay in it...

I mention this way of discharging in previous post.
 
After much research I guess this is a known issue with flash ROMs on Android in General, just that Samsung's fuel chip added a little extra wrench to the whole mix. I hope my rambling is helpful to someone out there, and it will add to the possible fixes to try out.

Yesterday morning I ran into the battery drain issue on my Samsung Galaxy Tab 10.1 I purchased early July. I had my Tab off and charging overnight, as I usually do. When I powered it on and unplugged it, I had a low battery within a few minutes of browsing the internet. I was using Starburst_TW_8.9.11 rom, with the overclocking. I right away noticed that when I turned it off and tried to charge my tab it was still 100%. So I figured it was an issues with the software.

So I tried flashing back to stock, and a unrooted ROM, which is not much fun after being rooted. I then found an updated TW ROM from Task650 http://xdaforums.com/showthread.php?t=1227800&page=9

Then after searching the XDA site as I usually do (the main reason I almost never post questions in forums) and finding this thread I tried the calibration method, that got me more then 30 minutes of use of my tab, I was able to watch the movie StarTrak and do an hour of browsing, but still dead in the software, and even after a reboot it would power down, even though it was still only 60% dead.

On top of Vlad_z's method I also had to make sure I did a factory reset, and delete cache and everything. I then went ahead and restored most of my Apps without any issues so far. I know this is pretty much a given when flashing ROMs on Androids to make sure the new ROM you are using is clean from the previous ROMs settings. Looks like my issue was a combination of flashing multiple ROMs in a week and the wacked fuel chip.

I left my tab off overnight, and powered it back on this morning to find I can now see the remaining 60% of the battery, I'll update later today or tomorrow if I'm able to drain it down to crtically low levels and charge it back up without issues.

I also want to thank all the Devs for all the resources they provided as well as Vlad_z's and everyone on this thread for their post. Without this site I would have probably still had this issue, one day in stock, but would have to deal with Samsung's support (which is not the greatest my buzing Samsung TV and blueray player are a testiment to that). :p
 

verusevo

Senior Member
Jun 23, 2010
220
43
ok im giving this another shot. I just realized alot of you are sayinf that i should flash back to the stock rom before i do the calibration. im presently on the stage where im leaving it off for an hour before recharging the battery. But my tab is currently running the starburst Rom with the pershoot kernel that seems to be the main culprit in all this. So my question is, Is it necesary for me to flash to stock before i charge the tab and do the battery calibration. Would it be ok if after the (1 hour) but before charging to 100% i run the tab in CWM and flash the stock ROM then charge it fully and leave it off for 5 hours?

also do i hae to stay on stock until this is all figured out?
 

Vlad_z

Senior Member
Mar 25, 2011
506
178
running for 1 hour in cwm maybe not enough. I did not check current consumption in cwm.

In order to start calibration you have to be sure voltage is below 3.7V.

PS: latest pershoot kernel seems not to have such problem. Just don't overclock.
 
Last edited:

madsquabbles

Senior Member
Jan 31, 2009
1,973
366
doesn't work for me. i've always been on stock kernel. this is also a problem with my 7in gt, so it's seems to be a samsung specific problem as i've never had this on any other android tablet.
 
Quick Update

After draining the battery as low as I could, and recharging I haven't had to recharge in over a day now. I have watched serveral movies and TV shows, it is down to 20%. I would have to agree, don't overclock unless you accept the risk involved. Not that I'm sure it is the cause, sounds more like a bug in the chip and driver.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 19
    I've got this problem with my tab (quick battery drainage). Symptoms would be your 100% charged tab would go down to 0% in unusual shorter time ( like 2-4 hours). You put it on charger and tab would be charged back to 100% again in substantial short time like 2-3 hours instead of 6-7 hours.

    Well, after looking at this issue I think I have come up with solution.
    At least, my tab looks like it's back on track... though, to say for sure I would need another couple days of testing.

    The problem is not runaway wild application on a background but battery control circuit. This chip reports to OS much smaller battery capacity as it is for some reason. I will not go into details but here is what you need to try:

    Flash stock kernel (may be custom kernel is not the reason for bad chip calibration and I'm 90% positive but just to be on safe side). You don't need to do factory wipe in OEM recovery for our purpose.

    You also don't need to wipe batterystats.bin or use "Battery Calibration" apps from market (which does exactly the same wipe just in more end user friendly way). This wipe serves no other purpose then refreshing your usage statistics.

    You also don't need to drain your battery all way down... nice, this way you don't have to wait for too long.

    Well, here we go:

    charge tab somewhere in between 80 and 100%.
    edit: remove charger
    shutdown tab (not put in hibernate/sleep) for 1 hour.
    edit: turn tab on and run it for 30-40 min. or whatever it takes to drop charge to 40-50%.
    shutdown tab again for 5 hours (overnight).

    turn tab again and check... you should be fine now, charge it again 100% and use as usual.

    That should do correct chip calibration.


    PS: the reason why this chip calibration went bad at the first still remains open.



    EDIT: just want to give a shortcut for those who does not feel like reading through the thread.

    http://xdaforums.com/showpost.php?p=16771651&postcount=41

    Edit: here is calibration procedure which was modified down this thread ...

    1. in CWM/recovery let it sit till battery in terminal will show less then 3700. The less you can get it the better. 3400 is probably absolute minimum.

    2. shut down tab and let it sit for 1 hour.

    3. plug it to charger and charge it for 5 hours.

    4. disconnected charger and let it sit for 1 hour.

    5. boot up your tab and test it, it your battery still not calibrated you can flash back your backup and repeat calibration procedure.

    Edit: if you physically disconnect battery (you have to disassemble tablet) and keep it for couple min. that would trigger FG chip to start with default SOC curve.
    17
    I want to give you guys updates on my findings regarding fuel gauge chip Samsung is using in our tabs.

    It's MAX17042. I spend lots of time looking for datasheet but cannot find it. I found some very similar chip but still not exact. It looks like this chip was specially designed for Samsung by Maxim. So any further knowledge was derived from looking at various drivers for different Samsung devices.

    Ok, looks like max17042 is utilizing combination of coulomb-counter with impedance tracking algorithm. What does it practically mean?

    There is "quick start"/"quick charge estimate" software function but it's not accessible without special cable or kernel software change. If someone wants to try this I can elaborate on that more.

    What can we do without any special thingy?

    Tab needs to be at rest (turned off) for at least an hour when its empty and then when it charged back. This will let chip to make 2 open circuit voltage measurements.

    How to make sure that tab is discharged enough for calibration to take the place? If capacity is off big time then gauge may report SOC 30% but in the fact battery is in 70%, so chip will not execute calibration procedure.

    The most sure way to check this is in terminal, execute this command:

    cat /sys/class/power_supply/battery/voltage_now

    or through adb:

    adb shell cat /sys/class/power_supply/battery/voltage_now

    your good discharged start point should be anything below 3700 (3.7V). If your tab is telling that you have 0% capacity but voltage is more then 3700 then keep rebooting tab (this will refresh counter for a moment) or just boot in CWM and let tab run/sit there for some time.

    Then charge it with power adapter to 100%, you can check voltage at this point - should be around 4100, usually you should be good.

    Then shutdown tab for another hour or two.

    That's it. You should be good now unless you are still using certain custom kernels.


    PS: I have heard cases when SOC miscalculation occurred on totally stock devices, well, I have no explanation for that, but with custom kernels which allow to charge through USB cable - there is a code path to write wrong data into remaining capacity counter stored in the fuel gauge chip.

    After it happens and even when you are back on stock kernel then it will take some time for the chip to slowly correct itself or you need to force recalibration outlined above.

    Btw, resent custom kernel (from pershoot) does not include charging by USB functionality. Well, there is nothing wrong with that idea. It just Samsung implementation of charging algorithm is not good if such function will be allowed.
    3
    I agree. The problem is the devs refuse to to add a disclaimer of the issues. Im sure if some of the people in this thread knew flashing other kernels and ROMs would cause this battery damage (which it does as statistics dont lie) they wouldnt do it.

    If you can do anything to help protect people from this issue it would be to state a clear disclaimer of this issue in all aftermarket kernel and ROM threads. Why is this not being done? :confused: You cant argue with the dozens of people here who have gotten this issue after they flashed ROM/ kernel.

    Be aware that I know you may not value me or my tablet but I ask for you to value others as they spent their hard working money on these tablets and it hurts me to see their units become crippled like this.

    exactly. you spend your money, and we make it multiply overnight. we do things the manufacturer wouldn't dream of doing (sometimes), and/or did not implement. you get to see development right before your eyes and be a part of something great in the making. for example, if i didnt value everyone's tabs, i wouldn't work so dilligently to perfect things across numerous devices. if i didn't care to make said device great (to the best of my ability), i wouldn't post anything. i like to share and have everyone reap the benefits.

    you are not protecting anyone by alienating yourself, in the way that has been done, thus far. this makes your core statement/focus lose credibility by the tenfold.

    here is a better way to phrase something:
    hey. im receiving xx issue. any logs or something i can get for you to try and rectify the issue?

    that would help a ton of people.
    2
    May I ask what do you mean by rest time intervals of 1 and 5 hours?

    Does it mean that the calibration will only take place when the tab is off for 1 hour, then switch on and used till battery depleted by a further 40% minimum and the switch off for another 5 hour. Correct?

    Also , is this 40% refer to value before or after calibration? I asked this because when I restart my tab the value changed (ex: 36% before restart to 53% after restart)

    Yes that's correct.

    Fuel gauge chip will take 1 measurement of open circuit voltage and internal resistance only when battery is at rest (no charge/discharge) for at least 40min. - so I say 1 hour just to be sure...

    Consecutive measurements, from which gauge chip can derive capacity of the battery have to be at least 40% and 5 hours apart.

    Technically speaking, that 40% difference can be in either directions. Say you have 40% as of now, leave it in rest for 1 hour, then charge it to 100% and leave it at rest for 5 hours and you will have same result.

    Condition "at rest" means voltage change less then 4mV (or mkV) per sec. - I don't remember.

    When tablet is in sleep some background processes may awake tablet briefly and reset the 1 hour counter - so to make it work for sure, simply do shutdown.

    if you want additional reading on my findings then look here:

    http://xdaforums.com/showpost.php?p=16615800&postcount=517
    2
    My previous posted method of calibration (what the op says) did in fact stop the battery from super draining then going back up after reboot. I can't say for sure if the battery is completely back to normal, I have nothing to compare it to but as far as I can tell I'm running normal again.

    you should be looking about 10% per hour battery usage for normal browsing on wifi