FS#9968 - Charging on e200v2

Attached to Project: Rockbox
Opened by Hilton Shumway (HIllshum) - Saturday, 28 February 2009, 04:32 GMT
Last edited by Bertrik Sikken (bertrik) - Sunday, 22 March 2009, 19:10 GMT
Task Type Patches
Category Battery/Charging
Status Closed
Assigned To No-one
Operating System Another
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


So apparently the charger/battery on the e200 is the same for both v1 and v2. This patch simply copies powermngt-e200.c to powermngt-e200v2.c
This task depends upon

Closed by  Bertrik Sikken (bertrik)
Sunday, 22 March 2009, 19:10 GMT
Reason for closing:  Accepted
Additional comments about closing:  Committed as svn r20465
Comment by Frank Gevaerts (fg) - Saturday, 28 February 2009, 14:42 GMT
If this is the same file, why not just change SOURCES?
Comment by Rafaël Carré (funman) - Sunday, 01 March 2009, 14:52 GMT
was it confirmed that the exact same battery is used in both models?,
Comment by Hilton Shumway (HIllshum) - Monday, 02 March 2009, 22:09 GMT
I haven't seen any "V2" batteries for sale anywhere...
Comment by Hilton Shumway (HIllshum) - Tuesday, 03 March 2009, 01:33 GMT
They do seem to be the same
Comment by Hilton Shumway (HIllshum) - Tuesday, 03 March 2009, 03:05 GMT
Comment by Bertrik Sikken (bertrik) - Tuesday, 03 March 2009, 08:02 GMT
This patch alone does not enable charging yet, it simply allows the e200v2 to have its own charge / discharge calibration curves.
There was some talk about the e200v2 battery on the sansa v2 forum thread.

To enable charging, we need to include powermgmt-as3525.c too (and change a few other minor changes). I can post a patch that does enable charging later today. It would be nice to have confirmation of the charge settings first (charge current, charge voltage and proper ADC channel to use for reading the voltage).
Comment by Hilton Shumway (HIllshum) - Tuesday, 03 March 2009, 15:18 GMT
how would I provide those?
Comment by Bertrik Sikken (bertrik) - Tuesday, 03 March 2009, 15:55 GMT
I think I already explained that in the forum thread (but that one is getting so long now that it's easy to overlook something).

1) Charging current can only be determined from direct measurement through the charging cable. This is not so easy to do because it requires a modified cable. Using the same 300 mA charging current as used in the v1 is probably safe (it's still less than 0.5C)
2) Charging voltage can be determined by looking at the battery voltage in the rockbox battery debug menu just after the OF did a full charge of the battery.
3) The proper ADC channel can be determined by checking if the battery voltage shows a realistic value when the charger is plugged in. Modify the argument to adc_read in powermgmt-as3525.c to either ADC_RTCSUP or ADC_BVDD and check which one causes a realistic battery voltage display in rockbox with the charger plugged in (realistic means somewhere between 3.3V and 4.25V).
Comment by Hilton Shumway (HIllshum) - Tuesday, 03 March 2009, 18:04 GMT
I'm not going to fry the thing am I?
Comment by Bertrik Sikken (bertrik) - Tuesday, 03 March 2009, 19:06 GMT
Comment by Michael Sevakis (MikeS) - Tuesday, 03 March 2009, 21:52 GMT
"So apparently the charger/battery on the e200 is the same for both v1 and v2"

