yashsingh1/xdaforums huggingface dataset:
[Nexus One Android Development] RogerPodacter:
ah yes i can see the problem which is kinda related to what i posted the other day about running out of mAh. the learn flag will not trip if you are below the empty mAh point, which you are showing near zero there. i think the empty mAh point is 18.2mAh, so technically you want to hit that point at empty volt.

your status register even shows the AE flag and standby flag are tripped, just not the learn flag. all you do in that situation is a few minutes before you get to that point, maybe at 3.5 volts, echo 0x10 03 and that will bump up your mAh and guarantee you trip the learn flag.

let me know how that works out. from the log above it looks like you gave it a shot, then made a second attempt on that log. cause its very rare to have mAh and volt line up so perfectly!

EDIT: just realized you did do that echo command. i would do the command at each attempt. so if you did it for the first one, then gave it a second shot, do the command again. the idea is to guarantee the volt is tripped before the mAh.
[Nexus One Android Development] RogerPodacter:
i get exactly what you are wanting. i'm sure its possible, maybe even script or app could do it in the future. but in my head i cant help but wonder if it really makes a difference? because to me it seems when we do that sequence, all we are doing is tricking the percentage meter into thinking its above 100% for way long than it actually is. but in reality our battery starts at a top end voltage and dies at a low end, so those 2 points are fixed. i dont think you're really gaining anything that way, jsut that you are showing it above 100 for much longer!
[Nexus One Android Development] chowlala:
Yeah. I can't help keep thinking that we can't force more mAh's or mV's into the battery than it's currently can take. Somehow "bump charging" to me isn't all that real, I don't know for sure though since there's no numbers to back this up.

I'm still assuming on the top end, we can't charge more than the "age" limit of the battery. But on the lower end though, we could possibly prolong battery time by lowering the aevolt. Very difficult to say what that will buy us though. I read a couple of days back on the Gizmodo site bout some battery stuff. Wonder if there's a chance for us to revive the "dead bits" of the battery somehow. You can read the article here > http://gizmodo.com/5681005/giz-explains-why-batteries-die?skyline=true&s=i

So difficult to pinpoint the issue.

We should continue testing and pushing limits.
[Nexus One Android Development] ms79723:
I thought about that when trying to apply the Desire battery fix to my Evo. The battery fix just doesn't seem to work for my phone and I assumed it was because I was trying to set if-else statements with percentage as opposed to the voltage. The voltage seems to make more since to me since that number is set. The max voltage number I see with battery indicator whenever my phone is fully charged is 4.198V but as soon as I take it off the charger I drop to 4.01. Wouldn't it make sense to use some code that constantly chargers until the voltage reaches 4.196V or over, then discharges to 4.195V and then continues to charge again. Wouldn't that keep the phone at 100%?
[Nexus One Android Development] RogerPodacter:
well here's the thing. you've watched the current as you charge to full, and you see that milli amps get lower and lower, right? and we know that by default the chip said battery is full when current gets <80mA. but if we were to remove that, or lower it which we did, it just gets lower and lower till it eventually would hit zero, meaning the battery is fully charged and cant take anymore juice. that voltage is technically 4.2 volts. we have another register called charge voltage, which i think is register 0x64, and it is set to 4.099 volts. but that is kinda irrelevant since the <20mA we put guarantees we will always be about 4.18 volts anyway.

my point is that the battery is full when it cant take anymore current, which we are basically close to maxed out with <20. technically you could set it to zero or maybe 5, but that would just take forever to charge to full.

when we bump charge, the battery is just letting it take in as much as it can till current gets to zero. so its basically the same thing.

so for the top end, to maximize we could set our age to 100% and set full40 to some crazy high number like 3000 which would guarantee that age does not artificially limit the charge. but it all comes back to the current going in to the battery, and it just wont take any more once current gets near zero.

so that leaves basically only the bottom end to really play around with and try to extend. we may just be crapped out if we cant squeeze anymore from it.
[Nexus One Android Development] RogerPodacter:
well if you have been playing with the desire driver, i thought you could fix that by removing the 95% if statement. wasnt there a problem where the phone charges to full, slowly drains to 95%, then back up over and over again? i see a little drop when i take it off the charger, but not that much.

