FS#2443 - More aggressive Recorder V1 charging

Attached to Project: Rockbox
Opened by Jerry (vanbargw) - Saturday, 05 February 2005, 16:28 GMT
Last edited by Jörg Hohensohn (hohensoh) - Thursday, 03 March 2005, 18:22 GMT
Task Type Patches
Status Closed
Assigned To Jörg Hohensohn (hohensoh)
Operating System
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


More aggressive charging for the software-controlled V1
AJR. The changes are:

* If the deltaV (charge complete detection) fails, this
goes directly into trickle charge mode. Previously, it
would disable futher charging for 60 minutes (thus
draining the batteries for that period of time).

* Trickle charge is forever (enable it in your
settings!). Previously, trickle charge stopped after
12 hours. At that point, the recorder would be
discharging the batteries.

* The trickle charge will not exceed the 0.10C maximum
continuous charge level typically recommended by
battery manufacturers (trickle charge limits the charge
current via PWM of the charge control).

* If deltaV detection didn't succeed or if a time limit
expired, the recorder disabled charging, discharging
the batteries. If "deep discharge" is OFF, we should
never totally disable charging. The hazzard to the
batteries for trickle charging is zero (see previous)
and the aggrevation to the user is huge if they run out
of battery power prematurely.

In your battery settings, turn "deep discharge" _OFF_
and "trickle charge" _ON_.
This task depends upon

Closed by  Jörg Hohensohn (hohensoh)
Thursday, 03 March 2005, 18:22 GMT
Reason for closing:  Accepted
Additional comments about closing:  Logged In: YES

Committed, I leave this open for a while to capture Jerry's
improvements. ;-)
Comment by Jerry (vanbargw) - Monday, 07 February 2005, 02:13 GMT

Updated the patch and build:

* Reviewing my code, I found a couple of places where I
inadvertantly used "ifdef" when I should have used "ifndef"
(love/hate relationship with cut & paste).

* I increased the maximum trickle charge % to 59/60 (was 24
seconds max out of 60). If you are using a charge voltage
less than about 10.5v (especially as you drop to 9v or
less), the amount of current going to charging the batteries
drops significantly.

Justification for increasing the max %:

* Based on the Battery FAQ, the AJR takes ~100mA minimum,
~130mA with the backlight on, and much more when the disk
spins up. At 350mA charge current (>= 10.5v input), (24/60)
* 350mA = 140mA. At 9.0v input, we need to run 100% duty
cycle to achieve the same 140mA.

* The trickle charge algorithm runs a closed loop control
which will automatically adjust the on/off % to Do The Right
Thing[tm] if the charger voltage is higher or lower.

Comment by Jerry (vanbargw) - Wednesday, 16 February 2005, 17:06 GMT

Attached is 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 :-).

Comment by Carsten Tschach (tschach) - Thursday, 17 February 2005, 13:16 GMT


I just patched th current CVS-tree with this patch, but
there seems to be an error in the implementation:

If I disconnect the Recorder from external power even with
fully charged batteries, I'll see a blinking battery-sign
and if I try to flash rombox I'll get a "Battery too low"

Bye, Carsten
Comment by Carsten Tschach (tschach) - Thursday, 17 February 2005, 14:00 GMT

BTW...the blinking battery sign is fully filled which means
batterys are full, but it's still blinking...
Comment by Jerry (vanbargw) - Friday, 18 February 2005, 04:50 GMT

More updates...
* Fixed the blinkin' battery problem (power low warning)
* Start cleaning up for other targets (other than AJR) - NOT
* This includes changes in powermgmt.c up to 1.69

WARNING: This creates a debug file "/powermgmt.csv" with
once-per-minute save of battery charge/discharge values.
Comment by Linus Nielsen Feltzing (linusnielsen) - Friday, 18 February 2005, 06:56 GMT

Just so you know, your work on this is very much appreciated.
Comment by Jerry (vanbargw) - Sunday, 20 February 2005, 02:44 GMT

Compiles cleanly on the Archos Player, Recorder, FM
Recorder, V2, and Ondios. The link for the FM & V2 breaks
"region FLASH is full" - I don't have experience with these
targets so I don't know off-hand why.

Interesting test trivia: I ran 2 hours creating md5sums of
files over a usb1.1 link (e.g. lots of disk usage over USB)
and the charger kept up (battery voltage ~5.4v, charger
running 60/60, unit warm).

This is getting close to Ready for Prime Time.
Comment by Jerry (vanbargw) - Wednesday, 23 February 2005, 03:49 GMT

Tweaked the initial charge level
* 95% < bat 100% - trickle
* 85% < bat < 95% - topoff (unchanged)
* bat < 85% - full charge

More clean ups.


Fixed my #if defined() error which inhibited the creation of
the debug file powermgmt.csv even when I _wanted_ it. Note
that the attached patch has the debug file turned OFF.

Also attached is a ajbrec.ajz which has the powermgmt.csv
debug file turned ON for testing purposes.
Comment by Jerry (vanbargw) - Tuesday, 01 March 2005, 03:44 GMT

This is as good as it is going to get for now. I am happy
with what I am seeing for recharging and maintaining the
battery charge. It is time for the project maintainers to
review the changes and apply the patch if it is acceptable.

Feedback welcome (via email list preferred).

Comment by Jerry (vanbargw) - Thursday, 03 March 2005, 02:51 GMT

Jörg tried the patch on his Ondio and found that the battery
voltage was not being reported correctly (sorry, Jörg). The
problem was with the sleep and associated exponential filter
on the battery -- when there was no charger, the sleep just
slept and thus the filtered battery voltage never was
calculated. Oooops. Sorry Jörg.

The attached 050302.patch file should fix the problem.
Sorry Jörg.

P.S. Did I apologize for messing up your Ondio Jörg? Sorry.
Comment by Linus Nielsen Feltzing (linusnielsen) - Thursday, 03 March 2005, 06:05 GMT

I think you owe Jörg an apology! :-)
Comment by Jörg Hohensohn (hohensoh) - Thursday, 03 March 2005, 18:22 GMT

Committed, I leave this open for a while to capture Jerry's
improvements. ;-)