yashsingh1/xdaforums huggingface dataset:
[Nexus One Android Development] temasek:
Though I watched the whole learn cycle earlier, I am still doubtful cuz its cheap battery. Will verify the battery by tomorrow.

Anyway the battery from ebay.

http://cgi.ebay.com.sg/ws/eBayISAPI.dll?ViewItem&item=220674648122&ssPageName=STRK:MEWNX:IT
[Nexus One Android Development] temasek:
Damn didn't realize something not right on the last cycle.

The flags UVF and PORF are still lighted and my battery status register is 0x87. That doesn't sound good right?
[Nexus One Android Development] myakove:
Same here those flags always on with my new 1600 battery
[Nexus One Android Development] RogerPodacter:
I don't think its a bad thing when those extra bits are on in the status register. I'm not sure when and why they come on, but I don't think it matters. I've obviously read what they mean from the data sheet. But why do some see them and others dont?
[Nexus One Android Development] mtw4991:
did another successful full learn cycle today. set full40 to 1558 instead of 1452 to see if I would get more top end capacity but only got 1252mV as opposed to the 1244mV from yesterday and it reset at 81% which is the same as 86%@1452, so meh, guess it doesn't really matter. But here is a question:

If I now turn off the phone and do a bump charge, then turn it on, will it remain at 86% or will it reset at 94%. Just curious.
[Nexus One Android Development] temasek:
The battery % drops fast. Hopefully because its new.
[Nexus One Android Development] mtw4991:
OP update with simple step by step instructions to assure Learn is hit every time;)

http://xdaforums.com/showpost.php?p=9583271&postcount=340
[Nexus One Android Development] jlevy73:
Thanks my friend, I will give this a go later tonight. The lazier option #1 in the OP didn't do a darn thing.
[Nexus One Android Development] temasek:
Wow u kinda becoming expert in this. Cheers. :)
[Nexus One Android Development] mtw4991:
Option #1 is hit or miss...mostly miss, lol

Expert??? not me, lol. expert=failx20, then learns:p I couldn't code my way out of diapers, much less into a battery, but I can read:eek:
[Nexus One Android Development] temasek:
U are a funny guy.
[Nexus One Android Development] chowlala:
Haha. Fix #1 works mostly I think if we don't mess around with the register. I noticed this with new users calibrating vs is who thrash the battery mad. Lol.

We should keep a set of register values that are absolutely default for backup purposes. Just so that we can run some tests and use it for control.
[Nexus One Android Development] mtw4991:
Chow, I think new users are seeing the jump point and assuming learn was hit. I only hit iut once out of 20-30 times fwiw.
[Nexus One Android Development] apratomo:
I just successfully hit learn mode using your method, thank you sir!

But kind a disappointed knowing my battery is at 89% age hehe.

Strange condition tough, after calibration my battery only charged to 99% but register said 0x83
[Nexus One Android Development] pwig:
I wanted to say that the newest version of the app got me successfully into learn mode.

I walked away from my phone and it was around 18%. When I came back and checked it, it was off. So I plugged it in, rebooted it and went to the battery app. I unplugged the phone and waited for the flag. I turn the phone on full brightness and it easily stayed above 200ma of draw.

The sound and pop up alerted me and I plugged in the charger. I left it overnight and the rebooted in the morning. My age is now at 86% which sounds right because it died around 8 or 10% before. It had previously been set at the stock 94%.

Once this is successful is there anything I need to do? How long will this stick?
[Nexus One Android Development] RogerPodacter:
basically that's it. once in a while the age will reset itself so now that you know your proper age, just manually set it back to 86% when needed. eventually we will have the app remember your age value and set it automatically...maybe in version 2.
[Nexus One Android Development] mtw4991:
Roger, what the heck is this 0x83 that some people are getting upon learn? Aftermarket equivalent of 0x81??? idk but a couple of guys are asking.
[Nexus One Android Development] temasek:
Anyone knows battery status 0x87 means? Roger?
[Nexus One Android Development] RogerPodacter:
0x83 just means that your power on reset flag is on. It's the second bit in the status register and we don't really know when and why it turns on but it doesn't effect anything or learn mode.