anyway at full charge i hit about 4.187, and when i take it off it drops to about 4.15 which i think is normal and the best it will get since there is a little voltage drop when the load is placed on the battery.

like i said in my previous post to chow, the voltage is whatever is happens to be at its full charge point. meaning it takes in less and less current, and at the same time voltage slowly rises. and whatever the voltage happens to be when that current stops pulling is the final voltage value, not really a way to change that.
[Nexus One Android Development] ms79723:
I've been playing with the fix on my Evo though, and so far, no dice. I had a feeling that I need to add the ds2784 drivers when running menuconfig..and I did that, but I got a ton of errors and the kernel did not compile. Said something about how some attributes were undeclared in the htc_battery.o file...now im stuck.
[Nexus One Android Development] samarium:
I updated the capacity each time the voltage seemed ok but that capacity was running out.

Anyway, I now have new 2600 mAh battery from dealextreme.com to test.

Note that currently my phone sets battery age to 100% on boot.

dumpreg:00: 4f 07 03 11 03 1b 2c 2d 04 24 1d 00 63 40 08 1a
dumpreg:10: 0c 01 41 90 80 80 7f e8 00 fc 00 38 ff ff ff 00
dumpreg:20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
dumpreg:60: 42 ff 1a 21 d2 18 af 0f 04 43 1a ae 00 06 06 00
dumpreg:70: 05 06 0e 0d 02 04 02 03 04 0a 00 ed 1e 14 0a 1d
dumpreg:b0: 00 00
getFull40:Full40: 2845 mAh
getavgcurrent:110952
getcurrent:181905
getmAh:1256000
getvoltage:3879484
setAEvolt:AEvolt: 3416
setage:Battery's age: 100
statusreg:0x07

It will be interesting to see how this battery goes, however the basic battery programming is looking more promising, ie basically correct. I'm still waiting for a 1600 mAh battery to be delivered.
[Nexus One Android Development] mtw4991:
First time using the app, set age to 100, full to 1558, empty to 3201, <20. I hit learn I think as the app showed 0x71. Then charged to full, but at 80% and 1275mv it jumped from 80% to 100% at 1547mAh and quit charging?

Does this mean my battery is really 87%...1275/1452? Should I change the age now and charge back to full so it will die at 0%?
[Nexus One Android Development] RogerPodacter:
It doesn't sound like the learn cycle continued thru the entire charge which it needs to do. If a learn completes successfully then it will update your age automatically on its own to whatever it determined from that learn cycle.

It's possible a time out stopped your learn. We submitted to pershoot a fixed driver time out poll, so make sure to use his latest.

The app will be refined to track your learn while in progress and warn you if fails in the middle. But that's next revision.
[Nexus One Android Development] temasek:
Using the utility, before the learn flag lights up I am already powering down.
[Nexus One Android Development] chowlala:
Lol. With all the messing around on the kernel and setreg stuff, I've tried to do a manual learn mode twice, and both didn't happen. Haha.

Just setting my age manually now. Too lazy to worry about it anymore. I simply assume I run on 12 hours worth of battery everyday. Haha.

Looking forward to the full app though! =) Gonna be great!
[Nexus One Android Development] temasek:
Same. Twice learn failed. Once manual once looking from the app flagging. Both failed learn. I am back to age 94 upon reboot after charging both times.
[Nexus One Android Development] RogerPodacter:
Damn so It's still not working for learn mode with the app? Are the flags turning on and off though in the app? Is it hitting learn then stepping, or just no learn flag at all? And most important are you running out of mAh before empty volt is reached? I should mention to set age to 100 at full charge before making the attempt. And when it starts getting close to empty volt, if it looks like its getting close to zero mAh then do that echo command, 0x10 03.

That stuff will be automated eventually, as well as tab 2 working, and converted dumpreg hex numbers.

