Rockbox Technical Forums

Rockbox Development => Starting Development and Compiling => Topic started by: yapper on August 16, 2008, 09:34:19 AM

Title: How does charger detection get to the WPS?
Post by: yapper on August 16, 2008, 09:34:19 AM
On the 2G iPod, the charger connection doesn't appear to be detected. It was (still is?) a problem on the 4G (FS#5826 - no "charger status" in iPod 4g Gray) too.

I've worked out the GPIO inputs to monitor to detect external power, but I don't know what mechanism is used to pass this info to the WPS to allow the charger status to be displayed.

Can someone offer some pointers?
Title: Re: How does charger detection get to the WPS?
Post by: mcuelenaere on August 16, 2008, 11:39:38 AM
Try firmware/target/arm/ipod/power-ipod.c (http://svn.rockbox.org/viewvc.cgi/trunk/firmware/target/arm/ipod/power-ipod.c?revision=18066&view=markup)
Title: Re: How does charger detection get to the WPS?
Post by: yapper on August 17, 2008, 11:11:08 AM
Thanks for that. I've now got charger detection showing on the 2G WPS.

I also had to change config-ipod1g2g.h to #define CONFIG_CHARGING, but I'm not sure if CHARGING_MONITOR or CHARGING_SIMPLE is also required. Currently I'm using CHARGING_MONITOR.

What I can't find is a way to detect 'charging in progress' - again any pointers welcomed!  :)
Title: Re: How does charger detection get to the WPS?
Post by: mcuelenaere on August 17, 2008, 11:13:23 AM
...
What I can't find is a way to detect 'charging in progress' - again any pointers welcomed!  :)
Did you already try 'bool charging_state(void)' in the same file?

BTW if you get it working, don't forget to post a patch in the Flyspray tracker so it can be committed to SVN.
Title: Re: How does charger detection get to the WPS?
Post by: yapper on August 17, 2008, 12:20:03 PM
Did you already try 'bool charging_state(void)' in the same file?
Yes - I can force the 'charging' indication to appear on the WPS.
GPIOB bits 6 and 7, and GPIOC bit 7 all seem to indicate charger connected, but I can't see which GPIO bit indicates 'charging'.

BTW if you get it working, don't forget to post a patch in the Flyspray tracker so it can be committed to SVN.
Sure - I will.
Title: Re: How does charger detection get to the WPS?
Post by: saratoga on August 17, 2008, 12:28:20 PM
Isn't charging handled by the PCF50605 chip on the 2G?  I assume you'd get the status of that over I2C.
Title: Re: How does charger detection get to the WPS?
Post by: yapper on August 17, 2008, 12:38:51 PM
I think that is true of the 3G, but the 1G (and 2g?) apparently uses an LTC1731, which has a simple active low 'charging' IO pin.

http://electronicdesign.com/Articles/Index.cfm?AD=1&ArticleID=9500&pg=2

EDIT: The patch for detection of charger connection is here: http://www.rockbox.org/tracker/task/9295