yashsingh1/xdaforums huggingface dataset:
[Nexus One Android Development] RogerPodacter:
That's interesting cause only one time, last week while testing, I was able to do that all with the phone turned on. I drained completely, charged to full. The battery jumped from 1204 mAh to 1363 mAh (our pre coded full at my temperature at the moment). Then I drained to 89%, charged back up and got over 1400 mAh. I've not been able to reproduce it.

Also I've been testing stock kernel without our additions during that test. And once it hit full at 1400 it jumped down to 1363 mAh, did the opposite jump.
[Nexus One Android Development] RogerPodacter:
Yeah the number before the jump is your true capacity. Over in the pre thread they have the same issue. Once they re calibrated, turned out that was the actual true capacity. Our battery meter is "lying" to us.

Edit: actually if that is true you may have got into learning mode. It's possible all you need to do is hit 3.4 volts at the right time then plug in the charger.
[Nexus One Android Development] RogerPodacter:
when you get situated and all, could you try to add the changes i posted in the battery cal app thread? so are you running your compiled ROM? i was gonna recomment to compile a stock cyanogen ROM first just to make sure its working. then try the changes. then take a look at mine too!:)

i think your post 477 changes would get the most performance out of our batteries. reading some more maxim docs last night, they say the true full charge for a lithium ion battery is when current drops to zero. they just use a cutoff of C/20 for reducing charge time to around 2 - 2.5 hours, and for convenience. so there's no reason why we cant change it.

also we can just edit the actual <80 mA condition in the ds2784 register values, and not even worry about adding in this code. its all changeable:D
[Nexus One Android Development] RogerPodacter:
Here is what we should be able to change once we get going (attached pic).
[Nexus One Android Development] theloginwithnoname:
I'm happy to put the code changes in but you fastboot boot at your own risk cos: I, like yourself, am not sure about those bitwise things and putting them in wrong in such an integral part of the device could have b-a-d consequences :D Safer to have a little client app that tries to read them and either FCs / fails / causes a reboot.

No, just the kernel at present. I had a problem building the ROM. It's compiling again now. I would love to say to you "Do it yourself, it's really easy to do" but in actual fact it's still a right sh1t! Compounded by the fact the CM wiki entry was updated in the last few days and is much harder to follow as a result! And running Linux virtuals on Windows 7 is terrible. I may get round to building a VMware image that people can successfully just take and build on, but I'll think about that in a while ;)

that is very lame of "them"! Who wouldn't want another 30 mins on the charger (which most people do overnight when asleep anyway) for another hour or two's battery? nuts.

Bits in bold - how do you mean Rog?
[Nexus One Android Development] theloginwithnoname:
ooooh, I *like* that :D
[Nexus One Android Development] RogerPodacter:
thanks, i understand the risk. its using ONLY the read function of the battery, as can be seen in the slave driver w1_ds2784.

what i meant was the kernel, not the entire ROM, sorrry. if you have a working kernel, then we are good to go:).

the <80 mA requirement is built into the ds2784 register, that's why the value was used in google's driver code (they since removed it though). take a look at the screen shot above i just posted. EDIT: sorry, i attached the additional screenshot below.

the equation they are using for full is C/20, in our case 1400/20 = 70 mA. and actually before we started all this, looking thru the logs it WAS being cutoff at 70mA rather than 80mA. the last value we always saw was 79mA, 72mA, etc then it chut off. just thought that was interesting (even though the screen below uses 80mA for a 1200 battery...who knows about that one). so we are forcing it with these code changes, but we really should just change it in the register it self, address (hex) 65.
[Nexus One Android Development] chowlala:
Been testing it further. Used USB cable connected to my Mac for charging. This time, overnight, the charge hit 1392mAh. Been seeing small little steady increases.
[Nexus One Android Development] theloginwithnoname:
Device still on at 6%, which I've not had for a long while. mV=3659, mAh=78400.

Will edit as it happens and post a log after

edit1: 5%, 3654, 73600

edit2: 4%, 3644, 57600 - battery icon is red with single line through it but still has the figure '4' over it

edit3: 3%, 3610, 43200

edit4: 2%, 3581, 32000

edit5: 1%, 3513, 17600

edit6: last recorded: 3478 and 9600

gheesh that was tedious but had to take one for the team!
[Nexus One Android Development] ram130:
Hmm interesting really. Hey try it with my method now exactly and see what results you can get.

Could usb charging have some different rules?
[Nexus One Android Development] theloginwithnoname:
We know it charges at a slower rate, but not sure if this slower rate is beneficial when it gets to the last 10% of the battery - does it trickle more than the wall charger? I would doubt it as I think the battery controls the incoming power/charge rate.

