<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Radek,<div><br><div><div>Am 08.09.2013 um 19:00 schrieb Radek Polak:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi,<br>attached is shell script and log from my GTA04. I just left GTA04 on USB of my <br>computer. Expected result is that it should keep charging/discharging. Actual <br>result is that it discharged to 0. Does the log help somehow? Otherwise i was <br>quite busy but i plan to test the changes suggested by Neil.<br><br>Regards<br><br>Radek<br><span><charging.txt></span><span><charging.sh></span></div></blockquote><div><br></div><div>You could use this script which does the same but a little more elaborated:</div><div><br></div><div><a href="http://git.goldelico.com/?p=gta04-rootfs.git;a=blob;f=debian/config/root/batt;h=07cc6aad1ba330e8ea67484970c8197a5b68a644;hb=HEAD">http://git.goldelico.com/?p=gta04-rootfs.git;a=blob;f=debian/config/root/batt;h=07cc6aad1ba330e8ea67484970c8197a5b68a644;hb=HEAD</a></div><div><br></div><div>There you can also see the influence of VBUS.</div><div><br></div><div>But it is already clear what happens from these lines:</div><div><br></div><div>==============================================<br>Thu Sep  5 17:45:32 CEST 2013<br>cat /sys/bus/platform/devices/twl4030_usb/vbus<br>on<br>cat /sys/class/power_supply/twl4030_usb/uevent <br>POWER_SUPPLY_NAME=twl4030_usb<br>POWER_SUPPLY_STATUS=Charging<br>POWER_SUPPLY_ONLINE=1<br><font class="Apple-style-span" color="#f81919">POWER_SUPPLY_VOLTAGE_NOW=4406892<br></font>POWER_SUPPLY_CURRENT_NOW=486087<br>cat /sys/class/power_supply/bq27000-battery/uevent<br>POWER_SUPPLY_NAME=bq27000-battery<br>POWER_SUPPLY_STATUS=Full<br>POWER_SUPPLY_PRESENT=1<br>POWER_SUPPLY_VOLTAGE_NOW=4174000<br>POWER_SUPPLY_CURRENT_NOW=-92284<br>POWER_SUPPLY_CAPACITY=100<br>POWER_SUPPLY_CAPACITY_LEVEL=Full<br>POWER_SUPPLY_TEMP=363<br>POWER_SUPPLY_TIME_TO_FULL_NOW=0<br>POWER_SUPPLY_TECHNOLOGY=Li-ion<br>POWER_SUPPLY_CHARGE_FULL=1097953<br>POWER_SUPPLY_CHARGE_NOW=1097953<br>POWER_SUPPLY_CHARGE_FULL_DESIGN=1233792<br>POWER_SUPPLY_CYCLE_COUNT=18<br>POWER_SUPPLY_ENERGY_NOW=3946380<br>POWER_SUPPLY_POWER_AVG=0<br>POWER_SUPPLY_HEALTH=Good<br>==============================================<br>Thu Sep  5 17:46:32 CEST 2013<br>cat /sys/bus/platform/devices/twl4030_usb/vbus<br>on<br>cat /sys/class/power_supply/twl4030_usb/uevent <br>POWER_SUPPLY_NAME=twl4030_usb<br><font class="Apple-style-span" color="#f81919">POWER_SUPPLY_STATUS=Not charging<br></font>POWER_SUPPLY_ONLINE=0<br>cat /sys/class/power_supply/bq27000-battery/uevent<br>POWER_SUPPLY_NAME=bq27000-battery<br>POWER_SUPPLY_STATUS=Discharging<br>POWER_SUPPLY_PRESENT=1<br>POWER_SUPPLY_VOLTAGE_NOW=4115000<br>POWER_SUPPLY_CURRENT_NOW=372886<br>POWER_SUPPLY_CAPACITY=100<br>POWER_SUPPLY_CAPACITY_LEVEL=Normal<br>POWER_SUPPLY_TEMP=363<br>POWER_SUPPLY_TIME_TO_EMPTY_NOW=10440<br>POWER_SUPPLY_TIME_TO_EMPTY_AVG=9780<br>POWER_SUPPLY_TECHNOLOGY=Li-ion<br>POWER_SUPPLY_CHARGE_FULL=1097953<br>POWER_SUPPLY_CHARGE_NOW=1095990<br>POWER_SUPPLY_CHARGE_FULL_DESIGN=1233792<br>POWER_SUPPLY_CYCLE_COUNT=18<br>POWER_SUPPLY_ENERGY_NOW=4207720<br>POWER_SUPPLY_POWER_AVG=397296<br>POWER_SUPPLY_HEALTH=Good<br>==============================================</div><div><br></div><div>Essentially it shows that your USB charging voltage is too low. It should</div><div>be ~5V. Maybe you are drawing too much current from the charger or</div><div>the cable is weak.</div><div><br></div><div>There is a comparator in the TWL-usb-chager hardware set at fixed</div><div>4.5V that turns off the charger if VBUS goes below.</div><div><br></div><div>Software only turns on the charger if you manually unplug USB and replug</div><div>because only then, you get an MUSB event that enables charging.</div><div><br></div><div>There have been heavy discussions last year that this behaviour is right,</div><div>i.e. that you battery drains even if connected to USB and that we can't</div><div>do anything...</div><div><br></div><div>The main argument is that this is a safety comparator detecting USB</div><div>unplugging even if the CPU isn't. And if the CPU would override that</div><div>(which is easily done - I had discussed and tested a patch), there is a</div><div>risk of overcharging the battery.</div><div><br></div><div>BR,</div><div>Nikolaus</div><div><br></div></div></div></body></html>