Difference between revisions of "BQ27x00"
From ArmadeusWiki
m |
m (→Driver installation) |
||
Line 5: | Line 5: | ||
==Driver installation== | ==Driver installation== | ||
<pre class="host"> | <pre class="host"> | ||
− | $ make | + | $ make linux-menuconfig |
</pre> | </pre> | ||
Revision as of 17:08, 4 September 2013
How to use the BQ27x00 battery gas gauge.
Before trying to use the driver, the plateform file (ex apf27-dev.c) has to be correctly modified to support the BQ27200 I2C chip.
Driver installation
$ make linux-menuconfig
Device Drivers---> <M> Power supply class support ---> <M> BQ27200 battery driver
$ make
Update the APF27 board with the new Linux kernel and rootfs.
Usage
- Load the module:
modprobe bq27x00_battery
- Read internal temperature:
cat /sys/class/power_supply/bq27200-0/temp
- Read battery voltage:
cat /sys/class/power_supply/bq27200-0/voltage_now
- Read battery current:
cat /sys/class/power_supply/bq27200-0/current_now
Remark: the result (mA) has to be scaled depending on the shunt resistor (typically 0.2 0hms). The formula is then: result*3.57/20.
- Read capacity:
cat /sys/class/power_supply/bq27200-0/capacity
Remark: the capacity can only be estimated after a complete discharge/charge cycle. See BQ27200 datasheet for more informations.