Also pershoot's kernel was just updated with a fixed time out poll. Not sure if It's released yet but should be.
[Nexus One Android Development] temasek:
Coming close to 3.201mV the AEF and SEF flags turned on and when it it very close to 3201 it auto power off. The LEARNF flag did not turn on at all. I had set detect learn mode on btw.
[Nexus One Android Development] RogerPodacter:
Ok so It's at least seeing changes in the status register right before shut down. The only thing I could think is set age to 100 and charge to full, then try. And watch if mAh is getting close to zero as that will stop the learn flag from turning on. Other than that I'm out of ideas! Seems to work for me every time I try:-).
[Nexus One Android Development] temasek:
Noted thanks. Will try it. Can't wait.for your completed utility. Should be awesome!
[Nexus One Android Development] RogerPodacter:
Maybe that command isn't enough when getting close to running out of mAh. Try 0x10 05 instead next time. That should really bump it up a bit.
[Nexus One Android Development] rault18:
tried the first method and did work..im getting all the way down to 1 percent b4 shutoff. Before the calibration i was getting the phone off at 10 percent
[Nexus One Android Development] chowlala:
Good on ya! Keep it that way for a bit till we find a more proper working method with the setreg tweaks. Hehe. =)
[Nexus One Android Development] RogerPodacter:
Yeah for sure. And the idea is to activate that second tab on the app so you can just enter a regular number and it will convert it to hex and save it automatically for you. We could add a few more registers if needed but I can't think of other important ones. Also may could add a radio button with like 4 options for full40 maybe a few of the common ones like 1400, 2700, 3200 and 3400 etc. I'm not a good app writer/coder so looking for UI and layout suggestions etc. ;-)
[Nexus One Android Development] theloginwithnoname:
Quite agree, chow. I go through periods where I can't be arsed tweaking - trouble is, that's when I always learn/see new stuff, and so I'm sucked back into the haxing! :D
[Nexus One Android Development] theloginwithnoname:
Agreed (though if I were being picky, I think chat about the app should be in the other thread! *ducks*)

Perhaps it might be worth putting together a Best Practise list and adding it to the first post. I'm definately seeing more capacity with voltAE set to 3100mV (3080) and min charge at ~35mAh.
[Nexus One Android Development] theloginwithnoname:
BTW, the kernel driver changes are now in the standard CM kernel :D
[Nexus One Android Development] rault18:
quick question.

did a calibration and realized that it drops to90 percent within like 2 hours.

is that kinda normal?

(phone was on wifi, standing an some texting here and there and maybe a little facebook lol)
[Nexus One Android Development] mtw4991:
just tried another learn w/app...had to set 0x10 05 as I wasn't quick enough. This time it bounced wildly around 3.175 but aEvolt was set to 3.201 then it shut off??! I did get learn last night but it jumped from 80%>>100% with multiple "active wakelock ds2784" in OS Monitor...on WM kernel btw, not pershoots', waiting for WM to add the commits. Frustrating to say the least, lol.

Login, congrats on the CM kernel commits btw!
[Nexus One Android Development] temasek:
Woohoo!!!!!!

I believe I did a proper learning with the utility used.

When I saw the first 2 flags lighted up, my fingers were on the switch plug in. I was surprised to see a dialog box asking me to plugin now. The learn flag was on also. This time it did not auto power down. Rather my battery % changed from 15% to 0% and charging.

- Before

Full40 - 1452

Age - 100

Full charge - 1436mAh

- After 4 hrs charging (I was asleep)

Full40 remain 1452

Age remain 100

Full charge changed to 1236mAh

I am still wondering why the learning change that instead of the age. Anyway I will drain this battery to see if it really did a proper learning. Will report back my day end.

Edit: a reboot my age now is 85%. I think is learnt. Good utility. Can't wait for final release!

-
[Nexus One Android Development] pukemon:
don't know if anybody knows or cares. mugen batteries is having 20% off today and with google checkout another 5 bucks off. i was on the fence about the 3200 mah battery but for $61 shipped i think i'll try it.
[Nexus One Android Development] ms79723:
Question...what does:

(di->status.status_reg & 0x80)

and

