Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Update to the AJRv1 recharging

Update to the AJRv1 recharging

From: Jerry Van Baren <gerald.vanbaren_at_smiths-aerospace.com>
Date: 2005-02-16

FYI, I've uploaded a New Improved patch which is a substantial reworking
of the powermgmt.c (AJRv1 battery charging) routine. This is not fully
tested but is working well for me so far. I've posted the patch update
to show progress :-).

Patch information:
http://sourceforge.net/tracker/index.php?func=detail&atid=439120&group_id=44306&aid=1116884

I need to test my changes under other conditions like:
* USB plugged in and active
* Batteries already fully charged
* Batteries nearly fully charged
* Higher capacity batteries

Other issues:

I've been ignoring the battery level estimate. It behaves somewhat
oddly in my limited testing in that it starts at one level (11% in the
attached run), drops fairly precipitously (to 6% over 5 minutes) even
though the battery voltage is rising, and then rises to 100% rapidly at
the end of the charge. This is due to how the estimate is filtered -- I
want to look at the filtering and hopefully make it more accurate (at
least more linear :-). I claim I'm filtering the raw battery voltage
better -- perhaps that is filtered sufficiently for a more accurate
battery level estimate without doing additional level filtering. Things
to try...

I've attached an augmented CSV (comma separated variables - spreadsheet)
of a recharge run. For debugging, I'm logging some of the variables
once per minute in a CSV file.

* The avgbat is a unscaled exponentially filtered battery voltage - I
created another column for the properly scaled battery voltage.

* The other two added columns are the 50 minute long term voltage delta
(which is what has been terminating the charge in my limited test
cycles) and the 6 minute short term voltage delta.

* The avgchg variable is related to the the voltage across the charge
current source diode. This is not looking all that helpful. It will
likely disappear tonight :-). The constant voltage charge technique
that the original code uses appears to work well.

gvb