I started exploring the idea of slowing down the charge (at the end of it), to really hit top capacity, a page or two back. May implement this code after the current tests.
[Nexus One Android Development] chowlala:
So, I picked up somewhere that in order for the battery to begin calibration, you need to charge it to full, drain it till EMPTY. Now, pretty sure we all know this, and we've all read it countless of times - but:

Have we ever tried draining it till it's literally empty? Like - can't even get to turn on the phone empty?

Just throwing more stuff out, maybe the phone learns when it's "emptied".
[Nexus One Android Development] theloginwithnoname:
Ahem, come on there chowlala - recent posts and all that!

Officially we need to see the LEARNF flag being set before we know. Hopefully I'll be able to narrow this down over the coming days.
[Nexus One Android Development] RogerPodacter:
i'm confused, your phone used to die at 6-10% previously, correct? cause your above logs going down to 1% look spot on perfect, whatever you did.
[Nexus One Android Development] RogerPodacter:
the only thing i know is that slower charge rate prolongs the battery life overall, not individual charges per se. but if you use USB for 6 months and AC for 6 months, your battery will be in better condition from the 6 months of usb charging. that's all i've heard about these differences, nothing with specific charge cycles.
[Nexus One Android Development] theloginwithnoname:
yes, exactly. just top-end capacity is shot to sh^W bits ;)
[Nexus One Android Development] theloginwithnoname:
ah OK.

Get my PM?
[Nexus One Android Development] RogerPodacter:
the problem is we cant "see" when this happens. when our battery hits Vudv, it sets the LEARNF flag and you only have about 10 seconds from that point to plug in the charger. our battery log only updates every 50 seconds, so we do not have the capability to see "real time" voltage on a fast enough interval to do this.

in fact, nonamelogin, we should do a quick side edit of the driver, and see what happens when we ONLY change the sample rate in the battery driver, to say5-10 seconds, and see what happens. i bet that would work.
[Nexus One Android Development] RogerPodacter:
you didnt get learn mode because you still have that jump. unless you mean you JUST got it activated on that particular charge up, which if so, then do a full discharge and let us know!

yes my gut feeling is that we DO actually get some extra charge, because we are raising the current counted by the ACR (current accumul register) which is actually reading additional juice going into the battery. with that, we are getting additional voltage (usually we stop at 4.16 volts, but bump charge or <20mA charges get us up to 4.18/4.19 volts). so we are definitely adding additional capacity, especially when maxim flat out says C/20 is when they consider their batteries "full".

i encourage everyone to read these (i'll post again), as you will flat out be an expert with our battery. they explain EVERYTHING, including giving examples. you wont have any more questions about why the battery "jumps" or what 1361mAh means:D.

http://pdfserv.maxim-ic.com/en/an/AN4043.pdf

http://pdfserv.maxim-ic.com/en/an/AN3463.pdf

http://pdfserv.maxim-ic.com/en/an/AN3584.pdf

http://pdfserv.maxim-ic.com/en/an/AN131.pdf
[Nexus One Android Development] pershoot:
sorry all have not been able to help much as of late. battling other issues. ill jump back on track once i sort/semi-sort things.
[Nexus One Android Development] chowlala:
How bout searching for away to increase the learn timer? I'm sure there's gotta be a trigger somewhere.
[Nexus One Android Development] RogerPodacter:
yes you are exactly right. the palm pre guys raised the Vunv value from 3.4 volts to 3.416 or so to give a few extra seconds to start the learn mode. that brings us back to the original problem of writing to the register to change values, which is what the other thread is dedicated to; making the calibration app. and at that point of changing registers then its trivial to get learn mode going.
[Nexus One Android Development] chowlala:
I figured out how to beat the jump last night.

I was charging nearly to the top cap, when I realized that I should check for the jump. My jump happened at 85% -> 100%.

So, I unplugged, drained the battery to 83%, and started charging again, this time, I hit 1396 mAh. And then it stopped, dipped a little, and went up again to 139x mAh.

But then, oddly, after unplugging, it started discharging rapidly, like within an hour I already lost 5%-6%.

Don't have logs because it's a busy morning. Will try to pull some the next day.
[Nexus One Android Development] theloginwithnoname:
worth saving them anyway (in terminal use: dmesg > /sdcard/filename or cat /sys/kernel/debug/batt* > /sdcard/another-filename)

I would reckon you'll just lose that from the bottom - i.e. it will cut off around 10-17%

I've upped the FAST_POLL rate to 20 (which is 10 seconds) - this may give us the LEARNF flag on the battery in the battery log, though I'm not overly confident.

I've also added the register and active_empty rates to dmesg so we can monitor via OS Monitor rather than command line.

Will let you know how I get on.

p.s. does anyone know a really good way of draining the battery fast?!
[Nexus One Android Development] theloginwithnoname:
Calling all low-level developers; help needed with registers - see battery calibration app thread if you are willing and/or/able to help!

cheers.
[Nexus One Android Development] ram130:
You can leave the display on at full brightness. Enable bluetooth, wifi(with no network connected), 3G, make a call or watch a movie or play music loudly or stream pandora. :D
[Nexus One Android Development] theloginwithnoname:
I plumped for a screen timeout of 30 mins and leaving maps/latitude on - seemed to drain sufficiently ;)
[Nexus One Android Development] theloginwithnoname:
OK, so I drained my battery overnight. Came to it early this morning and captured a log. Battery indicator was green and 11% when device just powered off. No red battery indicator. It died about 10-20 seconds after I captured.

