yashsingh1/xdaforums huggingface dataset:
[Nexus One Android Development] darb:
idk i ran my phone down to it shut off around 8 percent then kept turning it on letting it boot then die a couple times then plugged it on the charger but off. let it charge for a couple hours and so far im at 38 percent 12 hours later with moderate texting wifi bluetooth phone calls and internet browsing have to see were it dies out at.
[Nexus One Android Development] DarkDvr:
FroYo 83?

tencharacters
[Nexus One Android Development] darb:
im on cm 508 but phone was dieing at 10 percent consistently will report when it dies again
[Nexus One Android Development] RogerPodacter:
you are the same as me. my phone always dies at 8%, no matter what i do. rarely it has died at 10%, but it usually is 8%.
[Nexus One Android Development] lostsoul3471:
I miss my history bar out of the System Panel app. Still haven't hit that stable side to pony up the money for the app yet and the fact that froyo still has protected app issues on my iteration of it.

I can concur with Marine there that the last 10% will always take a good chunk longer than the 1st 90%. Just looking at a battery history graph (System Panel's--paid or Battery Graph) will show you the rounded arc on the charging stat. While off I can see that it may get you a slight boost, but does anyone know if the charging circuit is in the phone or the charger for this? That may be something to keep in mind to prevent fatal (battery and human/finger) overcharging. I would assume that there's a simple circuit in the phone itself that does it as there are too many micro USB charging adapters that work fine with any device.

Just a couple thoughts for the battery anal. :cool:
[Nexus One Android Development] Marine6680:
The charger is just a simple rectifier circuit, all the charging is handled by the device itself; if not how would your USB port know how to charge the battery.
[Nexus One Android Development] temasek:
Damn.....just check os monitor and found my max now is 1188 mAh. No way to push to near 1400 range? *sigh*
[Nexus One Android Development] mtw4991:
Roger, think you misunderstood...root explorer in the setreg file text editor works fine. Terminal emulator gave the read-only error, so without first mounting /sys as r/o instead of r/w, it throws the error. My point was that if I have to go into /sys first, I might as well use root explorer as it is much faster. Thanks for the help though!
[Nexus One Android Development] flak0:
Roger I attempted to make a loop script that I would run in terminal when the battery approaches 15% and show the output of the statusreg file. I am new to bash scripting I tried the below and it was epic fail . Can u help tweak, thanks again .
[Nexus One Android Development] RogerPodacter:
I'm not that good with scripts either lol. But it looks like the right idea, you may need to add in a slight delay, like a postdelayed(500) of half second. I forget what the shell equivalent of that is. Is that exclamation mark belong there in your if statemen? Seems like it would work,

If (status = status2)

//alert me somehow

And just add in a slight delay between iterations so it doesn't blow up:-)
[Nexus One Android Development] RogerPodacter:
Damn that's so weird I wish I could figure out why yours stops charging so low. Maybe post your dmesg log next time you do a full charge and see what's going on...
[Nexus One Android Development] difrnt:
Sure, send it through PM so no one tries it and potentially ruins their battery.
[Nexus One Android Development] flak0:
StausReg / Learn Mode Script

Hey everyone I managed to create a Script that polls every 2 seconds the statusreg file and outputs the contents until it becomes 0x71 at which learn mode has been entered. Please use this script when u are near 15% of battery left and just watch in termainal.

Make sure you rename this file to status.sh instead of status.txt and adb push or use root explorer or SUFBS to /system/xbin also make sure you CHMOD the file to 755. Assuming this script it may be easy to build an apk around this similar to Current widget. Please provide feedback. Thanks.

File Below.

Edit u can also add the script to gscript.

Bash Script for those who want to know or would like to learn. I am total newbie at this. Did some research and it worked.
[Nexus One Android Development] temasek:
Oops double post......deleted
[Nexus One Android Development] temasek:
Roger, pls advise.....

EDIT:- Roger, I edited the setreg file and inserted "0x14 80" and now my batt reading 100% ----> 82% and charging now. Is it normal?

EDIT: Roger, from 82% charged to 100% in less than 5 mins and now os monitor displaying 1441mAh.

I am confused. :confused:
[Nexus One Android Development] RogerPodacter:
Nice work that looks right. We've got an app prototype to detect learn mode but its not done yet. For some reason our nexus battery resets the age value sometimes, we don't know why. But anyone who does do a learn cycle just remember your new age value from the learn and manually set that age back if it should reset. Also I'm curious if anyone doing learn gets hit with the time out bug from the Google driver. I've seen it once in a while.

Remember once you see 0x71 plug in quickly and charge to full until the chgtf comes on. Then check your updated age and post results!
[Nexus One Android Development] RogerPodacter:
Ah there's your problem. Your age value is set to 82% which is why you only reach 1180mAh. Did you Set this or do a learn cycle before? Seems like you did a learn cycle which updated your age to 82%. My learn set my battery to 80% cause its lost So much capacity.

Yes if you reset your age manually to 100% then it bumps up your full charge number to 1440mAh. That may or may not be usable capacity depending on the actual capacity of your specific battery. That's what the learn cycle determines, so if you truly have already done learn and it updated you to 82%, then that's how old your battery is and maybe time for a new one depending on if you think so or not.
[Nexus One Android Development] temasek:
Ahh I see.

Yes I did a learned cycle and now I believed as what u said, a change in the age. I will monitor the actual results and many thanks for your time taken.

Appreciated :)