(check_timeout(di->last_poll, di->last_charge_seen, 60 * 60)

mean?

I have no idea about the first, and I'm not sure how the second one works. Is the 60 * 60 supposed to represent an hour? What happens if i cange the first '60' to a '1'?
[Nexus One Android Development] rault18:
ok so i dont understand something about charging.

MY phone got to 100 percent charging ad it was all good.

Now i just realized that even usb connected the phone is draining!!!! is that normal??? is it supposed to do that??

any way to fix that? or is that a preventive meassurement?"
[Nexus One Android Development] theloginwithnoname:
it's a line of code that is conditionally used to determine whether the battery is reporting full or not - the statement is "battery_full == true"

yes

would have to check the context of the code in the source...
[Nexus One Android Development] theloginwithnoname:
It's by design. It was introduced into the kernel a while back, to stop the batteries constantly getting fully-charged, dropping to 99%, getting fully-charged/topped-up, dropping to 99% etc. Depending on kernel, it can wait til 95% or even 90% to reduce the charging.

way to fix is to use a kernel that has the delayed charge code removed - I think WM has this in his (according to his latest blog post comments).
[Nexus One Android Development] ms79723:
is the delayed charge code this:

if (di->status.current_uA > 1024)
di->last_charge_seen = di->last_poll;
else if (di->last_charge_mode != CHARGE_OFF &&
check_timeout(di->last_poll, di->last_charge_seen, 60 * 60)) {
if (di->last_charge_mode == CHARGE_BATT_DISABLE) {
/* The charger is only powering the phone. Toggle the
* enable line periodically to prevent auto shutdown.
*/
di->last_charge_seen = di->last_poll;
pr_info("batt: charging POKE CHARGER\n");
di->charge(0, 0);
udelay(10);
di->charge(1, source == CHARGE_FAST);
} else {
/* The charger has probably stopped charging. Turn it
* off until the next sample period.
*/
charge_timeout = true;
charge_mode = CHARGE_OFF;
}
}

so if all I did was remove that line of code...it would discharge to 99% then recharge back to 100& back and forth?
[Nexus One Android Development] myakove:
I just hit learn mod and then charge it until the battery is full but nothing has change, battery age still on 94% even after reboot. And while charging I had jump from 85% to 100%.

<6>[10362.028167] batt: 85%, 4138 mV, -36 mA (24 avg), 39.7 C, 1198 mAh

<6>[10412.148956] batt: 85%, 4138 mV, -9 mA (19 avg), 39.7 C, 1198 mAh

<6>[10462.269805] batt: 100%, 4133 mV, 59 mA (6 avg), 40.0 C, 1414 mAh

<6>[10462.295013] batt: charging BATTOFF [FULL]

My battery setting:
[Nexus One Android Development] Midget010:
This might sound like a really stupid question, and I sorry for being a noob, but how can I find out the battery mah?
[Nexus One Android Development] BakaPhoenix:
On the back of the battery ^^
[Nexus One Android Development] theloginwithnoname:
Not ideal, and doesn't look like you hit learn. However it seems to be telling you your age is 85% - set age manually and you should be good to go from 100% -> 1%.

p.s. battery is rather hot!
[Nexus One Android Development] theloginwithnoname:
OK so this is getting very very weird.

Just completed an off-learn cycle overnight and ended up with 1292mAh and an age of 90%!!

So I've gone from the device first learning the age at 84% and by tweaking the lower volt and min charge, via normal on-charging, up to 90%

Anyone else seeing these gains?

Very pleased.
[Nexus One Android Development] temasek:
Damn. I gained from 84% (manual learning) to 85% (using battery app).
[Nexus One Android Development] mtw4991:
Seems I can't hit learn no matter whatpp do using the app anymore. Tried 3 times this morning and got aef and sef flags turned on but it died prior to hitting 3201mv. Even tried setting setreg to 0x10 03/04. Still died early before 3201. Slammed the charger within a second, no more, as it was resting in the charge slot almost plugged in! Still showed 0x61, not 71 and the learnf button never lit up, just auto shutdown.

Any clues? Using the modified app from 11/27 btw.
[Nexus One Android Development] mtw4991:
Ok, I'm confused. Did a full on-charge from auto-shutdown. Jumped from 82% at 1260mAh and 4187mV to 100% at 1542mAh and 4187mV. I have full40 set to 1558, aEv set to 3201.

Does this mean my battery's age is 82%?

Does this mean battery age is 90% (1260/1400mAh)?

Does this mean battery age is 86.7% (1260/1452mAh)

I'm not sure what to reset my age to here????
[Nexus One Android Development] samarium:
I would use jump point capacity / full 40.
[Nexus One Android Development] samarium:
I'm having similar problems, however it seems to depend on the battery.

My 2700 doesn't want to hit LEARNF despite multiple poking of register 0x10. It just seems to hit empty, often with the voltage above 3416. When I set full40 high, and just charge it it seems to tail out around 2550 mAh.

My 2600 hit first time, but had to use 0x10 twice, and it tailed out around 2950.

Still have N1, HTC and 1600 batteries to investigate.
[Nexus One Android Development] mtw4991:
That would be 1260 / 1558 = 80%, but the full40 of 1558 is a fake number? The rated capacity is 1400mah isn't it?
[Nexus One Android Development] samarium:
A capacity of 1400 mAh, or whatever the manufactured spec is, is in relation to the AEV of 3.416V.

If you reduce AEV, then you are allowing use of voltages below 3.416V, thus increasing capacity.

Batteries deteriorate over time and their capacity reduces. Age is a way of scaling the know usable capacity of the battery without constantly updating full40.

If full40 is 1000, and age is 100%, then available capacity is 1000. If after a year, the actual capacity is 800, then you can set age 10 100% and full40 to 800, or leave full40 at 1000 and set age to 80%. Result is the same.

We either need to be able to save/restore age on phone reboot, and adjust age as the battery ages, or adjust full40 to compensate.

Either way we are a while away from solving those management issues.
[Nexus One Android Development] RogerPodacter:
You guys are getting this stuff now. One thing to note, the age value is supposed to count down on its own over time to simulate an aging battery. The palm pre identical battery does this just fine, and a new palm battery starts at 100 brand new. Our nexus battery does not do this, and we don't know why. In addition the nexus battery comes brand new set to 94, we don't know why.

The count down figures is escaping me but its something like. 0028% each full discharge, or like 4% every 300 full discharges. Partial discharges are added to accumulate one full discharge.

Again our nexus battery is not doing this like the palm pre does, though its identical chip. Maybe our battery is cheap, or programmed differently. Or maybe there's a good reason for this and we just don't know it.

One list interesting thing, our full40 is 1452 so that's the full capacity of our battery. But the age capacity register if you look is set to 1393mAh which just so happens to be 94% of 1452. Just food for thought. Personally I think we have cheap under powered batteries as I've not seen anyone hitting 100 on a learn cycle. However I did buy a second stock battery and that thing can blow thru all 1452mAh without turning off, though with a lowered empty volt point. So maybe its hit or miss.
[Nexus One Android Development] samarium:
I have a HTC G5 battery for the N1, which is programmed like an N1 battery, ie AEV 3.416V, age 94%, full40 1454 mAh, min charge current 80 mA.

I set 3.201V, 100%, 1800mAh, 40mA & did a learn cycle.

I'm using a recent home built CM kernel & ROM, probably around nightly 268/269 or RC2.

After 2 hours I was close to 1800mAh, and after 3.5 hours finally had CHRGTF at 2050 mAh & LEARNF cleared. However indicated charge immediately dropped to 1750 mAh. I reset full40 to 2100 mAh & rebooted and charge then showed 2030 mAh.

I'm not sure what is happening here, will have to wait until battery runs out to compare power down voltage / charge to see if I do have a calibrated battery or not. If it looks dodgy, I'm going to try a second learn cycle with full40 at 2100 mAh and maybe I won't get an immediate drop after CHRGTF.

Or 1750 mAh is the true capacity, in which case why does the learn indicate a higher intermediate point.
[Nexus One Android Development] chowlala:
Let's go knock on Google's door. Lol.

It's weird though. Do the other Android phones face this problem? How about the Desire versions which will most likely use the same batteries?

If it's battery chips = then other phones using the same battery would have the same problem.

If it's the Android OS = then all android phones should be messed.

Weird that it would be the N1 only.

*puzzled*
[Nexus One Android Development] theloginwithnoname:
I have access to a stock desire but without root it's difficult to find out what's going on. However, see below...

It is this, because the Palm Pre has the same problem - we probably wouldn't have figured out our solutions if the Pre problem did not exist or get fixed!

or 3) the code implementation for ds2784 for Nexus One/generic Android is flawed, but HTC fixed up their battery driver for Desire. There is a lot different between Desire and Nexus One drivers, including some weird-ass 95%/charge for an hour extra code - hence Pers' message about charging for an extra hour.

If you would like to disect the differences, I would be happy to implement the good bits in our driver ;)