Plugged into wall charger and did full off-charge (to green + 45 mins).

Charged to 1380 so I don't think I caught a learn cycle.

Checked the capture log and last two entries were 3449 then 3454 (so close to 3.4) and register status was still 0x07. None of the extra (likely bogus) values I was logging changed either.

Think we need to try and set the Active Empty Voltage higher, as per Pre thread, because mine seems to die above 3.4 (whether it's at 0% or 11%) and thus is probably not having the chance to get into learning mode.
[Nexus One Android Development] chowlala:
Ok, so my theory about beating the "jump %" was a big failure. Still got dumped out at 10% or so. This is bad, if my jump is at 85% and shut down at 10%, it means I'm like operating only at 75% capacity.

Maybe I should just order a 1700mAh battery and be done with it. Haha. Time to scour for more ways to calibrate the damn battery. :(
[Nexus One Android Development] RogerPodacter:
If you can monitor the status register, learning mode will be active when its value is 71. From the pre thread:

They ended up setting voltage active empty up one increment higher to give some time to plug in.

http://forums.precentral.net/palm-pre/256967-find-out-how-good-bad-your-battery-6.html#post2584858
[Nexus One Android Development] RogerPodacter:
EDITED, i'm an idiot, i didnt see faster polling in dmesg log to 10 seconds! in that case, see my post below.

also, can you pull our voltage active empty value yet? Is it same as the pre (3.933 actually, raised it to like 3.412 or so, just one increment)
[Nexus One Android Development] RogerPodacter:
you know i'm starting to think those values are true. EXACTLY like the pre thread, we have:

(age*128)/100=121 hex.

age = 94.53125

We know full40*age= age capacity.

full40=1459 -> 1379 mAh

full30=1458 -> 1378 mAh

full20=1445 -> 1365 mAh what temperature is our phone normally, 20, 30 or so?

full10=1434 -> 1355 mAh

that's a big coincidence. whatever temperature your phone is reading is what tells the get full. that's why when we charge to full at room temperature 20C, sometimes it goes to 1361 and others 1368, cause your phone was hotter. seems awfully close to me. must be a huge coincidence, cause why would the age scalar not be changing and stay always at 121? so its gotta be bogus, right?

EDIT: if our age is supposed to reduce with charge cycles, why so we still always see 1361 mAh or so when full, even when it "jumps" up to 100%? we've been religiously watching our own numbers now for weeks or more. why havent we seen our full number drop even a little in dmesg log (OS monitor)?
[Nexus One Android Development] theloginwithnoname:
O-K... so hang on! I'm now on 124mAh at 9% with 3600mV! Maybe I did catch that learning mode... Will report back where it finishes.

edit1: switched to my zImage with quick logging. register status on 9%, 3566mV, 116mAh = 0x07. at 9%, 3542, 116 = 0x027. then went to 8%. These are all 10 seconds in between. Is this the register change perhaps?
[Nexus One Android Development] theloginwithnoname:
Here's my most recent log - device shutdown seconds after I captured it:

9 3581 -312 -21 118400 273 9 none off 0x07 0
19 3576 -205 -21 116800 273 9 none off 0x07 0
29 3566 -278 -245 116800 273 9 none off 0x07 0
39 3542 -326 -245 115200 273 9 none off 0x27 0
51 3552 -353 -320 113600 276 8 none off 0x27 0
61 3576 -213 -320 113600 277 8 none off 0x27 0
72 3576 -118 -320 113600 278 8 none off 0x27 0
...

732 3454 -115 -117 91200 301 7 none off 0x27 0
742 3449 -131 -117 91200 303 7 none off 0x27 0
752 3449 -117 -122 91200 303 7 none off 0x27 0
777 3444 -115 -130 89600 303 7 none off 0x27 0
787 3439 -121 -130 89600 303 6 none off 0x27 0

This is the lowest I've seen the mV and mAh values (ever?), but I would reiterate what I said a couple of posts up - that I will never get to 3400mV before the shutdown.

edit: 6% = did not hit learning mode :(

is it 0x71 or is it when bit 4 is set?! reason I ask is 0x27 is binary 0001 1011, which has bit 4 set...
[Nexus One Android Development] RogerPodacter:
Yes, see my post above, it can be many different combinations of binary with bit 4 set to one. We won't know exactly till it happens, which is why I posted possibilities.

What I wanna know is why the hell is your status register 0x07 and mine won't leave 01?
[Nexus One Android Development] theloginwithnoname:
Haven't been able to get a useful value out of it (I refer you to my "bitwise meltdown" post ;)) but I think that's the next most-useful one. Will add that to the code in the next day or so, but probably need to know which bitwises to do on it, otherwise it will likely mean balls-all.
[Nexus One Android Development] RogerPodacter:
Oh I finally figured out the bit shift stuff in the equations and reversing it out. I'll explain off line later. But I will test on mine if you compile one when you have time. Remember it is read only, no danger. I'll test if need be to be sure.

Now I'm at 21% and usually dies at 18% so real close now. Status still shows 01.

Edit: hey my active empty finally just changed from 160 to 140 for the first time in 2 days.

Edit 2: was you voltage active empty or whatever value non sense as in a very large number? Or other. Mind posting it?
[Nexus One Android Development] chowlala:
Hrm, just a thought. I'm not very good with codes as ya'll can see already. =P

Is there a way for us to disable charging? Then on the learning kick in, enable it? Like set it at a certain % to kick in the charger and disable the nocharge, etc? Something like that, if you get the idea.

Kinda like:

1) No charging enabled (but we plug in)

2) Battery hits "learning" (guess we take a guess where the % is)

3) Trigger kicks in, enabling charging, and removing nocharge