"chgtime"," avgbat"," avgchg"," battery_level_cached"," charger_inserted"," charge_state"," trickle_sec","Battery","Long term","Short term"
1,24977,14879,11,1,1,60,5.04613453125,,
1,25147,14934,10,1,1,60,5.08047984375,,
1,25283,14995,9,1,1,60,5.10795609375,,
1,25447,15060,8,1,1,60,5.14108921875,,
1,25529,15107,7,1,1,60,5.15765578125,,5.15765578125
1,25634,15136,6,1,1,60,5.1788690625,,0.13273453125
1,25730,15173,6,1,1,60,5.1982640625,,0.117784218750001
1,25803,15229,6,1,1,60,5.21301234375,,0.10505625
1,25863,15260,6,1,1,60,5.22513421875,,0.0840449999999997
1,25946,15285,6,1,1,60,5.2419028125,,0.0842470312499994
1,26005,15302,7,1,1,60,5.25382265625,,0.0749535937500001
1,26048,15352,7,1,1,60,5.26251,,0.0642459375
1,26112,15358,7,1,1,60,5.27544,,0.0624276562500006
1,26150,15389,7,1,1,60,5.2831171875,,0.0579829687500002
1,26208,15410,7,1,1,60,5.294835,,0.0529321874999997
1,26209,15427,7,1,1,60,5.29503703125,,0.041214375
1,26237,15429,7,1,1,60,5.30069390625,,0.0381839062499996
1,26313,15455,8,1,1,60,5.31604828125,,0.0406082812499999
1,26351,15473,8,1,1,60,5.32372546875,,0.0406082812499999
1,26302,15482,7,1,1,60,5.3138259375,,0.0189909375000008
1,26402,15505,8,1,1,60,5.3340290625,,0.0389920312499994
1,26418,15509,8,1,1,60,5.3372615625,,0.0365676562499999
1,26410,15549,8,1,1,60,5.3356453125,,0.01959703125
1,26432,15556,8,1,1,60,5.34009,,0.0163645312499998
1,26483,15550,8,1,1,60,5.35039359375,,0.0365676562499999
1,26496,15565,8,1,1,60,5.35302,,0.0189909375000008
1,26572,15578,8,1,1,60,5.368374375,,0.0311128125
1,26560,15585,8,1,1,60,5.36595,,0.0303046875000001
1,26615,15587,8,1,1,60,5.37706171875,,0.0369717187500003
1,26634,15613,8,1,1,60,5.3809003125,,0.0305067187499999
1,26678,15630,9,1,1,60,5.3897896875,,0.0367696874999996
1,26690,15645,9,1,1,60,5.3922140625,,0.0238396875000006
1,26718,15659,9,1,1,60,5.3978709375,,0.0319209374999998
1,26749,15664,9,1,1,60,5.40413390625,,0.0270721875
1,26787,15675,9,1,1,60,5.41181109375,,0.0309107812500002
1,26788,15676,9,1,1,60,5.412013125,,0.0222234375000001
1,26815,15698,9,1,1,60,5.41746796875,,0.0252539062499997
1,26843,15710,9,1,1,60,5.42312484375,,0.0252539062499997
1,26866,15712,9,1,1,60,5.4277715625,,0.02363765625
1,26877,15717,9,1,1,60,5.42999390625,,0.0181828124999992
1,26912,15712,9,1,1,60,5.437065,,0.0250518749999999
1,26915,15745,9,1,1,60,5.43767109375,,0.0202031250000001
1,26939,15744,9,1,1,60,5.44251984375,,0.0193950000000003
1,26946,15740,10,1,1,60,5.4439340625,,0.0161625000000001
1,26983,15740,10,1,1,60,5.45140921875,,0.0214153125000003
1,26981,15760,10,1,1,60,5.45100515625,,0.0139401562500003
1,27008,15771,11,1,1,60,5.45646,,0.0187889062500002
1,27046,15772,12,1,1,60,5.4641371875,,0.02161734375
1,27056,15780,12,1,1,60,5.4661575,,0.0222234375000001
1,27076,15798,12,1,1,60,5.470198125,5.470198125,0.0187889062500002
1,27080,15807,12,1,1,60,5.47100625,0.42487171875,0.0200010937499995
1,27111,15806,14,1,1,60,5.47726921875,0.396789375,0.0208092187499993
1,27117,15810,14,1,1,60,5.47848140625,0.3705253125,0.0143442187499998
1,27140,15816,15,1,1,60,5.483128125,0.34203890625,0.0169706249999999
1,27155,15838,15,1,1,60,5.48615859375,0.3285028125,0.0159604687500003
1,27199,15846,15,1,1,60,5.49504796875,0.31617890625,0.0240417187500004
1,27193,15855,15,1,1,60,5.49383578125,0.29557171875,0.0165665625000004
1,27220,15849,17,1,1,60,5.499290625,0.28627828125,0.0208092187500002
1,27233,15875,18,1,1,60,5.50191703125,0.2767828125,0.0187889062500002
1,27240,15877,18,1,1,60,5.50333125,0.2614284375,0.0171726562499996
1,27232,15880,18,1,1,60,5.501715,0.24789234375,0.00666703125000012
1,27299,15909,20,1,1,60,5.51525109375,0.25274109375,0.0214153125000003
1,27328,15908,22,1,1,60,5.52111,0.24567,0.0218193749999998
1,27331,15901,22,1,1,60,5.52171609375,0.23859890625,0.0197990624999997
1,27359,15908,22,1,1,60,5.52737296875,0.23253796875,0.0240417187499995
1,27370,15930,22,1,1,60,5.5295953125,0.23455828125,0.0278803124999998
1,27393,15937,24,1,1,60,5.53424203125,0.233548125,0.0189909374999999
1,27395,15956,24,1,1,60,5.53464609375,0.2185978125,0.01353609375
1,27427,15950,26,1,1,60,5.54111109375,0.217385625,0.0193950000000003
1,27453,15968,26,1,1,60,5.54636390625,0.23253796875,0.0189909375000008
1,27458,15965,26,1,1,60,5.5473740625,0.213345,0.0177787499999997
1,27479,15996,26,1,1,60,5.55161671875,0.21435515625,0.0173746874999994
1,27494,15989,28,1,1,60,5.5546471875,0.219001875,0.0200010937500004
1,27520,15997,28,1,1,60,5.5599,0.219810000000001,0.0187889062500002
1,27553,16001,30,1,1,60,5.56656703125,0.216173437499999,0.0202031249999992
1,27553,16004,30,1,1,60,5.56656703125,0.213547031249999,0.0191929687499997
1,27581,16035,30,1,1,60,5.57222390625,0.20384953125,0.0206071875000005
1,27592,16046,32,1,1,60,5.57444625,0.20849625,0.0197990624999997
1,27623,16032,32,1,1,60,5.58070921875,0.2036475,0.0208092187499993
1,27647,16053,32,1,1,60,5.58555796875,0.20465765625,0.0189909375000008
1,27660,16038,34,1,1,60,5.588184375,0.1983946875,0.02161734375
1,27680,16063,36,1,1,60,5.592225,0.200010937499999,0.0200010937499995
1,27696,16068,36,1,1,60,5.5954575,0.1975865625,0.0210112499999999
1,27719,16093,36,1,1,60,5.60010421875,0.1959703125,0.0193950000000003
1,27741,16099,36,1,1,60,5.60454890625,0.1927378125,0.0189909374999999
1,27758,16101,38,1,1,60,5.6079834375,0.1959703125,0.0197990625000006
1,27783,16124,40,1,1,60,5.61303421875,0.19556625,0.0208092187500002
1,27804,16122,40,1,1,60,5.617276875,0.19415203125,0.0218193749999998
1,27820,16138,40,1,1,60,5.620509375,0.1927378125,0.0204051562499998
1,27830,16133,40,1,1,60,5.6225296875,0.19253578125,0.0179807812499995
1,27908,16130,46,1,1,60,5.638288125,0.201223125,0.0303046875000001
1,27905,16160,46,1,1,60,5.63768203125,0.2000109375,0.0246478125000005
1,27940,16163,50,1,1,60,5.644753125,0.20223328125,0.0274762500000003
1,27971,16162,55,1,1,60,5.65101609375,0.20708203125,0.0305067187499999
1,27943,16165,54,1,1,60,5.64535921875,0.19395,0.0228295312500002
1,28001,16178,55,1,1,60,5.65707703125,0.206071874999999,0.0187889062499993
1,27998,16171,55,1,1,60,5.6564709375,0.200010937499999,0.0187889062499993
1,28040,16190,60,1,1,60,5.66495625,0.2008190625,0.0202031250000001
1,28034,16195,60,1,1,60,5.6637440625,0.1975865625,0.0127279687500002
1,28088,16183,60,1,1,60,5.67465375,0.204455625,0.0292945312499997
1,28118,16196,61,1,1,60,5.6807146875,0.2097084375,0.02363765625
1,28134,16213,62,1,1,60,5.6839471875,0.20667796875,0.0274762500000003
1,28184,16210,62,1,1,60,5.69404875,0.21556734375,0.0290925
1,28214,16221,63,1,1,60,5.7001096875,0.2169815625,0.0363656250000002
1,28224,16190,64,1,1,60,5.70213,0.21597140625,0.0274762500000003
1,28224,16232,64,1,1,60,5.70213,0.20708203125,0.0214153125000003
1,28260,16211,64,1,1,60,5.709403125,0.21556734375,0.0254559375000003
1,28294,16212,65,1,1,60,5.7162721875,0.2169815625,0.0222234375000001
1,28320,16229,66,1,1,60,5.721525,0.21960796875,0.0214153125000003
1,28351,16222,66,1,1,60,5.72778796875,0.22445671875,0.02565796875
1,28374,16197,66,1,1,60,5.7324346875,0.2307196875,0.0303046875000001
1,28387,16223,67,1,1,60,5.73506109375,0.21981,0.02565796875
1,28388,16222,67,1,1,60,5.735263125,0.214153125,0.0189909374999999
1,28449,16207,68,1,1,60,5.74758703125,0.2258709375,0.0260620312499995
1,28466,16216,68,1,1,60,5.7510215625,0.22364859375,0.0232335937499997
1,28480,16219,69,1,1,60,5.75385,0.224254687499999,0.0214153124999994
1,28501,16230,69,1,1,60,5.75809265625,0.223850625,0.0230315624999999
1,28550,16223,70,1,1,60,5.7679921875,0.23334609375,0.0327290624999996
1,28572,16196,70,1,1,60,5.772436875,0.23132578125,0.0248498437500002
1,28607,16222,71,1,1,60,5.77950796875,0.233144062499999,0.0284864062499999
1,28624,16218,71,1,1,60,5.7829425,0.2355684375,0.0290925000000009
1,28651,16216,73,1,1,60,5.78839734375,0.236780625000001,0.0303046875000001
1,28675,16228,75,1,1,60,5.79324609375,0.23859890625,0.0252539062500006
1,28706,16206,75,1,1,60,5.7995090625,0.2396090625,0.0270721875
1,28741,16236,76,1,1,60,5.80658015625,0.240013125,0.0270721875
1,28743,16228,76,1,1,60,5.80698421875,0.2404171875,0.0240417187499995
1,28773,16240,78,1,1,60,5.81304515625,0.24082125,0.0246478124999996
1,28792,16221,78,1,1,60,5.81688375,0.2424375,0.02363765625
1,28847,16230,80,1,1,60,5.82799546875,0.24728625,0.0284864062499999
1,28863,16219,80,1,1,60,5.83122796875,0.24567,0.0246478125000005
2,28894,16250,85,1,1,60,5.8374909375,0.2493065625,0.0305067187499999
3,28896,16252,85,1,1,60,5.837895,0.24567,0.0248498437500002
4,28911,16236,85,1,1,60,5.84092546875,0.24546796875,0.0240417187499995
5,28946,16250,90,1,1,60,5.8479965625,0.24789234375,0.0200010937500004
6,28957,16245,90,1,1,60,5.85021890625,0.24567,0.0189909374999999
7,28962,16256,100,1,1,60,5.8512290625,0.243245625,0.0137381250000006
8,28989,16247,100,1,1,60,5.85668390625,0.2436496875,0.0187889062500002
9,29000,16249,100,1,1,60,5.85890625,0.241629375,0.0179807812500004
10,28999,16249,100,1,1,60,5.85870421875,0.238194843750001,0.0107076562500001
11,29036,16251,100,1,1,60,5.866179375,0.2436496875,0.0159604687500003
12,29059,16246,100,1,1,60,5.87082609375,0.23253796875,0.01959703125
13,29057,16250,100,1,1,60,5.87042203125,0.23274,0.0137381249999997
14,29071,16258,100,1,1,60,5.87325046875,0.22849734375,0.0143442187499998
15,29090,16253,100,1,1,60,5.8770890625,0.22607296875,0.0183848437499998
16,29092,16278,100,1,1,60,5.877493125,0.23213390625,0.0113137499999993
17,29109,16268,100,1,1,60,5.88092765625,0.223850625,0.0101015624999992
18,29118,16238,100,1,1,60,5.8827459375,0.226275,0.0123239062499998
19,29101,16257,100,1,1,60,5.87931140625,0.21435515625,0.00606093750000003
20,29097,16227,100,1,1,60,5.87850328125,0.21475921875,0.00141421874999992
21,29122,16286,100,1,1,60,5.8835540625,0.2089003125,0.00606093750000003
22,29118,16233,100,1,1,60,5.8827459375,0.20203125,0.00181828125000028
23,29119,16255,100,1,1,60,5.88294796875,0.19900078125,0.000202031249999735
24,29120,16265,100,1,1,60,5.88315,0.18910125,0.00383859375000029
25,29124,16253,100,1,1,60,5.883958125,0.1838484375,0.00545484374999994
26,29120,16248,100,1,1,60,5.88315,0.18102,-0.000404062499999469
27,29128,16255,100,1,1,60,5.88476625,0.18263625,0.00202031250000001
28,29126,16231,100,1,1,60,5.8843621875,0.1749590625,0.00141421875000081
29,29142,16257,100,1,1,60,5.8875946875,0.1713225,0.00444468749999949
30,29135,16250,100,1,1,60,5.88618046875,0.164655468749999,0.00222234374999974
31,29145,16240,100,1,1,60,5.88820078125,0.1604128125,0.00505078124999958
32,29149,16254,100,1,1,60,5.88900890625,0.156574218749999,0.00424265624999975
33,29152,16255,100,1,1,60,5.889615,0.154553906249999,0.00525281249999932
34,29151,16258,100,1,1,60,5.88941296875,0.15414984375,0.00181828125000028
35,29149,16258,100,1,1,60,5.88900890625,0.141421875,0.00282843749999984
36,29142,16243,100,1,1,60,5.8875946875,0.136573125,-0.000606093750000092
37,29143,16264,100,1,1,60,5.88779671875,0.133946718750001,-0.0012121874999993
38,29148,16253,100,1,1,60,5.888806875,0.13071421875,-0.000808124999999826
39,29153,16252,100,1,1,60,5.88981703125,0.121824843750001,0.000404062500000357
40,29151,16246,100,1,1,60,5.88941296875,0.11697609375,0.000404062500000357
41,29134,16250,100,1,1,60,5.8859784375,0.10647046875,-0.00161624999999965
42,29150,16241,100,1,1,60,5.8892109375,0.1062684375,0.00141421874999992
43,29119,16252,100,1,1,60,5.88294796875,0.0945506249999992,-0.0058589062500003
44,29129,16256,100,1,1,60,5.88496828125,0.0917221874999994,-0.00484875000000073
45,29129,16243,100,1,1,60,5.88496828125,0.0854592187499996,-0.00444468750000038
46,29119,16228,100,1,1,60,5.88294796875,0.0763678125,-0.00303046875000046
47,29139,16262,100,1,1,60,5.88698859375,0.0800043749999997,-0.00222234375000063
48,29119,16237,100,1,1,60,5.88294796875,0.0699028124999996,0
49,29145,16257,100,1,1,60,5.88820078125,0.0713170312499996,0.00323250000000019
50,29156,16251,100,1,1,60,5.890423125,0.0624276562500006,0.00545484375000083
51,29121,16263,100,1,1,60,5.88335203125,0.0521240624999999,0.000404062500000357
52,29120,16250,100,1,1,60,5.88315,0.0456590625000004,-0.0038385937499994
53,29129,16242,100,1,1,60,5.88496828125,0.0470732812499994,0.00202031250000001
1,29146,16253,100,1,2,43,5.8884028125,,
2,28937,16261,100,1,2,42,5.84617828125,,
3,28876,16245,100,1,2,41,5.833854375,,
4,28846,16226,100,1,2,40,5.8277934375,,
5,28830,16241,100,1,2,39,5.8245609375,,
6,28794,16256,100,1,2,38,5.8172878125,,
7,28788,16254,100,1,2,37,5.816075625,,
8,28742,16258,100,1,2,36,5.8067821875,,
9,28736,16250,100,1,2,35,5.80557,,
10,28715,16242,100,1,2,34,5.80132734375,,
11,28702,16252,100,1,2,33,5.7987009375,,
12,28698,16245,100,1,2,32,5.7978928125,,
13,28670,16252,100,1,2,31,5.7922359375,,
14,28645,16235,100,1,2,30,5.78718515625,,
15,28583,16257,100,1,2,29,5.77465921875,,
16,28574,16243,100,1,2,28,5.7728409375,,
17,28542,16249,100,1,2,27,5.7663759375,,
18,28539,16248,100,1,2,26,5.76576984375,,
19,28539,16218,100,1,2,25,5.76576984375,,
20,28521,16209,100,1,2,24,5.76213328125,,
21,28495,16234,100,1,2,23,5.75688046875,,
22,28455,16235,100,1,2,22,5.74879921875,,
23,28417,16241,100,1,2,21,5.74112203125,,
24,28411,16224,100,1,2,20,5.73990984375,,
25,28411,16222,100,1,2,19,5.73990984375,,
26,28393,16220,100,1,2,18,5.73627328125,,
27,28369,16225,100,1,2,17,5.73142453125,,
28,28331,16259,100,1,2,16,5.72374734375,,
29,28316,16222,100,1,2,15,5.720716875,,
30,28279,16222,100,1,2,14,5.71324171875,,
31,28223,16220,100,1,2,13,5.70192796875,,
32,28262,16219,100,1,2,12,5.7098071875,,
33,28144,16225,100,1,2,11,5.6859675,,
34,28113,16224,100,1,2,10,5.67970453125,,
35,28127,16214,100,1,2,9,5.68253296875,,
36,28145,16215,100,1,2,8,5.68616953125,,
37,28107,16223,100,1,2,7,5.67849234375,,
38,28061,16228,100,1,2,6,5.66919890625,,
39,28051,16216,100,1,2,5,5.66717859375,,
40,28023,16212,100,1,2,6,5.66152171875,,
41,27976,16219,100,1,2,7,5.65202625,,
42,27950,16196,100,1,2,8,5.6467734375,,
43,27932,16218,100,1,2,9,5.643136875,,
44,27930,16222,100,1,2,10,5.6427328125,,
45,27933,16227,100,1,2,11,5.64333890625,,
46,27906,16210,100,1,2,12,5.6378840625,,
47,27881,16215,100,1,2,13,5.63283328125,,
48,27883,16223,100,1,2,14,5.63323734375,,
49,27911,16204,100,1,2,15,5.63889421875,,
50,27909,16218,100,1,2,16,5.63849015625,,
51,27933,16218,100,1,2,17,5.64333890625,,
52,27924,16212,100,1,2,18,5.641520625,,
53,27941,16222,100,1,2,19,5.64495515625,,
54,27957,16203,100,1,2,20,5.64818765625,,
55,27986,16218,100,1,2,21,5.6540465625,,
56,27972,16204,100,1,2,22,5.651218125,,
57,27989,16221,100,1,2,23,5.65465265625,,
58,28052,16238,100,1,2,22,5.667380625,,
59,28050,16202,100,1,2,21,5.6669765625,,
60,28030,16219,100,1,2,22,5.6629359375,,
61,28096,16209,100,1,2,21,5.67627,,
62,28058,16226,100,1,2,20,5.6685928125,,
63,28077,16212,100,1,2,19,5.67243140625,,
64,28059,16209,100,1,2,18,5.66879484375,,
65,28103,16221,100,1,2,17,5.67768421875,,
66,28100,16224,100,1,2,16,5.677078125,,
67,28083,16234,100,1,2,15,5.67364359375,,
68,28069,16203,100,1,2,14,5.67081515625,,
69,28051,16197,100,1,2,13,5.66717859375,,
70,28053,16205,100,1,2,12,5.66758265625,,
71,28032,16205,100,1,2,11,5.66334,,
72,27988,16227,100,1,2,12,5.654450625,,
73,27965,16217,100,1,2,13,5.64980390625,,
74,27981,16226,100,1,2,14,5.65303640625,,
75,27972,16231,100,1,2,15,5.651218125,,
76,27951,16223,100,1,2,16,5.64697546875,,
77,27973,16222,100,1,2,17,5.65142015625,,
78,27987,16232,100,1,2,18,5.65424859375,,
79,27967,16224,100,1,2,19,5.65020796875,,
80,28031,16220,100,1,2,20,5.66313796875,,
81,28021,16243,100,1,2,21,5.66111765625,,
82,28052,16216,100,1,2,20,5.667380625,,
83,28033,16230,100,1,2,19,5.66354203125,,
84,28062,16226,100,1,2,18,5.6694009375,,
85,28055,16213,100,1,2,17,5.66798671875,,
86,28055,16222,100,1,2,16,5.66798671875,,
87,28061,16226,100,1,2,15,5.66919890625,,
88,28029,16226,100,1,2,16,5.66273390625,,
89,28019,16229,100,1,2,17,5.66071359375,,
90,27962,16228,100,1,2,18,5.6491978125,,
91,28001,16221,100,1,2,19,5.65707703125,,
1,28020,16227,100,1,3,18,5.660915625,,
2,28030,16227,100,1,3,17,5.6629359375,,
3,28030,16234,100,1,3,16,5.6629359375,,
4,27997,16215,100,1,3,15,5.65626890625,,
5,28010,16217,100,1,3,14,5.6588953125,,
6,28003,16223,100,1,3,13,5.65748109375,,
7,27998,16221,100,1,3,12,5.6564709375,,
8,27968,16223,100,1,3,11,5.65041,,
9,27951,16227,100,1,3,10,5.64697546875,,
10,27929,16227,100,1,3,9,5.64253078125,,
11,27909,16237,100,1,3,8,5.63849015625,,
12,27876,16226,100,1,3,7,5.631823125,,
1,27794,16222,100,0,0,0,5.6152565625,,

_______________________________________________
http://cool.haxx.se/mailman/listinfo/rockbox
Received on Wed Feb 16 18:43:02 2005


Page was last modified "Jan 10 2012" The Rockbox Crew
aaa