sudden increase in /sys/class/power_supply/battery/capacity?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

sudden increase in /sys/class/power_supply/battery/capacity?

Timo Juhani Lindfors
Hi,

the "energy" field in

Jan 31 22:35:18 ginger logger: susp.real: resuming (reason EINT09_PMU:rtc_alarm) (temperature 26.1) (consumption 15750) (energy 39)
Jan 31 23:35:19 ginger logger: susp.real: resuming (reason EINT09_PMU:rtc_alarm) (temperature 26.1) (consumption 15750) (energy 39)
Feb  1 00:35:22 ginger logger: susp.real: resuming (reason EINT09_PMU:rtc_alarm) (temperature 24.8) (consumption 11437) (energy 38)
Feb  1 01:35:22 ginger logger: susp.real: resuming (reason EINT09_PMU:rtc_alarm) (temperature 25.3) (consumption 14625) (energy 36)
Feb  1 02:35:25 ginger logger: susp.real: resuming (reason EINT09_PMU:rtc_alarm) (temperature 25.3) (consumption 12187) (energy 34)
Feb  1 03:35:26 ginger logger: susp.real: resuming (reason EINT09_PMU:rtc_alarm) (temperature 25.1) (consumption 12000) (energy 33)
Feb  1 04:35:27 ginger logger: susp.real: resuming (reason EINT09_PMU:rtc_alarm) (temperature 25.1) (consumption 27750) (energy 30)
Feb  1 05:35:29 ginger logger: susp.real: resuming (reason EINT09_PMU:rtc_alarm) (temperature 25.1) (consumption 11625) (energy 30)
Feb  1 06:35:30 ginger logger: susp.real: resuming (reason EINT09_PMU:rtc_alarm) (temperature 25.1) (consumption 12562) (energy 27)
Feb  1 07:35:32 ginger logger: susp.real: resuming (reason EINT09_PMU:rtc_alarm) (temperature 25.1) (consumption 12187) (energy 25)
Feb  1 08:35:34 ginger logger: susp.real: resuming (reason EINT09_PMU:rtc_alarm) (temperature 24.8) (consumption 19312) (energy 24)
Feb  1 09:35:35 ginger logger: susp.real: resuming (reason EINT09_PMU:rtc_alarm) (temperature 24.8) (consumption 23625) (energy 24)
Feb  1 10:35:36 ginger logger: susp.real: resuming (reason EINT09_PMU:rtc_alarm) (temperature 24.8) (consumption 12000) (energy 21)
Feb  1 11:24:10 ginger logger: susp.real: resuming (reason EINT09_PMU:button) (temperature 24.8) (consumption 12000) (energy 21)
Feb  1 11:24:28 ginger logger: susp.real: resuming (reason EINT09_PMU:usb_connect) (temperature 25.3) (consumption 105750) (energy 19)
Feb  1 12:24:25 ginger logger: susp.real: resuming (reason EINT09_PMU:rtc_alarm) (temperature 25.3) (consumption 105750) (energy 19)
Feb  1 12:24:41 ginger logger: susp.real: resuming (reason EINT09_PMU:button) (temperature 30.1) (consumption -374437) (energy 65)

is the contents of /sys/class/power_supply/battery/capacity.

How can it jump from 19% to 65% in just 16 seconds?

As you can see, usb was connected an hour ago but did not seem to
charge the battery even though kernel did say

Feb  1 11:24:30 ginger kernel: [176138.515000] pcf50633 0-0073: usb curlim to 500 mA

bq27k-detail says

                                      RAM Registers
   0x00:         0  CTRL Device Control Register                                     R/W
   0x01:        64  MODE Device Mode Register                                        R/W
0x03 - 0x02:     0    AR At-Rate High - Low Byte                       3.57 µV (1)   R/W
0x05 - 0x04: 65535 ARTTE At-Rate Time-to-Empty High - Low Byte           Minutes      R
0x07 - 0x06:  1215  TEMP Reported Temperature High - Low Byte            0.25 °K      R
0x09 - 0x08:  4011  VOLT Reported Voltage High - Low Byte                  mV         R
   0x0A:       144 FLAGS Status Flags                                                 R
   0x0B:        66  RSOC Relative State-of-Charge                           %         R
