Rockbox

Tasklist

FS#8802 - iPod does not charge via an AC -> USB adapter

Attached to Project: Rockbox
Opened by Jason Trible (JasonT) - Tuesday, 25 March 2008, 19:48 GMT
Last edited by Torne Wuff (torne) - Sunday, 06 June 2010, 13:08 GMT
Task Type Bugs
Category Battery/Charging
Status Closed
Assigned To No-one
Operating System iPod 5G
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Version 3.1
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Problem:
Can no longer charge my 30Gig iPod Video device with a connector that plugs directly into the wall

Additional Information:
-If I boot into emergency disc mode (hold down select and play on reboot), the device will still charge so I do not think it is an issue with my hardware, or with my AC adapter
-This has worked in Rockbox before, but I don't typically charge this way so I don't know when this broke.
-Originally there was a patch I needed to apply to make this type of charging work. At some point, it started working in Rockbox proper. Then, apparently, it broke again.
-I can go back to older builds if someone needs help narrowing down when this broke
-Charging via a USB port appears to work fine.
This task depends upon

Closed by  Torne Wuff (torne)
Sunday, 06 June 2010, 13:08 GMT
Reason for closing:  Fixed
Additional comments about closing:  USB charging works as of r26626. The GPIO manipulation is based on dreamlayers' patch here, but it uses the new USB charging framework instead of just always enabling it.
Comment by Jason Trible (JasonT) - Tuesday, 25 March 2008, 19:50 GMT
Sorry, didn't include version - last tried this with r16690-080318
Comment by ferdinand sitko (sitko) - Wednesday, 26 March 2008, 08:39 GMT
I have the same behaviour with my iPod 20 GB Color/Photo.
Last working release by me was r15845-071129.
Than I tried r16290-080212 and bug was already included.
Comment by christian (kiese) - Wednesday, 26 March 2008, 10:49 GMT
i have the same problem with my ipod nano. it could not charge in ipod software also. usb works.
Comment by Boris Gjenero (dreamlayers) - Thursday, 27 March 2008, 04:25 GMT
I hooked measured USB charging current on a 5th generation 30 gig iPod. Only the ground and +5V lines were connected. When running Rockbox r16819, charging current was just under 100mA. When running the original firmware, version 1.3 (latest) the iPod drew 0.42A.

I also felt that USB charging from my computer was too slow in Rockbox when I plugged in USB while holding MENU so Rockbox stays running normally. I didn't measure the current but based on charge rate I'm willing to bet it's limited to 100mA. In Device Manager in Windows Vista, the power tab for that particular USB hub on the motherboard showed that the iPod had requested 500mA, but that doesn't control how much it uses.

Various iPods use the LTC4066 chip for charging and USB power management. For info about the chip, see:
http://www.linear.com/pc/productDetail.jsp?navId=H0,C1,C1003,C1037,C1078,C1088,P12292
Pin 13 (HPWR) of that chip is an input which selects between 100mA and 500mA charging. Perhaps that corresponds to a GPIO bit which Rockbox needs to manipulate.

The current limiting part of the LTC4066 doesn't apply to Firewire charging, and charging from Firewire in Rockbox is fast.
Comment by bob (bobbozzo) - Monday, 21 April 2008, 04:00 GMT
Same problem here, with firmware downloaded today.
Tried both the Apple wall charger, and a car usb charger.
iPod 30GB Color/Photo
Comment by bob (bobbozzo) - Monday, 21 April 2008, 04:03 GMT
To be more specific, I'm running firmware r17194.
Thanks
Comment by Geoffrey (max2950) - Tuesday, 02 September 2008, 12:17 GMT
Hi, i'm running version r18339 with USB stack enabled.

iPod is charging from AC adapter but not while connected to USB...

More info can be found here : http://forums.rockbox.org/index.php?topic=18317.0
Comment by Nate Rowe (Spanky) - Saturday, 20 September 2008, 08:28 GMT
I'm wondering if this is the same problem I'm having:
http://www.rockbox.org/tracker/8319