Sth like that. Just 2 cents.
[Nexus One Android Development] theloginwithnoname:
Yes chow, and good idea. I could hack the kernel code to say "if mAh < 3460, charging = CHARG_OFF". The problem with that might be, the physicals of having power going thorugh circuits means the battery may still receive power from charger and therefore not get any further down!

If there is a particular value to indicate learning set, we can then use it in that piece of logic/code to reverse not charging. If it's a bit, we can use that.

Still, definately worth trying; I'll have a mess with the code and see if poss.
[Nexus One Android Development] RogerPodacter:
Yo I think I got it! My phone shut down when replying to this post. I slammed in the charger, and now my status register is reading x071. Swear to god, not sure what it really means though.
[Nexus One Android Development] theloginwithnoname:
Yeah, I did Rog but I wasn't sure if you meant just 71 or every time bit 4 is set. Apologies if I didn't read it properly.

Surely this will be in one of those PDFs? I would be surprised if the battery is in learning mode for every value where bit 4 is set to true - there are a LOT of values for bit 4!

Good question. Others: please post your reg_status' from /sys/kernel/debug/batt*
[Nexus One Android Development] RogerPodacter:
Ok I think I got it. Now my status register changed from 71 to 0x61 which is 0011 1101. So bit 4 is still active. Damn I can't believe it.
[Nexus One Android Development] theloginwithnoname:
do not turn the charger off or pull it out!
[Nexus One Android Development] chowlala:
So... again? When do you slam in the charger? The second you see the "shutting down" bit?
[Nexus One Android Development] RogerPodacter:
Yes anytime bit 4 is set, 71 is just one possibility. The active empty flag must also be set, which is bit 2. That narrows it down some. bit 5 and 8 are blank. Any of those combinations will do the trick as I posted earlier.

Can you post your status value when you charge from zero?

So it was a very specific action I did (if this truly is working). Plugged in as soon as the powering down message appeared.
[Nexus One Android Development] theloginwithnoname:
Hang on old boy - 0x71 = 0111 0001 isn't it? I've just used Windows calculator in programmer mode. Click Hex radio button, typed in 71, hit Bin radio button, converted to that. How you doing it?