EDIT: Oh btw, will I have to perform a learn cycle after resetting the age back to 100? I hate to have my n1 auto shutdown around 10%.
[Nexus One Android Development] RogerPodacter:
No you don't have to do a learn cycle again as you now know your true age of your battery, 82% of a new battery. A learn cycle fixes people's battery who dies early like at 10%. So just manually set your age back to 82% and it will now go down to 0%. But the bad news is your battery only has 82% of a new battery.

Echo 0x14 6a > setreg - takes your age back to 82%.
[Nexus One Android Development] temasek:
Understand.

So its time to buy a new battery :)

Thanks again.
[Nexus One Android Development] flak0:
hmm earlier today I saw my batter go from 84% while chargin to 100%. My Statusreg shows 0x61 Roger not 0x71. Its charging now as we speak, I did lower the mA charge to pershoot values of 40. Also does the 84 --> 100 mean im at 84% whats wierd is setage shows 94%.... help lol.

edit should I

echo 0x14 6C > setreg to set to 84%?
[Nexus One Android Development] RogerPodacter:
Lol Ok a few things here. First you somehow lost learn mode as its showing 0x61 which is:

0110 0001 so you see the learn flag went back to zero. Sometimes that happens but I'd have to see a log to know why it failed. Have to give it another shot and pay attention to the status register periodically to make sure it stays in learn mode. When I've done my learn mode successfully, the status register started at 0x71, to 51 then 31 then 11 and finally finished at full charge. Notice all those numbers have bit 4 as a 1. 0x61 means it lost it, and I hope it wasn't because of a time out bug in the driver.

Your age got reset back to stock of 94%. It seems like your battery made the jump to 1000% around the same spot as the earlier guy's post, so you could try to manually set your age to That value if you want. But the learn will tell you the correct value for sure.

It's a tricky process which is why we need to automate all this stuff in an app that can track it all and visually display it to the user... :-)
[Nexus One Android Development] temasek:
What does 0x81 means in statsreg? Mine shows it
[Nexus One Android Development] RogerPodacter:
0x81 means charge termination flag is set, meaning you hit full charge and the status reg told the battery it was full and to stop charging.

0000 0001 - that last 1 is the charge flag and that binary is 81.
[Nexus One Android Development] temasek:
I am learning good stuffs. Thanks!
[Nexus One Android Development] RogerPodacter:
no prob. i made a minor type, the correct thing is 0x81 is

1000 0001 - which is full charge.

after you go below 90% it will change back to 0x01 which is 0000 0001.
[Nexus One Android Development] temasek:
Ah...I tot the numbers look weird. Thanks.
[Nexus One Android Development] flak0:
^where do you see this?

I am getting the time out bug alot. Every hour. When did this get introduced.
[Nexus One Android Development] RogerPodacter:
on page 25 of our data sheet, the status register is following:

ADDRESS 01h

BIT 7 - CHGTF

BIT 6 - AEF

BIT 5 - SEF

BIT 4 - LEARNF

BIT 3 - X

BIT 2 - UVF

BIT 1 - PORF

BIT 0 - X

so damn, you too see the timeout bug exactly every hour? me too. the bug has been there forever since the nexus was released. nobody ever paid attention before because it didnt matter. but it will absolutely ruin a learn cycle, because the charge temporarily turns off for a split second. **** when i did my tests on learn mode i set the timeout check in the driver to every 2 hours because it kept interferring with my learn cycle. i just assumed it was isolated to me, but i might have to fix the driver and increase the timeout check. the thing is it was a google bug, so i didnt exactly want to change their polling interval cause i didnt know what the result could be, and i just assumed it would be fine. my bad fellas..
[Nexus One Android Development] theloginwithnoname:
Not quite RP, my age resets when I do an off-charge - reboots etc are fine.