I haven't tested this in a while but with a AC charger plugged into my iPod with Rockbox booted, the iPod seemed to not get any noticable power from the AC adapter. Certainly not enough to charge the battery or run solely off of the AC adapter.
Comment by Justin Hannigan (Chronon) - Tuesday, 02 December 2008, 01:03 GMT
Spanky requested a task closure on  FS#8319  -- is this bug still active?
Comment by Peter Holloway (pjh1) - Thursday, 11 December 2008, 11:48 GMT
I do believe it is still active. I have a 80gig iPod 5.5G and cannot charge via USB, AC or car charger. The iPod indicates that it is being charged but it is actually discharging. It charges perfectly when booted with the original iPod sw. I have ver 19376 installed.
Comment by Nate Rowe (Spanky) - Thursday, 11 December 2008, 11:52 GMT
I will say that something happened in the r192xx builds that made charging awesome. It's been the best and fastest I've ever seen it. Plus, theres a new icon at the top when you're connected. I've got 0 issues on my iPod 4G Color. I have yet to run anything after r19320-ish.
Comment by Chris (decayed.cell) - Thursday, 25 December 2008, 00:17 GMT
Confirmed on iPod 4G r19450. It changes icon but the animation indicating that a charge is occuring is not happening
Comment by Boris Gjenero (dreamlayers) - Thursday, 12 February 2009, 05:36 GMT
What happens if the iPod is connected to USB or a charger when it's off, so the original firmware in flash sees it while starting up? It may configure hardware properly for USB charging then. (Doing this test with USB connected may require a custom build which doesn't go into USB mode.)

BTW. I think GPIOD & 8 may be used as the USB charger detection input on 4G and other earlier iPods.
Comment by goweropolis (goweropolis) - Wednesday, 18 February 2009, 00:09 GMT
I am having a similar problem.

Simply put, when using a USB cable, my iPod Mini 1G will charge when I let it boot into the Apple firmware, but it won't charge when I hold the menu button and boot into Rockbox.
Comment by Boris Gjenero (dreamlayers) - Wednesday, 18 February 2009, 22:52 GMT
Here is an *experimental* and *untested* patch which enables USB charging on 4G, Color/Photo, 5G/5.5G, Mini 2G and Nano 1G iPods. I've double-checked the port bits and I made sure it compiles[*]. The patch implements HAVE_USB_CHARGING_ENABLE Rockbox functionality. You need to define that in order for the new code to be included. You'll get an option at Settings -> General Settings -> System -> Battery -> Charge During USB Connection. I don't know if it's better to only enable this while USB power is available.

IMPORTANT: The OF does charger detection based on voltages found on USB data lines. This code just enables charging blindly. Only connect USB power sources which can supply over 500 mA or 0.5 A. Don't try charging from unpowered hubs or chargers which have lower ratings.

You should be able to quickly verify charging via System -> Debug -> View Battery. On 5G and 5.5G iPods, you could also use  FS#9728  .

[*] On the Nano, you need to define CONFIG_CHARGING for the necessary language entry to be built. I think the Nano ought to be compatible with setting CONFIG_CHARGING to CHARGING_SIMPLE, but I don't know why that is commented out.
Comment by Frank Gevaerts (fg) - Tuesday, 03 March 2009, 21:41 GMT
I suspect that in a final patch you'll want to use usb_allowed_current() to see what the host allows (if connected). firmware/target/arm/imx31/gigabeat-s/power-imx31.c implements this properly.
Comment by Boris Gjenero (dreamlayers) - Tuesday, 03 March 2009, 22:19 GMT
Thanks for pointing that out. Using usb_allowed_current() seems right, but I'm not sure about the way the function is implemented in http://svn.rockbox.org/viewvc.cgi/trunk/firmware/usbstack/usb_core.c?view=markup (see end of file). Why is 500 mA conditional on usb_state == CONFIGURED? Does that mean the USB code will refuse to connect to ports which cannot supply 500 mA? It should be possible to connect iPods to 100 mA ports. What about USB chargers which are capable of supplying 500 mA? (They typically aren't a USB host.) Is it safe to assume that 500 mA is available if there is USB power but no USB data connection (eg. a timeout or PORTSCX_LINE_STATUS_UNDEF)? Apple detects USB chargers by measuring voltages on USB data lines via the PCF ADC and I guess Rockbox might have to do that?