Mine was 0x67 (0110 0111 - no bit 4 :() when I started charging, after 5%/80mAh charge it went to 0x27 (0010 0111), from 198mAh it's been 0x07 (0000 0111).
[Nexus One Android Development] RogerPodacter:
**** are you saying I'm reversing my numbers? Let me go check the data sheet and pre thread. Pretty sure the value is reversed in an out of the register though.
[Nexus One Android Development] RogerPodacter:
No its definitely right. Refer to this post.

http://forums.precentral.net/palm-pre/256967-find-out-how-good-bad-your-battery-6.html#post2584858

Problem is 61 is not right, I goofed that one. So I lost it, and now it changed to 0x21. Trying again. The pre guys had lots of trouble with the bit clearing in the beginning for no reason.
[Nexus One Android Development] RogerPodacter:
So I lost it quickly just like the pre had that problem. Here's my log.

09/05/2010 08:11:02 [INFORMATION] batt: 0, 3537mV, 84mA (-53), 40.5C, 0mAh, 0x71, 93
09/05/2010 08:11:02 [INFORMATION] batt: charging OFF
09/05/2010 08:11:03 [INFORMATION] batt: charging FAST
09/05/2010 08:11:12 [INFORMATION] batt: 0, 3571mV, 418mA (-53), 40.5C, 0mAh, 0x71, 9
09/05/2010 08:11:23 [INFORMATION] batt: 0, 3596mV, 435mA (236), 40.5C, 1mAh, 0x71, 9
09/05/2010 08:11:33 [INFORMATION] batt: 0, 3591mV, 395mA (236), 40.5C, 3mAh, 0x71, 9
09/05/2010 08:11:43 [INFORMATION] batt: 0, 3571mV, 272mA (236), 40.3C, 3mAh, 0x71, 93
09/05/2010 08:11:53 [INFORMATION] batt: 0, 3576mV, 189mA (374), 40.2C, 4mAh, 0x71, 93
09/05/2010 08:12:04 [INFORMATION] batt: 0, 3542mV, -89mA (374), 40.2C, 4mAh, 0x61, 93
09/05/2010 08:12:15 [INFORMATION] batt: 0, 3571mV, 128mA (61), 40.2C, 4mAh, 0x61, 93
09/05/2010 08:12:34 [INFORMATION] batt: 0, 3566mV, 262mA (61), 40.2C, 4mAh, 0x61, 93
09/05/2010 08:13:04 [INFORMATION] batt: 0,
[Nexus One Android Development] RogerPodacter:
Well look at my temperature, 40 may be too hot. It's cut off for certain other things. I'm here in direct sunlight, let me move and try again.

Edit. What's interesting us when it switched to 61, that means active empty and standby empty flags were both still set, but learn flag was cleared. Interesting, its almost like you could imnediayekty try again.

Edit 2. Now my active empty changed to 93 (9.3 mAh).
[Nexus One Android Development] RogerPodacter:
Tried again and can't get it. Stays at 21. Damn that 71 was definitely learning active, I'm positive.

Also, pay attention to your active empty number, that's when you will shut down when you reach that value.

This driving me nuts. I've tried 5 times now, and status always at 21. So SOMETHING happened seeing 71 then 61. I had dome a full discharge, so maybe the voltage is too high now or some weird thing. This is gonna drive me crazy.
[Nexus One Android Development] RogerPodacter:
The pre guys actually did the same thing, disabled charging to do exact same thing for learn mode. I would think it would be way too difficult to fix our driver to do the same. But there is batt disable vs batt off mode, one disabled at the battery itself, the other turns off the charger.

I'm wondering why you see different status register values at various parts of charging vs what I see. We need to have others post their numbers to compare.
[Nexus One Android Development] RogerPodacter:
I never responded. Yes bit 4 set to 1 always means learning is active. And this doesn't happen without active empty flag bit 6 set as well. This will always be the case. So look at your different values to see what's going on thru the day.

I'm still in shock that I got it to 71 like that, when I had JUST posted a few possible combinations earlier. Wtf.

Edit: actually its looking like learn mode ONLY happens with value 0x71.

http://forums.precentral.net/palm-p...ost2601311.html?highlight=dumpreg#post2601311
[Nexus One Android Development] RogerPodacter:
I'm a maroon, figured out why learn mode stopped, the current dipped negative, take s look. Right in front of my face. Now to do it again is seeming very difficult.
[Nexus One Android Development] chowlala:
I think I managed to do the calibration.

Last night before bed I decided I'd do a test.

So, I drained the battery, wall charger cable next to me.

The instant I saw the "power down", I slammed in the wall charger.

And I let the phone die off, and I didn't power it up till this morning.

Now, this morning - when I turned the phone on and checked my OSmonitor. The mAh was at 1244.

Now, I'm not sure if it worked, but the battery is at 100% reading right now.

How do I drag out the data you guys need?