seems logical, you may have even hit learn when shutdown occurred!
[Nexus One Android Development] theloginwithnoname:
your statement in bold ;), though the % will vary depending on what your actual capacity is vs the max you achieve. Don't be surprised to get a learnt capacity of 1300mAh or less :eek: My last learn mode got me 1244 (~89% of new)...
[Nexus One Android Development] flak0:
Well I changed setreg to 0x14 6C since it seems I'm at 84% capacity and now the battery has sat at 100% for over an hour. Dumpreg below:
[Nexus One Android Development] theloginwithnoname:
I built one of these a few weeks ago.

a) 2 seconds isn't quick enough

b) I'm not sure the battery is polled that quickly unless you mod the kernel driver to poll quicker (which we've done), though RP found a register that was updated in "realtime" - RP, can you clarify this?

c) i tried using a script that polled every second and output the register until learn was hit. I went blind watching it and it still cut off before learn was hit, because learn normally activates on shutdown - i.e. at the point when screen writes a big "shutting down" over your terminal script ;)

nice idea though and I hope YMMV!
[Nexus One Android Development] theloginwithnoname:
apologies for lateness of my responses - I turned notifications off for this topic, will turn back on now... :rolleyes:
[Nexus One Android Development] flak0:
Hey can u help with my post above yours. Maybe poll every .5 seconds
[Nexus One Android Development] theloginwithnoname:
Just FYI everyone:

the tweaks to the kernel driver add several virtual files ("device attributes" as they are actually called).

each file can be read and/or written, and are created with a pseudo-call thus: create(<filename>, <initial permissions>, functionNameForRead, functionNameForWrite)

they are read by usual *nix file inputs - e.g. cat, type, more

they are written by usual piping - e.g. cat somefile > filename, echo somevalue > filename

if you are reading, the function functionNameForRead is called - in our case, it probes the battery values and sprintf's the output

if you are writing, functionNameForWrite is called, it parses the parameters, and updates the battery's register with the value

Once we're happy with the code and it's been tested properly, we'll release/publish as a git project.