0x87 means that both power reset and under volt flags are set. Again we don't know why, but they don't seem to make a difference. The data sheet explains those bits, but doesn't really say when they come on. You should be seeing those flags lit up in the app with 0x83 or 0x87.
[Nexus One Android Development] temasek:
Thanks Roger!
[Nexus One Android Development] jlevy73:
I cannot seem to find the battery app. Would someone be kind enough to post the link. Thanks.
[Nexus One Android Development] apratomo:
+1, where can I get the latest apps?
[Nexus One Android Development] apratomo:
w00t finally I just hit learn mode last night, it seems success using mtw4991 method. But then disappointed to see that my battery is at 89% age :D

Strangely after full charge over night it only shows 99% full and battery status register 0x83.

Anyway if I'm going to order higher capacity battery will this

http://www.htcrepairparts.com/standard-battery-for-htc-desire1600mah-p-3007.html

works wonderful?
[Nexus One Android Development] jlevy73:
Where did you find the battery app?
[Nexus One Android Development] apratomo:
using the old one, still not find the latest yet
[Nexus One Android Development] jlevy73:
Lol, I'll take the one. Couldn't find that one either. If you have a link would be much appreciated
[Nexus One Android Development] apratomo:
I only found this http://jonrichards.net/xda/BatteryApp20101202.zip

I think this is what I use, not sure though LOL

maybe OP of battery calibration tool could put this up front and update regularly
[Nexus One Android Development] theloginwithnoname:
See first post, it has links to the register details - simply, if it starts with 0x8 it's fully charged, if it starts 0x7 it's in learn mode.

the 2nd digit is related to the lower register (not used in learning or full), again see datasheet for more info.
[Nexus One Android Development] theloginwithnoname:
It's changing fairly quickly at present, and is not far off being available from the market (when ready for full public consumption), but if Jon turns on directory browsing, or makes a "perma" link to always point to the latest version, I'll stick that up.
[Nexus One Android Development] jlevy73:
So for those trying to calibrate their battery, what is the best application to use? Is the one posted in the previous post the only one publicly available?
[Nexus One Android Development] temasek:
Omg......

My 1600mAh battery 2nd learn cycle at full40 2600mAh........

To be continue .............

Edit: My earlier learning cycle., at 99% the capacity was actually 2475mAh before settled at 1617mAh due to my full40 set at 1650mAh. I am currious why the capacity goes so high. So here goes my 2nd cycle tonight at full40 2600mAh. Will report my progress.

Results:

Changed full40 to 2500

After learn cycle and rebooted

Age 100

Capacity 2452mAh

Ho ho ho.....Merry Christmas!!!
[Nexus One Android Development] mtw4991:
Here is the latest 1203 battery app:

http://db.tt/x24GWOy
[Nexus One Android Development] RogerPodacter:
I'm not following. So your 1600 battery has what final full40 value? How could it be that high?
[Nexus One Android Development] jlevy73:
Unfortunately, the page does not open. Thanks though!
[Nexus One Android Development] temasek:
I have no idea. My full40 now is 2500mAh with a full charge capacity of 2452mAh and age 100.

Will monitor the battery usage today.
[Nexus One Android Development] RogerPodacter:
But isn't that impossible? Are you sure that you didn't just have a really big jump from 16xx to 2500 and similarly it will die very early like 45%?
[Nexus One Android Development] temasek:
No. I glued my face to the charging process from 0mAh to full capacity.

I kept bumping more mAh to drop my voltage to 3201mV earlier before I hit learn cycle.

Edit: I think this is unreal too. Suspect this battery is fake.

Edit: but it not die early, that's the funny part
[Nexus One Android Development] mtw4991:
http://jonrichards.net/xda/battery_calibrator/
[Nexus One Android Development] makelegs:
Hey....is that a newer version? I think I have 0.8.5 right now.
[Nexus One Android Development] mtw4991:
I think 0.8.5 is the newest so far.
[Nexus One Android Development] RogerPodacter:
we're still testing 0.8.6 but trying to get it out soon as possible. we hit a few snags but think we got it sorted!
[Nexus One Android Development] RogerPodacter:
i would just count the actual mAh that you go thru, that can't be faked. So if you start at 2500 and make it down to 500, you burned thru 2000mAh of usable capacity. i thought you bought a 1600 battery though!!?
[Nexus One Android Development] temasek:
Yes thats a 1600mAh battery. But surprisingly the voltage is dropping at much lower pace. Is it because if the UVF flag?
[Nexus One Android Development] RogerPodacter:
No that shouldn't slow your voltage. The data sheet says that flag just allows under volt readings to occur. Not really sure what that means.

