[Gta04-owner] Sporadic USB charging issue identified

Dr. H. Nikolaus Schaller hns at goldelico.com
Tue Feb 19 09:25:07 CET 2013

Hi Neil,

Am 19.02.2013 um 00:29 schrieb NeilBrown:

--- snip --

>>> Why would you want to clear VBUSUNPLGEN?  When the docs explicitly say it
>>> must be set....
>> Where?
> Same section that you were  reading:
>   In the hardware method, the VBUS comparator must be kept enabled by setting
>   the BCIMFSTS4[5] VBUSUNPLGEN bit to 1. 
>> Section
>> "In software mode, the VBUS comparator is disabled by setting the VBUSUNPLGEN bit to 0. The software detects that the USB device is unplugged and stops charging. The USB charge is stopped by forcing the USBFASTMCHG and USBSLOWMCHG bits to 0."
>> The patch above works a little different, by disabling the charger through setting TWL4030_BCIAUTOUSB to 0.
> The hardware is designed to either have hardware-driven monitoring or
> software driven monitoring.  You seem to want to leave it up to the hardware,

No, I don't want to change charging monitoring (i.e. the charging curves etc.).

> but to disable one little decision that it makes.  This doesn't seem safe to
> me.

I want to leave charging to the hardware (BCIAUTO=1) but not the decision
when to stop (VBUSUNPLGEN=0).

Since it is already a complete software decision to start charging.

Basically I want to see that there are not two plug/unplug detectors (one in the
charger and one in the OTG system) with different detection levels and nobody
cares about contradicting status.

> It isn't necessarily clear what all the consequences of clearing that bit
> without doing any monitoring are.  If the charger is left enabled while the
> USB voltage is too low, could there be some current backflow that might cause
> problems?

Ok, I see what you mean. In the scenario I have tested (unplugging and
replugging USB for a very short time frame or a weak USB plug or a too
long cable and switching noise), there is nothing where some current can
backflow to.

But you are right, we can construct a problematic scenario. If we assume someone
connects an external battery box to USB and that battery is drained to
let's say 3V (I don't know the threshold of the OTG), the OTG port will still
detect that something is connected and would keep the charger enabled.

In that case it can not be excluded that the GTA04 battery is charging the box...

So the result would be that you end up in an empty battery some minutes

> I barely trust hardware where  you program it exactly according to the
> documentation.  If you try something that the documentation seems to say is
> not allowed, I stop trusting it altogether :-)

I don't read that in a way that it says "it is not allowed".

I read it in a way that you can decide to use hardware control or software
control of VBUS detection. And if you want hardware control you must set
that bit (or don't reset it).

This discussion IMHO reads almost the same as:


And I think we already were close to this point:


(see PS: at the end of the posting).

So how do we get a good solution into the drivers?


More information about the Gta04-owner mailing list