The current patch is just to confirm that USB charging works when these bits are set. On 4G/Color/Photo/5G/5.5G iPods it would also be useful to confirm that if the third bit is zero, current is limited to 100 mA.
Comment by Frank Gevaerts (fg) - Tuesday, 03 March 2009, 22:32 GMT
There's actually no clean way to do this. Most OSes only support a single configuration (i.e. they always choose the first one), so if you ask for 500mA and it's not available you can't connect, while if you only ask for 100mA you're guaranteed to connect but you don't get a useful amount of power. One way to handle this could be to ask for 500mA, and if we don't get it disconnect (not sure how, maybe just reset the controller?) and try again at 100mA (and don't charge).

To distinguish between a USB connection and a pure power connection we look for bus traffic, i.e. if there's no bus reset within some time after connecting, we assume a charger (and therefore 500mA)

Talk to Michael Sevakis (jhMikeS on IRC) for the details, he did the gigabeat S charging code and the current iteration of the USB connection init code.
Comment by Boris Gjenero (dreamlayers) - Wednesday, 04 March 2009, 22:41 GMT
Something important I forgot to consider: Has it been confirmed that charging is hardware-controlled on iPods?

It's definitely hardware-controlled on the 5G, via the LTC4066 chip. The 1G Nano has an LTC4066 and 1G Mini has an LTC4055. Those are probably used for charging, although that needs to be confirmed. What about the 4G, Color, Photo and 2G Mini?

I was looking at this bug as a USB power issue, not a charging issue. It seems nobody complains about FireWire charging, and the bits changed in the patch deal with enabling use of USB power and setting the USB current limit. They seem irrelevant for FireWire charging.
Comment by Boris Gjenero (dreamlayers) - Wednesday, 25 March 2009, 18:07 GMT
While updating the patch to use usb_allowed_current(), I thought of another concern: iPod accessories. Maybe Apple told accessory makers that if they present certain voltages at USB data pins, iPods won't use more than a certain amount of current. It's impossible to be sure that every iPod accessory which supplies power to the iPod has proper overcurrent protection, so it is necessary to assume that exceeding the limit can cause damage. If you want to charge from USB chargers, iPod charger detection is necessary. I guess there shouldn't even be any setting which overrides that.
Comment by Frank Gevaerts (fg) - Thursday, 04 June 2009, 19:46 GMT
I think we shouldn't let the usb_allowed_current() issue hold us back. We have lots of targets that don't check for power allowance when connected, and we can't even fix that on half of them. It should be fixed eventually of course, but I think getting working charging is pretty important.

The question about charging being hardware-controlled remains of course. Is there any news on that?
Comment by loyx loyx (loyx) - Monday, 30 November 2009, 05:35 GMT
I tried the patch, worked perfectly with ipod 4G. Charges with AC Adapter. Doesn't work on low power HUBs.

Enclosed is the binary
Comment by Torne Wuff (torne) - Monday, 30 November 2009, 13:04 GMT
Please don't post binaries on here, there's no need (the patch is right above), it will go out of date very quickly, and the GPL requires you to provide source if you do.
Comment by loyx loyx (loyx) - Wednesday, 02 December 2009, 00:37 GMT
correction it works on lower power hubs, the hub i was using was just faulty hahah.

yeah, sorry about that.
Comment by Torne Wuff (torne) - Wednesday, 02 December 2009, 10:54 GMT
If you can connect to a low power hub with this setting on, then your OS/hub is broken.

Rockbox's USB stack requests 500mA from the host, and if it's connected to a hub which cannot provide 500mA on the port (which should include *all* bus powered hubs; only self powered hubs can do 500mA) then the connection *should* fail; if it doesn't then your operating system is doing USB wrong. Furthermore, when it actually starts drawing 500mA the hub should at minimum switch off the port it's attached to, or switch itself off entirely, to preserve itself. If this does *not* happen then your hub is faulty ;)
Comment by Marcin Bukat (MarcinBukat) - Monday, 11 January 2010, 21:34 GMT
This patch works OK with Ipod mini 1G.
Comment by Rui Ara├║jo (Akur) - Tuesday, 09 February 2010, 22:43 GMT
This patch also works with Ipod Video.

This is the only reason I keep the Apple firmware. As soon a non experimental version of this patch arrives, I will certainly stop using the OF.
Comment by Torne Wuff (torne) - Wednesday, 10 February 2010, 10:44 GMT
If the patch works for you then you can use it.. it's perfectly fine as long as you know not to plug it into something which can't provide enough power.

I am working on a revamp of the USB charging system in rockbox to behave "properly", but I am not sure how long this will take.
Comment by Torne Wuff (torne) - Sunday, 06 June 2010, 13:06 GMT
USB charging should now work on all iPods. Currently, setting USB charging to "on" means it will charge at full speed when connected to a USB host (i.e. a PC). To charge at full speed with an AC adapter, you need to set USB charging to "force". I will investigate how to positively identify the Apple charger in the future.

Loading...