I'm about to order a 1600 battery. I checked your ebay link for 9bucks. And I also see the 20dollar one on HTCrepair site. Think I'm gonna go for the second one, but are they exactly the same?
[Nexus One Android Development] temasek:
Both looked exactly the same to me.
[Nexus One Android Development] RogerPodacter:
Well I ordered the second one. Let's hope its a good one and I don't get ripped off...it was 20bucks from HTCrepairparts and I got a certificate pop up saying they weren't a trusted site. And I went thru with it anyway lol. The site looks completely legit for HTC stuff. We'll see...
[Nexus One Android Development] temasek:
Pls post results when u get it. I am curious too............
[Nexus One Android Development] live_0978:
Any of these battery calibration apps working on HTC desire? Am running RCMixHD v0.13 ROM.
[Nexus One Android Development] dvgrhl:
No, you need a kernel with a modified driver like we now have for the N1. I think the Desire might use the same battery driver so it should be possible (I think), but someone with a Desire would have to take the initiative. If they did, in theory the app would work.
[Nexus One Android Development] lojden:
I've tried to hit learn mode for a long time now but my phone always die at ~3670mV/~9mAh...

Empty volt: 3201

Full40: 1665

Chg Current: 20
[Nexus One Android Development] temasek:
Use bumping method, ie artificially changing your mAh so that u can drain down your voltage to your empty voltage point.

0x10 01 (mAh 100)

0x10 02 (mAh 200)

Etc

Keep bumping up your mAh till you can hit your empty voltage level.

Good luck.
[Nexus One Android Development] lojden:
Alright, think i made it. AEF,SEF,LEARNF,UVF and PORF flag is on.

Thanks :D
[Nexus One Android Development] chowlala:
Actually guys,

I still think LEARN mode can be hit with the phone off. Because when the flag trips and the phone shuts down, it should shut down with the flag on.

Otherwise, how would we have initially triggered the flag and gotten manual learns in the first place very early on? Kinda odd that we can't get the learn flag to stay on now with the phone shut down.

Any thoughts on this?
[Nexus One Android Development] mtw4991:
I'm not sure about this, but it seems that when the phone shuts itself down the learn flag is retained just like it does on booting into recovery, flashing roms/kernels, rebooting, soft reboots, freezes, etc. However, when I manually shut down the phone the learn was lost and upon full charge and reboot, it had reset to 94% indicating that learn failed. idk enough about this to speak with any authority, just my observations...fyi, I tried it twice and it failed both times.
[Nexus One Android Development] chowlala:
Ah. So the if we manually shut down the phone, the flag gets cancelled because something is tripping it to go off.

But if it shuts down on its own, because it ran outta mAh or volts, then the flag is retained eh.

I wonder what's causing the flag to turn off on manual shut down. S
[Nexus One Android Development] mtw4991:
Like I said, idk..just my observations. Roger or Login are the ones to look into this question.
[Nexus One Android Development] theloginwithnoname:
we know a power-on can reset registers. perhaps a 'user' shutdown shuts devices down a different way, or that the battery resets when told to shutdown by host but not when battery tells host to shut down?

a way of forcing battery-induced shutdown (and therefore keep learn bit) could be to adjust volt/charge from app?

sent via XDA app
[Nexus One Android Development] chowlala:
It was all suddenly making more sense. But then...

Assuming the device is default without the Battery Calibrator...

First of all, something is preventing a LEARN flag from turning on.

Second, there's stuff that's tripping the flag OFF when the LEARN flag is on.

Third, there's something that's preventing the phone from remembering the SET AGE.

Can we begin to isolate these problems? Did I miss out any more?

I think if we can isolate out enough factors, we can then get the Calibrator to deal with them accordingly.
[Nexus One Android Development] RogerPodacter:
i still dont fully understand what happens when shut down occurs. but i remember way back when we first started this, i must have tried a million times and finally that ONE time i got it to boot up after shut down with the learn flag still set. could never reproduce that again. however the AEF and SEF would still be set after shut down, showing 0x61 all the time. so i'd say its definitely possible to retain status flags during shut down.
[Nexus One Android Development] RogerPodacter:
i wonder why your mAh ran out so early in the first place. what size batt do you have?
[Nexus One Android Development] chowlala:
Yes. There must be a way for us to be able to set the conditions right for the N1 to retain the LEARN flags when it shuts off.

