View Single Post
joerg_rw's Avatar
Posts: 2,222 | Thanked: 12,651 times | Joined on Mar 2010 @ SOL 3
#1371
BATTERY GAUGE CHIP BQ27200 SEMI-AUTOMATIC CALIBRATION

for your convenience: http://maemo.cloud-7.de/maemo5/patch...brate-bq27k.sh automatic calibration script for bq27200 chip.

(serving suggestion:
Code:
root
cd $(dirname $(which bq27200.sh)); 
wget http://maemo.cloud-7.de/maemo5/patches_n_tools/calibrate-bq27k.sh;
chmod +x calibrate-bq27k.sh
)

HOW TO USE:
There are two slightly different modes to use this:
  • first plug in wallcharger, then start the script
    will start charging battery on plugin of charger, and script waits untill battery full and VDQ:1, before the discharging begins (tested)
  • first start the script, then plug in wallcharger
    the script, when finding a valid discharge process (VDQ:1) in progress, will try to stop charging (also emergency charging aka flatbatrecover) and continue to DIScharge battery until the learning cycle complete. Advantage: faster. Tested to work by Kerio

You will need bq27200.sh (also here, plain file) installed (incl i2ctools) - quite probably you already have that otherwise why would you want to calibrate bq27200 chip ;-)
and you need to cd to the directory where bq27200.sh lives, before starting the calibrate-bq27k.sh script (the script calls ./bq27200.sh).

The script will
  • charge battery until full (actually until VDQ:1), then
  • switch off charging (stop bme) and
  • discharge battery until
  • learning cycle complete (EDV1:1), when it will
  • re-enable charging by starting bme.
For proper unattended discharging/calibrating during you're asleep in the night, you want to set screen backlight to 'always on' and level 5 (will result in discharge during ~4h).
Don't feel shocked when BME starting charging - after learning cycle - will leave device completely dark - some even think it's not something exactly inconvenient. Just engage lockslider 2 times to 'revive' your acting dead device ;-) (or un-comment last line in calibrate-bq27k.sh which restarts mce and thus as well reverts backlight to normal operation)

PS: you'll probably need root for all of the above

enjoy
/jOERG

ps: you may want to check for improved or bugfixed script versions every now and then. I won't announce every minor update here.
__________________
Maemo Community Council member [2012-10, 2013-05, 2013-11, 2014-06 terms]
Hildon Foundation Council inaugural member.
MCe.V. foundation member

EX Hildon Foundation approved
Maemo Administration Coordinator (stepped down due to bullying 2014-04-05)
aka "techstaff" - the guys who keep your infra running - Devotion to Duty http://xkcd.com/705/

IRC(freenode): DocScrutinizer*
First USB hostmode fanatic, father of H-E-N

Last edited by joerg_rw; 2012-08-06 at 16:10.
 

The Following 6 Users Say Thank You to joerg_rw For This Useful Post: