Problem with battery charging

Harald Welte laforge at openmoko.org
Fri Mar 23 02:20:52 CET 2007


On Thu, Mar 22, 2007 at 09:11:13PM +0000, Ian Stirling wrote:
> Harald Welte wrote:
> >On Wed, Mar 21, 2007 at 02:08:04PM +0100, Nils Faerber wrote:
> >>Hi!
> >>I just recognised a little issue with battery charging...
> 
> <snip>
> 
> >With devices up to GTA01Bv3 and the current charger we basically have no
> >way of using a non-usb-host for charging without violating the USB spec.
> >
> >So now we have the choice between USB incompliant 500mA charging (which
> >might in some really bad cases cause damage to the 'usb host' it is
> >attached to.
> 
> I'm pretty sure that the USB spec actually says it's mandatory that 
> stuff shuts down without damage on overload.
> This is my experience too.

I'd have to check again, but IIRC the power on/off switching of
downstream ports is an optional feature, not something that the hub
needs to support.

> >Thus, we'd rather done it the safe way:  Only use 500mA after the USB
> >host has granted us permission to do so.
> >
> >I know that it's almost industry practise to violate this part of the
> >spec.  However, OpenMoko wants to set a good example and adhere to
> >standards :)
> >
> >GTA01Bv4 and the new charger hardware contain circuit changes to address
> >this problem in a usb spec compliant way.
> 
> This is a wrong way to solve this IMO.

The only correct way of solving this ugly overload of USB use is for the
USB Forum to address this issue.

> If the charger is simply a dumb charger, with a host chip or something 
> in it to say "I'm a neo charger", then 

> why on earth should I prefer it over my existing USB charger that has
> UK/EU/US/japan plugs integrated into one comparatively small package.

it is not about you preferring it, but about general standards
compliance and product safety.

You can always use the kernel or u-boot interface to override the
automatic decision, so this is not a problem.

> Also - IIRC - it's been a while, but windows won't actually enable a 
> device to take 500mA without a driver, so you can't plug it into a 
> random PC to charge.

Well, then somebody might come up with a hack that provides a small usb
storage device that's built into the neo (g_storage based), which
contains the respective INF file for RNDIS.

I seriously would never let MS windows charging compatibility overrule
USB spec compatibility or general product safety/quality issues.

> I'd suggest a compromise.
> A host that does not communicate over the USB bus is not a compliant 
> host AIUI.

Well, it might be a host that has crashed.  Just imagine a PC with a
100mA-only capable downstream port (some laptops, e.g., or a bus powered
hub) where the host software has crashed.  

Now you connect your device that immediately draws 500mA, after the host
has not sent a SET_CONFIGURATION in the first couple of seconds.

And there you have your problem.

It is the other way around. A device that draws 500mA before a
SET_CONFIGURATION request has been received is not a compliant device :)

This is the kind of behaviour you get from low-quality products, not
from something like the neo1973.

By the way: Motorola EZX phones have even stricter requirements about
charging (which I think is bad, too).

> If there is power to the port, and the host has not requested our 
> configuration in the first few seconds, then optionally either switch to 
> 'fast charge' mode (unless on last switch to fast charge mode the 
> voltage went away) or pop up a box to the user saying 'do you really 
> want to do this?'

At some point we will have the proper API's for this, so anyone can
write such a program.  In fact, you can probably even now do it via
the legacy apm interface.  As soon as you get charger connect, you echo
"fast_cccv" into the apropriate sysfs entry.

I just don't think that this is a safe default mode, something that a
vendor should enable by default, or actively support

-- 
- Harald Welte <laforge at openmoko.org>          	        http://openmoko.org/
============================================================================
Software for the world's first truly open Free Software mobile phone



More information about the neo1973-hardware mailing list