So far, the only condition we know is the voltage. Which triggers LEARN to activate.

And then there's the mAh charge which can trigger LEARN to turn off either by dropping charge or reaching max capacity.

I wonder if there's any way to manually activate the flags by emulating the trigger events instead.
[Nexus One Android Development] chowlala:
Haha. Hey guys! Look, you made it into the CM changelog!!

N1: Enhanced battery driver – Roger Podacter, theloginwithnoname

Congrats again! =D
[Nexus One Android Development] RogerPodacter:
emulate the events? i dunno...someone try writing a 1 to the learn flag in the status register. or maybe try writing to the voltage register and write the empty volt value and see if that tricks it lmao. doubtful those would work hah...
[Nexus One Android Development] theloginwithnoname:
been there a while buddy ;)

sent via XDA app
[Nexus One Android Development] theloginwithnoname:
we tried the write-to-learn-flag trick a while ago, remember?! it gets reset every bat poll...

sent via XDA app
[Nexus One Android Development] chowlala:
I thought bout it.

Either we flag 1 for LEARN.

Or we could flag the empty volt to trip LEARN, then quickly adjust the voltage back down. =P
[Nexus One Android Development] RogerPodacter:
I've done the last one many times testing the first version of the app. I set empty volt to like 3.9 just for testing functionality. The problem with that is when you trip the learn flag to start the cycle, you're at such a high voltage that your learn cycle will only get like 500mAh, and think your age is like 35% lol...
[Nexus One Android Development] chowlala:
Yeah. I figured that wouldn't work out already.

Damn. So close to perfecting this.

Guess the only way right now is to play around at the bottom end instead of at the top obviously.

Can't even dump the battery charge. That would probably be bad, very, very bad anyways. Haha.

Ok, let's see, how does the phone maintain the LEARN flag then? What are the conditions to maintain it once it's tripped?
[Nexus One Android Development] RogerPodacter:
yeah i think that is somewhat of a mystery as to what keeps the learn flag on. we know the data sheet says it turns on and then charges till CHGTF comes on indicating full charge which means the learn cycle was complete and updates the age. but i dont know that it talks about what actually keeps it on during the actual cycle. it may be nothing but CHGTF.

it could be that our current is dropping below 0 and going negative. once in a rare while i am charging and i see my current go negative even though its still plugged in charging. say a very high load is placed on the phone and it needs to pull juice from the battery AND charger. maybe that is what tripping the learn flag off...?
[Nexus One Android Development] chowlala:
Ok, so one thing for certain is that the current trips the flag OFF. So maybe we should dig around to find a way to "trick" the phone into thinking that the current is stable at X?

That way we won't ever have to worry about the flag tripping off. Though it will probably be problematic with the actual battery charging, values, numbers, etc.
[Nexus One Android Development] temasek:
My 3rd learn cycle for my new battery, I experiment by using the phone during LEARNF up. I did usual surfing of webs, replying emails, that's all. In no situation the LEARNF flag got tripped. In the end I saw the LEARNF flag turned off when it hit 100% battery.

Fyi
[Nexus One Android Development] RogerPodacter:
Nice that's good to know. Technically there's no reason why you couldn't use the phone during a learn. But since it seems so touchy I wouldn't risk it. The thing I think could most ruin a learn is a very high but short spike in current draw.!
[Nexus One Android Development] chowlala:
Like I mentioned in the other thread. I have a feeling our kernels are giving a us the problem.

Our kernels are overclocked and hence require more draw power. By using ondemand, each time we screen on, it causes the processor to jump to the top 1gHz limit which also causes a sharp spike in power draw. Something like from 975mV to 1225mV. Hence, the huge power jump causes us to go into negative current, booting the learn flag.

We need to try using stock mV values or pure static draw across the processor speeds. Or something that doesn't cause the spike in power.