The as3525 docs just give a better explanation of the very same charging system that the as3514 has (which isn't explained so well there) so it's just a matter of filling in specifics.

To all concerned:
"I'm not going to fry the thing am I?"

The main difference between OF and Rockbox charging is we don't set the voltage to 4.25V but 4.20V instead which I suppose will shorten the runtime a bit compared to OF but is nicer to the LiIon cell. When possible Rockbox takes voltage into consideration before starting a cycle. It's safe to say that we're on the safer side of things.
Comment by Hilton Shumway (HIllshum) - Tuesday, 03 March 2009, 22:10 GMT
I said that but whatever....

Okay, I don't think I'll have time for a few days but I'll see what I can do.
Comment by Bertrik Sikken (bertrik) - Wednesday, 04 March 2009, 09:19 GMT
Why wait again? You can't do 1) anyway so it doesn't take time, 2) can be done in 5 minutes, 3) might take an hour or so (at the most), assuming you have the build-environment set up.
Creating the patch should take me no more than a few hours, I just need the information I explained earlier (03 March 2009, 16:55 GMT+1).
Comment by Hilton Shumway (HIllshum) - Wednesday, 04 March 2009, 16:07 GMT
I will start charging now, is there a way to boot straight to that debug screen?
3) I will do once I have the time
Comment by Hilton Shumway (HIllshum) - Wednesday, 04 March 2009, 18:35 GMT
The voltage after a full OF charge is 4.149V
Comment by Bertrik Sikken (bertrik) - Friday, 06 March 2009, 21:47 GMT
This patch should enable charging for the e200v2.
The charge settings and charge curve have been copied from the e200v1 for now (charge current is actually a little lower than reported in the forum thread) and could be further calibrated.

Not quite sure about the proper ADC channel for battery voltage monitoring during charging. Please check if the battery voltage shows a normal value in the rockbox debug/battery menu.
Comment by Bertrik Sikken (bertrik) - Thursday, 12 March 2009, 23:01 GMT
The powermgmt-target file is now moved in SVN, so the patch is a bit smaller now.
Comment by Michael Chicoine (mc2739) - Sunday, 22 March 2009, 00:29 GMT
I have applied e200v2-charging4.patch to my e200v2 and tested charging. The battery was at about 58% charge when I started the charge cycle. I reached max voltage level of 4.226v after 38 minutes of charging. The battery voltage remained at that level until I disconnected the USB cable. I did not see the 50mv drop in voltage at full charge.

I have attached a text file with the voltage levels as shown on the battery debug screen while charging and a screen dump of the debug screen.
Comment by Bertrik Sikken (bertrik) - Sunday, 22 March 2009, 10:21 GMT
Great, thanks for testing. This basically look OK to me:
* voltage seems right: the final voltage is a little higher than the expect 4.2V but nothing to worry about IMO.
* you see the voltage saturate nicely as the charger goes from constant-current charging into the constant voltage charging mode.
* the charge was not complete, that's why you didn't see the slight drop in voltage as the charger turned off. Basically what happens in the constant voltage mode is that the charger keeps the charge voltage constant while the battery charging current slowly drops over time. At some point the charge current has dropped to a certain percentage of the initial charge current (say 10%) and the charger should automatically stop the charge cycle.

Could you try a charge again, and wait a bit longer?
BTW, you should be able to use the battery bench plugin for logging the charge parameters (just make sure you shutdown the player cleanly, so the battery bench plugin has a chance of properly writing its measurements to file).
Comment by Michael Chicoine (mc2739) - Sunday, 22 March 2009, 16:59 GMT
Here is the battery bench from a second run. The battery was completely run down prior to this charging cycle.
Comment by Bertrik Sikken (bertrik) - Sunday, 22 March 2009, 18:27 GMT
Nice, thanks. You can see in the battery bench that the charger went from constant-current to constant voltage mode after 1h48 (1.8 hours) and then spent another 0h54m (0.9 hours) in constant voltage mode.
In constant-I mode, about 300 mA * 1.8 hour = 540 mAh was delivered to the battery and in constant-V mode, about 165 mA * 0.9 hour = 148.5 mAh was delivered (assuming a linear decreasing current from 300 mA to 30 mA), for a total of about 688 mAh. This is quite close to the claimed battery capacity of 730 mAh.

The battery bench file also exposes a bug in the battery bench plugin ... It doesn't show the status of the charger (charging or discharging) :P

As far as I'm concerned, the information so far indicates that charging can be enabled for e200v2.