This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#4770 - H3x0: New USB Charging Functionality
|
Details1.) USB charging for h3x0 by turning on MOSFET in PCF50606 initialization.
2.) USB_inserted also supplies the h300 with power as well as charges it. Before only USB_powered state was known to power/charge device. Added to powermanagement. 3.) Battery symbol in statusbar now animates while charging on USB_inserted. This changed USB_powered to USB_inserted in statusbar info. * 4.) Added USB Inserted line to Debug Menu --> View Battery menu. This isn't necessary, just maybe nice to have. * Note when USB and Power Charger are both plugged in, statusbar symbol will show USB plugged in. It has to show one or the other, and it was easiest to leave it showing USB. Hopefully we can get the boot loader to boot Rockbox on AC now that this is solved :P Unfortunetly, I am not brave enough to try it without a GDB to reprogram. |
This task depends upon
Closed by Steve Bavin (pondlife)
Thursday, 01 February 2007, 11:49 GMT+2
Reason for closing: Accepted
Additional comments about closing: Committed. Thanks pyro.
Thursday, 01 February 2007, 11:49 GMT+2
Reason for closing: Accepted
Additional comments about closing: Committed. Thanks pyro.
But I think I found a bug. After I had recharged my player, I plugued it to my computer to transfer some files. So it started to charge normally. I unpluged it and repluged it by holding REC to let it continue to charge without going in USB mode. It stopped charging few minutes later but I had started playing a file in the mainwhile. So when the hard drive started to spin after some time, it started to charge again for few minutes and stopped again. And it do this again and again everytime the hard drive spins.
I don't think it's a good thing for the battery... No ?
I am curious if the iriver firmware does not do this? If it does not, I'm not sure why or how. I don't believe this is bad for the battery.
How do you know this? have you disassembled the iriver firmware?
I'm pretty sure it keeps maintaining the battery charge, just like Rockbox does.
I wonder why you changed the statusbar code in that way? Is it compatible with the Archos Ondio, which doesn't have rechargeable batteries, but can be powered by USB?
Also, I believe we need to have an option for the USB charging mode, since having it always enabled might cause problems when connecting to an unpowered USB hub.
I only have basic c knowledge and therefore there very well may be much better ways to program these changes. Let me try to explain my reasoning to see if you agree. in powermgmt.c the charger_input_state (0-No Charger, 1-Charge Unplugged, 2-Charger Plugged, 3-Charger) variable is determined by whether or not the AC/DC charger is plugged in or not. Lostlogic recently submitted and comitted a patch that added an OR statement to this variable. It now read charger_input_state got updated if charger_input_state || usb_powered. What is kind of misleading is that usb_powered mode does not mean the device is powered from USB. It is only active if you hold down the REC button. Regular USB transfer mode is considered usb_inserted and not usb_powered.
The question is whether to have the charger_input_state variable reflect (AC/DC charger || Power from USB) or just AC/DC Charger and have the usb charging modes handled seperatly.
But to directly answer your question, I only changed the usb_powered to usb_inserted in statusbar.c because the device is also charging in usb_inserted mode. The battery symbol would only animate in usb_powered mode before. Again, realize usb_powered is NOT "Powered from USB" but instead the mode when you hold the REC while inserting USB.
I am not 100% sure about if the Ondio will be affected by the change since the code still checks charging_state==CHARGING in which the Ondio should report back it is not charging. I would feel most confortable if someone could test it. I admit I have a hard time trying to distinguish between the different features of all the players.
We can add the option for USB charging mode = On/Off. Perhaps we'll wait to commit until that option is included in this patch? I also wish I could trace the signal from that LX2201 USB Hi/Low pin to maybe a GPIO pin. Lostlogic might be sending me a dead PCB to simply trace signals which would be helpful.
Feel free to change, modify, fix or recommend some other way to do it.
It's really good and I wonder why it did not get committed to the CVS???
One thing I noticed: when you set your config to see the battery numerical
in your status bar it still displays it graphical when you charge it via
USB.
Is this on intend or is this a bug?
Could you please extend it to make it optional with an extra option to set?
And maybe fix the problem, where it still displays a graphical symbol even
when it's configured to be numerical?
I also noticed something else which I believe it has something to do with
that code.
I had problems with my date/time settings (iRiver H300) which vanishes suddenly.
Now it reappears - and I'm nearly sure it vanishes because I didn't use
this patch and reappeared after I used it again...
Please have a look at the (now closed) bug #4906:
http://www.rockbox.org/tracker/task/4906
Jason, I noticed that USB loading takes longer than loading with AC adaptor,
but I'm not sure if it's longer than with the original firmware
- I don't use it anymore :-D
This one adds an option (General/System/Battery/Charge During USB connection)
to switch the USB charging during disk mode on or off.
As the originally patch it only works with pcf50606 based devices
(is there any other device beneath iRiver's H3x0?).
Would be nice if some persons could test it -
I put it on my H340 and it seems to work but it's not very well tested...
(actually I have no deep knowledge about the low level addresses
and settings and such, so there may be some problems which I don't see).
I also don't know how to add implementation for other targets
(BTW, for which is this useful and possible?)
Any comments are appreciated!
It seems my above patch has a secret problem!
My device hangs at the initial rockbox splash screen
when rebooting after I enabled and saved the settings
for the USB charging!
I have no idea why - maybe somebody else can have a look
at the sources and give me a hint what's going on...
[EDIT - 20060424:] Now it no longer hangs!
I had to reset the settings by clearing them inside
the old (working) version. Pressing "REC" during
startup made the device hang with "Clearing" message :-(
Anyway - the hanging has nothing to do with the patch!
Only if I go back to my previous version which is based on
a 20060418 CVS and includes a lot patches does work.
I'm not sure what's going on, but it seems it has nothing to do with the USB patch...
(I already cleared my settings and deleted the tagcache files
- nothing helped...)
[EDIT: 20060424] Hanging is no longer a problem (see above)
which accident found their way into this...
I didn't change any functionality!
It changes two things:
- it makes sure, the IRQ is correctly set (thanks to amiconn for this)
- and it does (currently) not directly read the PCF50606 register,
this should fix the problem with wrong detection...
So please try it again and tell me if it works now!
It also adds some more entries to the "Info/Debug/View Battery"
and to the "Info/Debug/View I/O ports" screens.
(just for debugging purposes)
With the new changes in the cvs, is this patch still necessary? The code was heavily reorganized, so patching the last version of the h300-usb-charge patch doesn't work, even trying to fix the rejects seems to be be non trivial.
Thanks a lot and all the best
Norbert
And yes, it's still needed - USB charging is not enabled in official CVS!
how the button press during plugging in your USB chord works.
Look at "
FS#5744— Button press for USB connection or USB power only" for further information.(this one not only works for H300 devices, it should work for
alls devices which support USB power)
Unfortunately that patch overlapps in some lines with
this patch here, so if you try to include both, you'll
get patch failures :-(
Here is another patch which combines both patches:
One small thing that I noticed. Appart from the battery icon there is little feedback indicating it is charging. I'll make a feature request for this as it is not just for USB charging.
Anyway, thanks for the patch :-)
Ask Linus or some other core dev politely for inclusion...
BTW, if somebody can give me information which pins/levels are
used for the iAudio X5 I could add it as well
- but currently I miss that (and I don't own such a device ;)
but I'm unable to do it (at least I fear to brick my device when trying ;)
-> some core dev should do it!
Here's another sync for today's CVS...
Bye, Norbert
(I hope it will last a bit longer than the last one...)
Now (hopefully) fixed...
In firmware/target/coldfire/iriver/h300/pcf50606-h300.c
+#include "logf.h"
+
+static bool usb_ch_enabled = false;
Fails because another include was added but this is an easy fix. The button press patch fails in many places which is to much for me to figure out.
It works very well thanks again for the patch :-)
Here's the sync to today's repository...
And I _REALLY_ hope that it finally got included in the SVN -
or that someone tells me what's wrong with the patch.
I'm really bored to always resync it (for nine months now)...
I've been testing the first patch on my H340 with a view to committing it. It seems that even with a fairly flat battery (e.g. reported at 40%), the USB current drain doesn't exceed 100mA. I know very little about the innards, but was expecting 500mA to be drawn. If this can be resolved or explained, I'll commit it.
it would really be great if this patch finally got committed!
Actually, I only set the GPOOD2 to High-Z for USB charging at the PCF50606
and set it back to pulled down for disabling USB charging.
Everything else is done by the hardware...
Did you do tests with USB charging when using the original firmware?
If the original firmware is able to charge it better, we miss something :-(
I'm only using Windows 2000 Device Manager to read current draw, but I'm not convinced it's telling the truth! I get the following figures:
Rockbox, USB Charging ON - 100mA
Rockbox, USB Charging OFF - 100mA
RetailOS, USB Charging ON - no connection is made, no figure available
RetailOS, USB Charging OFF - 100mA
Perhaps there is some better software available, or maybe some kind soul can put a meter in series and report back here (hint!).