I've been testing setcpu at 576 mHz max. So far, its been flawless with the learn mode. Though I haven't tried turning the phone on at the top end yet. I was asleep. Haha. :)
[Nexus One Android Development] dvgrhl:
That's a really good point. Really good. I think we need to add to the instructions to at a minimum disable any overclocking. And if you want to be safer, you can underclock, though 576 may be a bit too underclocked chowlala. :)
[Nexus One Android Development] temasek:
My latest cycle I changed to full40 2600mAh and charged to capacity 2550mAh. Woohoo! An increase of 100mAh. Yay! More experiment to come ......
[Nexus One Android Development] mtw4991:
I will update the instructions tomorrow to reflect recent observations
[Nexus One Android Development] chowlala:
Haha. Yeah, I agree.

Was just being a little overly cautious.

If you need, here's the link to WildMonk's kernel voltage table.

> http://wildmonks.whoisthedrizzle.com/kernel/2.6.35/Voltage_table.txt
[Nexus One Android Development] theloginwithnoname:
I remain unconvinced by this theory but am happy to be proved wrong! Once you've done it a couple of times, remove the restriction but don't change anything else on your phone, and see what happens in learn?

Easiest way for people to achieve this is probably set a SetCPU profile for charging, with min and max the same value.
[Nexus One Android Development] chowlala:
Haha, yeah, it's really a shot in the dark. But I have no idea what else would be causing a negative drain except something that needs the battery, which would be the processor.

Maybe we should try with someone running min:245, max:245 vs someone with min/max: maxed.
[Nexus One Android Development] mtw4991:
I'll be doing another cycle later this morning. Going to use the 1203 app and set charging profile to 245/245.
[Nexus One Android Development] __max__:
Finally did it!

Last app version helped very much... thanks!!!

I hit the learn flag 2 times before but lost it at 84/88% now the reason it's clear.

This time i hit the learn flag yesterday night and left the phone charging all night, this morning shut the phone off and on (not reboot) and now the age is set at 90%.

It seems correct.

I'll go through another learn cycle this night, just to see if anything changes :)
[Nexus One Android Development] RogerPodacter:
do you think you could post your dumpreg of your new 1600 battery? i was curious about checking a few values for comparison. mainly i wanted to see the current offset register just to see what it was set at etc.
[Nexus One Android Development] myplague:
Is there any advantage in changing the full40 on a stock battery to something larger than 1452 and if so what is a good amount to use?
[Nexus One Android Development] temasek:
will do but after next cycle cuz I failed when too ambitious and changed the full40 to 3000mAh. The battery cannot last that long. Lol.....

I am waiting to start learn cycle again. Back to 2500mAh
[Nexus One Android Development] mtw4991:
Temasek, which app are you using 1203 v0.8.5 or 1205 v0.8.7?
[Nexus One Android Development] mtw4991:
No real advantage...
[Nexus One Android Development] temasek:
I am practically doing learn cycle daily. Lol experimenting.

I am using both, alternating. Tried full40 at 3000mAh failed. Waiting to drain and perform learn cycle using 1203 app with full40 back to 2500mAh.

A 1600mAh can only stretch that far, 3000 is just a dream. Lol. The other user with 2400mAh got himself full40 3000mAh.
[Nexus One Android Development] temasek:
00: 45 87 05 f8 06 15 64 64 ff fd 21 80 6a c0 ff fd

10: 17 61 35 e0 80 80 7f c0 03 60 00 d0 ff ff ff 00

20: fc 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

60: 42 ff 0d 14 d2 06 a4 0f 07 43 17 70 04 00 00 00

70: 28 00 00 00 0d 00 00 00 04 09 00 ea 1e 14 0a 1f

b0: 00 00
[Nexus One Android Development] somline:
I just want to congrat you all for getting the calibration done. Good work.

Didn't follow the whole thread. So you patched the kernel?

And got getreg and setreg.

BTW: LERNF is read only.
[Nexus One Android Development] chowlala:
So. I was just thinking.

LEARN flag trips when it hits a certain voltage.

Battery runs off a "voltage meter" register.

Both currently are the same "file".

If we could get the battery to read of another "voltage meter" register, would it be possible for us then to fake the empty voltage to turn on LEARN flag?
[Nexus One Android Development] RogerPodacter:
maybe but i think that we dont have control of telling the battery chip from where to take its volt readings. my hunch is that is hard coded into the DS2784 chip to read from its voltage register location, and this is not accessable to us to change. the closest i could see is writing a fake voltage reading TO the actual voltage register to trick AEvolt. but in reality i know that probably wouldnt do anything. (and besides we didnt make the voltage register writeable in the ds2784 driver patch)