HTH.
[Nexus One Android Development] RogerPodacter:
Yes we made additional changes to the way in which we poll the status register so that now it will update in real time. If I remember correctly when we were trying your script we were not reporting the status register correctly so that we would see shut down before the status reg changed. If you were to try your script again I think it should now work better. At least those were my findings... :-) so just poll our new statusreg file and it should be all good.
[Nexus One Android Development] RogerPodacter:
Yes because your mAh was high around 1400mAh and then you lowered your age it also lowered your full point. So it will take a while for your mAh to fall back down to below your newly lowered full point. But this will all correct itself on the next full charge.
[Nexus One Android Development] RogerPodacter:
Dude I'm really starting to think that these nexus batteries are just under powered from what they claim of 1400mAh. Either that, or they report full capacity as the total range from 3-4.2volts but then they set higher limits which doesn't take full advantage of all the capacity. Something like that must be going on...
[Nexus One Android Development] temasek:
I had fantastic battery life but at 15% it auto shutdown again :(

Then I plugged in and found my battery age changed from 100% to 94%.

I changed back to 100% and now trying out again.
[Nexus One Android Development] RogerPodacter:
Yeah our nexus battery has a glitch where the age resets itself so for now we will have to manually set our age till we get an app to memorize and set it for us.

Anyway I just tested setting my voltage to 3.0 and drained to empty. Now I'm doing a full charge to see if it gets any extra capacity. One thing is for sure, the voltage dropped so damn quick after 3.4volts that it only lasted a few minutes after that. So they obviously selected 3.4volts for a reason. Kinda sucks as I don't know how worth it it may be to lower it at this point...
[Nexus One Android Development] flak0:
Rodger my battery is currently at 6% while I write this. Setting age to 84% helped. I got 14 hours of use today. Now its 5% at 3.63v ... this is awesome , imma hit 0% lol.
[Nexus One Android Development] rootbox00:
I set my Battery to 100% but the the Battery drains very very fast til 93% after that the drain is slower.

Will it improve my Battery to set it to 84% and why?
[Nexus One Android Development] myakove:
This is what i get:

00: 0f 03 00 91 00 99 11 12 03 bd 23 80 5e c0 03 b7

10: 02 d1 77 30 79 78 7f fe 00 f4 00 08 ff ff ff 00

20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

60: 42 ff 0d 10 d2 06 af 0f 07 43 0d 9d 01 0e 0c 3a

70: 0a 0d 1d 1a 04 08 05 07 04 09 00 ea 1e 14 0a 1d

b0: 00 00

what should I do?
[Nexus One Android Development] RogerPodacter:
Deleted..........
[Nexus One Android Development] Booker-T:
This script doesn't work for me:(
[Nexus One Android Development] Booker-T:
Just several minutes ago, I tried to track whether my battery enter learn mode, and I modified the script by flak0 to track the statusreg.

I tried to open everything to drain the battery and let it goes to learn mode as fast as I can.

However, the phone just start to power off and the script didn't show the learn mode is started.

I wonder this is caused by the phone processing power.

I have a suggestion to track the learn mode but I don't know whether it works or not.

If we can control the phone not to charge when plugging the USB cable we can write a script on the computer and use the script to detect if the battery goes to learn mode. If it does, just set the phone to be charged with USB.

I think this is more do-able as we can just let the phone to plug with the USB and let the computer to wait for the flag of learn mode.
[Nexus One Android Development] myakove:
I'm also tried to track whether my battery enter learn mode with the script but no luck, it's always on 0x03
[Nexus One Android Development] RogerPodacter:
strange if you guys are not seeing the status flag flip. i wonder if the script is correct. one idea i have is sometimes i only had a few seconds from the time the status flag flipped till shut down happened, so i had to be quick. if you guys are using a 2 second or more poll, that might not be enough. i would try a half second to 1 full second. we are definitely working on automating this so its easier, but for now a script should do the trick.
[Nexus One Android Development] RogerPodacter:
that's pretty cool. wow 3.6 volts, that's still a lot of juice left i think, more than 5% maybe. yeah your age corrected your percent meter for sure;)
[Nexus One Android Development] myakove:
OK i'm going to try 0.5 second.
[Nexus One Android Development] RogerPodacter:
the other thing that helped me was also seeing the voltage as well so you can watch as it approaches 3.416v so you are ready for it. perhaps if you cat the getvoltage file at the same time. maybe cat the status reg every half second and cat the getvoltage file every second, should give you a good shot.
[Nexus One Android Development] myakove:
I just charge the batt and get this:

<6>[ 4405.529571] batt: 89%, 4162 mV, 21 mA (21 avg), 38.1 C, 1224 mAh

<6>[ 4455.633422] batt: 89%, 4162 mV, 20 mA (20 avg), 38.1 C, 1224 mAh

<6>[ 4505.740203] batt: 89%, 4162 mV, 20 mA (20 avg), 38.1 C, 1225 mAh

<6>[ 4567.041229] batt: 100%, 4162 mV, 19 mA (19 avg), 38.1 C, 1366 mAh

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

<6>[ 4617.146514] batt: 100%, 4157 mV, 0 mA (0 avg), 38.1 C, 1366 mAh

<6>[ 4667.248809] batt: 100%, 4157 mV, 0 mA (0 avg), 38.1 C, 1366 mAh

<6>[ 4720.005554] batt: 100%, 4157 mV, 0 mA (0 avg), 38.1 C, 1366 mAh

What I need to do?
[Nexus One Android Development] RogerPodacter:
so i'm assuming you charged that from completely empty, or it shut off and then you plugged in and charged to full? you see your mAh jumped from 1225 to 1366mAh. first that tells us that it looks like your age is set to stock value of 94%. and it also tells us the true capacity of your battery is only around 1225mAh. so if you were to perform an official learn cycle, it would determine your new age to line up right around the 1225mAh mark. as a manual work around you can try to "guess" or calculate your age that corresponds to a 1225mAh capacity, which is probably in the mid 80's like around 87% or so.

here's how are battery percent is calculated, from the data sheet:

[%] = 100% * (CurrentReading - Empty * FULL40) /

{(

AGE

* FULL - Empty) * FULL40}