0x0D - 0x0C:  3556   NAC Nominal Available Capacity High - Low Byte   3.57 µVh (1)    R
0x0F - 0x0E:  3556  CACD Discharge Compensated NAC High - Low Byte    3.57 µVh (1)    R
0x11 - 0x10:  3556  CACT Temperature Compensated CACD High - Low Byte 3.57 µVh (1)    R
0x13 - 0x12:  5350   LMD Last Measured Discharge High - Low Byte      3.57 µVh (1)    R
0x15 - 0x14:  1456    AI Average Current High - Low Byte               3.57 µV (1)    R
             *3.57 / 20 =  260 mA
0x17 - 0x16: 65535   TTE Time-to-Empty High - Low Byte                   Minutes      R
0x19 - 0x18:   109   TTF Time-to-Full High - Low Byte                    Minutes      R
0x1B - 0x1A:    68    SI Standby Current High - Low Byte               3.57 µV (1)    R
             *3.57 / 20 =  12 mA
0x1D - 0x1C:  3137  STTE Standby Time-to-Empty High - Low Byte           Minutes      R
0x1F - 0x1E: 11136   MLI Max Load Current High - Low Byte              3.57 µV (1)    R
             *3.57 / 20 =  1993 mA
0x21 - 0x20:    16 MLTTE Max Load Time-to-Empty High - Low Byte          Minutes      R
0x23 - 0x22:  1488   SAE Available Energy High - Low Byte             29.2  ÂµV2h (2)  R
             *29.2 / 20 =  2172 mWh
0x25 - 0x24:     0    AP Average Power High - Low Byte                29.2 µV2 (2)    R
             *29.2 / 20 =  2172 mW
0x27 - 0x26: 65535 TTECP Time-to-Empty At Constant Power High-Low Byte   Minutes      R
0x29 - 0x28:    35  CYCL Cycle Count Since Learning Cycle High-Low Byte  Cycles       R
0x2B - 0x2A:   257  CYCT Cycle Count Total High - Low Byte               Cycles       R
   0x2C:        66  CSOC Compensated State-of-Charge                        %         R

EEPROM Registers
0x2D - 0x6D     - RESERVED                                                                R
   0x6E:         0 EE_EN EEPROM Program Enable                                       R/W
0x6F - 0x75     - RESERVED                                                         R
   0x76:        27  ILMD Initial Last Measured Discharge High Byte     914  ÂµVh (1)  R/W
   0x77:     *0x100 * 3.57 / 20 =  1237 mAh fabcoded cell capacity
0x21 - 0x      194 SEDVF Scaled EDVF Threshold                                       R/W
             +0x100)*8 =  3600 mV (@ 0%)
   0x78:       199 SEDV1 Scaled EDV1 Threshold                                       R/W
             +0x100)*8 =  3640 mV (@ 6.25%)
0x2D - 0x6D     - RESERVED                                                         R
   0x79:        25  ISLC Initial Standby Load Current                  7.14 µV (1)   R/W
             *7.14 / 20 =  8 mA
   0x7A:        56 DMFSD Digital Magnitude Filter and Self-Discharge Rate Constants  R/W
   0x7B:       137 TAPER Aging Estimate Enable, Charge Termin. Taper I  228 µV (1)   R/W
   0x7C:        99 PKCFG Pack Configuration Values                                   R/W
   0x7D:        87  IMLC Initial Max Load Current, OR, ID#3             457  ÂµV (1)  R/W
   0x7E:        66 DCOMP Discharge Rate Compensation Constants, OR, ID#2             R/W
   0x7F:       124 TCOMP Temperature Compensation Constants, OR, ID#1                R/W

(1) Divide by Rs in milliohms to convert µV to mA or µVh to mAh.  
(2) Divide by Rs in milliohms to convert µV2 to mW or µV2h to mWh.


As you can see the consumption reading is exactly the same at 11:24:28
and 12:24:25 -- is something caching the values? Where? How many times
do I need to read the value to get the real value?