so setting your age to 100% gives the maximum possible range for the battery. but since our batteries have aged, a lower age lowers the full point mAh reading. so your correct full point is 1225mAh, but your age value is not set to match that, so when the battery hits full charge, it jumps up to the higher value based on your higher age value. so to line everything up you'd need to set your correct age value, and then the range will not jump like that, and it wont die early either. of course an official learn cycle would do this, but you can lower your age manually to immitate if you want in the mean time till we get the learn cycle working better. so bad news is your batt seems to only hold 1225mAh capacity. but the manufacturer rated capacity for these batteries is 1452mAh.
[Nexus One Android Development] samarium:
I'm not sure how useful that will be since on page 26 of the datasheet under the RESULT REGISTERS heading, it says "The DS2784 processes measurement and cell characteristics on a 3.5s interval and yields seven result registers." so it seems like our maximum poll interval should be about 4seconds.
[Nexus One Android Development] samarium:
I'm using wildmonks 111110b kernel.

I have a cheap "2700mAh" extended battery with an extended cover, however dumpreg shows it to look like a standard battery. I get shutdown at about 3800mV when capacity drops to 0mAh.

This seems similar to the previously documented "2400mAh" battery.

So it seems to me that I want to increase VAE so I can trigger learning.

dumpreg:00: 4f 07 02 b6 02 c0 52 52 fe ef 1d 40 68 20 fb f9
dumpreg:10: 0d 88 63 a0 00 78 7f 9e 01 f6 00 7a 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 0d 11 d2 18 af 0f 07 43 0d 9d 01 0d 0c 3a
dumpreg:70: 0a 0d 1d 19 04 07 04 06 04 0a 00 ed 1e 14 0a 1d
dumpreg:b0: 00 00
getFull40:Full40: 1452 mAh
getavgcurrent:-28542
getcurrent:-73767
getmAh:1110400
getvoltage:4074924
modalias:platform:ds2784-battery
setAEvolt:AEvolt: 3416
setage:Battery's age: 0
statusreg:0x07
[Nexus One Android Development] RogerPodacter:
Ok first you have the same problem as the other guys, your 2700 battery is programmed wrong. Your full 40 Value is set to that of a stock battery which means you only get the same capacity as a stock battery, which is why you shut down at 3.8volts when you run out of mAh. This is the third extended battery we've seen like this.

As soon as we raised the full 40 value the other guys got the full range of their battery. Send me a message and I can help you, or I'll post later. Insane they are selling like this.
[Nexus One Android Development] jlevy73:
Hmm, this is quite a complex thread for some reason I never bothered reading through. Wow was I missing out on some good stuff. So I think I set everything up correctly, turned the power off and charged to completion. At that point my battery read 1410 mAh. I wonder if I squeezed out that extra 42 mAh whether I would see much of a discernable difference.
[Nexus One Android Development] mtw4991:
damn...been plugged into the usb for a couple of hours, phone on/screen off...just hit 1504mAh at 4172mV. Never been that high before???

EDIT: just went to 1507 mAh as I was typing...
[Nexus One Android Development] jlevy73:
Is 1504 possible considering the limit of this battery is around 1430-1450?
[Nexus One Android Development] RogerPodacter:
Good eye and I would agree with you, but somehow the status register seems to not obey this.

So as a verification I just used the prototype app to hit learn mode and I easily activated it. So its working as should. My status register hit 0x71, then at 5% it changed to 0x31 cause the empty flag turned off, then it changed to 0x11 cause the standby flag went off. Let me see if I can post these screen shots using my phone.

Damn I can't attach from phone and our internet is down. Our app is almost done I hope!
[Nexus One Android Development] mtw4991:
1508 now...run, it's gonna blow up:eek: I routinely get it to around 1445-1450, but never this high.

Damn...1510 now at 4182 mV!

EDIT: 1512mAh at 4182mV....RP, what do you think of this sh!t???

EDIT2: Just hit full charge and dropped back to 1438 mAh??? don't know wtf is going on, lol!
[Nexus One Android Development] RogerPodacter:
ok here are the screens i hit learn mode, so what you guys should expect to see from the status register.

0x71 -> 0x31 -> 0x11 -> and then done at full charge.
[Nexus One Android Development] RogerPodacter:
well you are not gonna blow up, so dont worry about that. first of all you set your current to <20mA from earlier in this thread, correct? that squeezes some extra juice out of the top end, so you typically see voltage at around 4.187 rather than 4.15 like normal. its nothing to worry about, you're just getting some extra capacity. HOWEVER, sometimes the mAh falls out of alignment and reads slightly higher, and when you either hit full charge or drain to AEvolt empty of 3.416, it re-aligns itself. hard to explain, but you'd have to read the data sheet to see what i mean. i wouldnt worry and you likely will see it correct itself on the next charge.

it looks like you set your age to 100% which is fine and that is why youre reading up in the 1400's for mAh readings. no worries!:D