Take a look at our
ThinkPads.com HOME PAGE
For those who might want to contribute to the blog, start here: Editors Alley Topic
Then contact Bill with a Private Message

[T450] Battery erratic behaviour need probably to reflash EC firmware

T430-T490, T530-T590 Series
Post Reply
Message
Author
Th1kCh3ck
Posts: 14
Joined: Wed Jul 22, 2020 5:23 am
Location: Paris, France

[T450] Battery erratic behaviour need probably to reflash EC firmware

#1 Post by Th1kCh3ck » Wed Jul 22, 2020 7:31 am

First time, I'm posting something here, apologies for anything wrong with the formatting.

Hey all, it's a long story, but basically after having enabled the battery threshold feature on Linux using TLP with two batteries (one internal and external).

I have been getting charging issues and I removed the internal battery thinking that was kinda of the root of the issue since it was non-official.

My issue is that the external battery is not charging after almost a full charge ( after hours and hours of being in charge, the state of the battery changes to unknown on Linux and on Windows says it's plugged, not charging usually around 90-95%) unless I physically unplug & replug the battery from the computer (Plug & Unplug AC doesn't change anything, rebooting neither).
Even if I uplug and replug the battery, only the battery state changes from not charging to charging, the battery does not charge up more than where she stopped at.

I have two external batteries, one official 24Wh (45N1124 / FRU 45N1775) from Lenovo which has around 400 cycle counts and an unofficial one I bought which is 48Wh (45N1734).
I use only the unofficial one so far.

The external battery also drops from 40% to 5% kind of instantly.
I disabled the Battery threshold first on Linux, disabled and uninstalled TLP but it held no success.

I thus went on to install Windows and Lenovo Vantage to check if the battery threshold was indeed deactivated, I needed also Windows to easily flash a new version of the BIOS (I was hoping that flashing a new BIOS would also flash the EC (Embedded Controller) but I think I ran out of luck).

Checking for the option in Lenovo Vantage showed it was disabled. But then I don't really understand why when trying to fully charge the battery the computer starts slowly lowering the energy-rate/wattage given to the battery the more the battery gets closer to 100% (I have never gotten to 100% so far) as well as the time expected to get the battery full going over 5-6 hours when getting at 90%, whilst while beginning to charge it is like 1 or 2 hours which seems much more normal.

Battery gauge reset does not work in Lenovo Vantage and shows an "Error : failed unexpectedly".

I tried to plug the official external battery and see if there was any change.
So I shut down the computer, unplug AC, plug official external battery, startup the computer on Windows and I see that the Charge threshold is active for the battery in Lenovo Vantage which is leading me to believe that the charge threshold is active even when it isn't supposed to be.

If I do the same procedure with my unofficial battery, the charge threshold shows up as active as well with values at start charging when below 90% and stops at 100% (and every time I disable it there is literally no changes).

I read on the https://linrunner.de/tlp/faq/battery.ht ... ter-models that some people had issues such as mine.

But what I also saw afterwards https://linrunner.de/tlp/faq/battery.ht ... s-not-work was my doom, it is also stated that for people who cannot deactivate the battery threshold, it is needed to flash/update the EC firmware (The workaround without BIOS update does not work despite all my attempts).

My question here is, is it possible to kind of force flash the same EC firmware version again ? (If yes, how should I proceed ? If anyone has a clue) Did anyone ever try to do that ?
Flashing a new BIOS version didn't seem to flash the EC firmware again (because only the BIOS needed an update when I got the laptop, no updates were made to the EC firmware since 2016 according to the text file information of BIOS updates at https://support.lenovo.com/mo/fr/downloads/ds102109).

If it is not possible, then is it safe to downgrade to an older BIOS/EC firmware, it would be downgrading from 2019 to 2016, and I'm not sure if it would fail and brick the laptop, I'm also thinking what if the downgrade is successful but then upgrading back from 2016 to 2019 would fail unexpectedly.

I've been wanting to try to read exactly the EC registers that stores maybe some data that could be saying if the threshold is definitely set or not. Maybe I should investigate how TLP sets the battery threshold and how it talks with the correct drivers that actually writes to the EC registers.

This problem I'm facing is a bit hard to describe because there is a lot of issues that happens with just one battery.

TL;DR Activated battery threshold on Linux with TLP, cannot deactivate anymore, probable fix is flashing EC firmware, battery percentage going from 40% to 5% instantly, battery when having been plugged and being in charge for awhile (6-9 hours) does not charge anymore unless the battery is physically unplugged & replugged.

atagunov
Senior Member
Senior Member
Posts: 921
Joined: Thu Apr 02, 2020 3:11 pm
Location: London, UK

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#2 Post by atagunov » Wed Jul 22, 2020 11:40 am

It's interesting that you posted this around the same time I had this conversation with TLP author: issue 509. You may also wish to have a look at issue 508.

Meanwhile why don't we 4-eye what you're doing. What you have written is a bit complicated :) So let us choose one battery. Whichever you are more interested in. Can you please post the output of "tlp-stat -b" for that battery? What behaviour are you seeing now with that battery only? Let us skip any history of what happened before to keep the discussion concise and focused.

Unfortunately I don't know if there is a way to force-flash EC. I don't even know if EC firmware is sitting in the same EEPROM as BIOS. For BIOS EEPROM we have this process with an external programmer. But for EC?.. I'd be interested to know myself.
X220, 2 *T520

Th1kCh3ck
Posts: 14
Joined: Wed Jul 22, 2020 5:23 am
Location: Paris, France

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#3 Post by Th1kCh3ck » Wed Jul 22, 2020 12:52 pm

Hi, there yeah it seems to be interesting indeed, I'm not the only one with issues from battery threshold and EC trickery.

Here is my output on tlp-stat -b for the unofficial battery that is currently in a unknown state despite AC being plugged in.

Code: Select all

--- TLP 1.3.1 --------------------------------------------

+++ Battery Features: Charge Thresholds and Recalibrate
natacpi    = active (data, thresholds)
tpacpi-bat = active (recalibrate)
tp-smapi   = inactive (ThinkPad not supported)

+++ ThinkPad Battery Status: BAT1 (Ultrabay / Slice / Replaceable)
/sys/class/power_supply/BAT1/manufacturer                   = SANYO
/sys/class/power_supply/BAT1/model_name                     = 45N1734
/sys/class/power_supply/BAT1/cycle_count                    = (not supported)
/sys/class/power_supply/BAT1/energy_full_design             =  47520 [mWh]
/sys/class/power_supply/BAT1/energy_full                    =  47520 [mWh]
/sys/class/power_supply/BAT1/energy_now                     =  44510 [mWh]
/sys/class/power_supply/BAT1/power_now                      =      0 [mW]
/sys/class/power_supply/BAT1/status                         = Unknown

/sys/class/power_supply/BAT1/charge_start_threshold         =     96 [%]
/sys/class/power_supply/BAT1/charge_stop_threshold          =    100 [%]
tpacpi-bat.BAT1.forceDischarge                              =      0

Charge                                                      =   93.7 [%]
Capacity                                                    =  100.0 [%]
It looks like that the default threshold are set.

If I unplug the battery and replug it right now the state will change to charging but it won't go much up as 95% over a few hours and then at some point it will switch to the unknown state again.
Notice also that the power_now is at 0mW I'm not sure if that's entirely normal.

So far, the furthest I could investigate is after dumping the ACPI tables using acipdump and decompile the AML (ACPI Machine language) into ASL (ACPI source language) using iasl, I had a look at the ACPI tables (namely the DDSDT table) that contains functions about both batteries but couldn't understand a lot since I'm not very fluent in ASL.
I started logging ACPI events on Linux, but the only events I saw were battery status changes, that are notified to the system (probably by the EC), there is no information about what event caused the notification so it's kinda of some guess work (like when the battery hits 80%, or is below 20%).

I've found the chip that holds the EC firmware on my motherboard is an MEC1633L-AUE, with a bit of luck I found the datasheet online http://www.datasheetcatalog.com/datashe ... -AUE.shtml and I would say that at least for this chip precisely, it has an EEPROM of it's own, the BIOS is in another chip I believe.

The datasheet of this EC chip mentions also something about JTAG being present that I think could be used for flashing firmware or extracting firmware from the memory inside the chip (to verify for instance if it's corrupted by comparing sha1sums from the EC firmware in the Lenovo BIOS update that is currently installed) but I'm really a beginner to hardware flashing so I don't really know how one would proceed or if it's even doable.

I don't know if anyone tried to actually flash an EC firmware using an external programmer before but it would be very interesting to me to know if yes and how it went.

atagunov
Senior Member
Senior Member
Posts: 921
Joined: Thu Apr 02, 2020 3:11 pm
Location: London, UK

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#4 Post by atagunov » Wed Jul 22, 2020 4:53 pm

I will probably drown your very sensible questions about flashing EC directly.. but in case this is of any help here's the output I'm getting on my hopefully healthy T520

Code: Select all

$ cat /sys/class/power_supply/BAT0/status
Unknown
$ cat /sys/devices/platform/smapi/BAT0/state
idle
$ sudo tlp-stat -b
--- TLP 1.3.1 --------------------------------------------

+++ Battery Features: Charge Thresholds and Recalibrate
natacpi    = active (thresholds)
tpacpi-bat = active (recalibrate)
tp-smapi   = readonly (data)

+++ ThinkPad Battery Status: BAT0 (Main / Internal)
/sys/devices/platform/smapi/BAT0/manufacturer               = LGC
/sys/devices/platform/smapi/BAT0/model                      = 42T4969
/sys/devices/platform/smapi/BAT0/manufacture_date           = 2011-12-13
/sys/devices/platform/smapi/BAT0/first_use_date             = 2012-07-11
/sys/devices/platform/smapi/BAT0/cycle_count                =     32
/sys/devices/platform/smapi/BAT0/temperature                =     38 [°C]
/sys/devices/platform/smapi/BAT0/design_capacity            =  86580 [mWh]
/sys/devices/platform/smapi/BAT0/last_full_capacity         =  73740 [mWh]
/sys/devices/platform/smapi/BAT0/remaining_capacity         =  59910 [mWh]
/sys/devices/platform/smapi/BAT0/remaining_percent          =     81 [%]
/sys/devices/platform/smapi/BAT0/remaining_running_time_now = not_discharging [min]
/sys/devices/platform/smapi/BAT0/remaining_charging_time    = not_charging [min]
/sys/devices/platform/smapi/BAT0/power_now                  =      0 [mW]
/sys/devices/platform/smapi/BAT0/power_avg                  =      0 [mW]
/sys/devices/platform/smapi/BAT0/state                      = idle

/sys/class/power_supply/BAT0/charge_start_threshold         =     62 [%]
/sys/class/power_supply/BAT0/charge_stop_threshold          =    100 [%]
tpacpi-bat.BAT0.forceDischarge                              =      0

Charge                                                      =   81.2 [%]
Capacity                                                    =   85.2 [%]
One thing that has caught my eye in your message was "tp-smapi = inactive (ThinkPad not supported)". Is it really not supported on T450?.. I don't have a clue but here's the software I got installed

Code: Select all

$ cat /etc/issue
Ubuntu 20.04 LTS \n \l

$ apt list --installed | grep '\(tlp\|smapi\|acpi\|smartmon\)'

...

acpi-call-dkms/focal,focal,now 1.1.0-5 all [installed]
acpi-support/focal,now 0.143 amd64 [installed,automatic]
acpid/focal,now 1:2.0.32-1ubuntu1 amd64 [installed,automatic]
smartmontools/focal,now 7.1-1build1 amd64 [installed]
tlp-rdw/focal,focal,now 1.3.1-2 all [installed]
tlp/focal,focal,now 1.3.1-2 all [installed]
tp-smapi-dkms/focal,focal,now 0.43-1 all [installed]
And here's how I installed it

Code: Select all

sudo add-apt-repository ppa:linrunner/tlp
apt-get install tlp tp-smapi-dkms acpi-call-dkms smartmontools linux-tools-generic powertop
This PPA has no bearing for Ubuntu 20.04 (focal) as it only has packages for 18.04 (bionic). So I could have skipped first line on 20.04. But things worked just fine for me with similar installation on 18.04.4 too. BTW here's another easy test on how a healthy battery charged to 83% behaves: https://i.imgur.com/6Xp6r0k.jpeg (Just don't short it! No idea what happens if you do.. for all we know it could blow the non-resettable fuse.)

So once you unplug power adapter from your T450 does it refuse to run on this battery? Switches off immediately as if the battery was not there? (Ouch, it's a T450, with a built-in batt.. how's that one?)

P.S. before assuming EC is bad I would also consider the possibility something is physically wrong with the motherboard.. Some FET transistor blown or such..
P.P.S. I don't think it will really help you but for what it's worth I decided I wanted to be able to "talk" to batteries directly, so I've ordered a CP2112 board from AliExpress £4 with the intention to use Demo version of http://be2works.com/
Here's a video of a guy using it.. unfortunately it's in Russian, but you can see the screens of the app there in the end. The app can do a lot, but the most basic stuff it can do is to query battery about it's status: are you Ok? Are any error flags set? What is your current charge? Full capacity? Design capacity? That info comes up in the left half of the screen in the video. In order to make any changes - say reset those error flags battery controller got to be put into "Unsealed" mode and that is when stuff gets trickly. That is when you may need non-demo version - licensed or otherwise. "Otherwise" is particularly tricky.. like requires Win XP 32bit w/o connection to internet and perhaps best on an old Pentium etc.. But just querying the status is an operation defined by standards, so trivial and can be done with the Demo version. Alternatively there are some open-source projects around Arduino, around Raspberry Pi, around Cypress FX2LP (aka CY7C68013A) (this one) to also talk to the battery but this closed-source app is probably most ergonomic. One got to "lock" USB id-s on CP2112 before using it because some versions of that app mess up these ids and make it unusable.
X220, 2 *T520

Th1kCh3ck
Posts: 14
Joined: Wed Jul 22, 2020 5:23 am
Location: Paris, France

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#5 Post by Th1kCh3ck » Wed Jul 22, 2020 6:52 pm

Thanks for your output of tlp.

According to this issue issues 160 the T450 is indeed not supported by tp_smapi.

Here is what I have on my distribution that is not very different from Ubuntu 20.04 (focal), it's kinda of based on Ubuntu, there are a few changes.

Code: Select all

cat /etc/issue
 Pop!_OS 20.04 LTS \n \l
Trying to check the actual packages instead it seems we have the same versions I believe.

Code: Select all

acpi-call-dkms/focal,focal,now 1.1.0-5 all [installed]
acpi-support/focal,now 0.143 amd64 [installed,automatic]
acpi/focal,now 1.7-1.1 amd64 [installed]
acpica-tools/focal,now 20190509-1 amd64 [installed]
acpid/focal,now 1:2.0.32-1ubuntu1 amd64 [installed,automatic]
system76-acpi-dkms/focal,now 1.0.1~1594068101~20.04~54ac52e amd64 [installed]
tlp-rdw/focal,focal,now 1.3.1-2 all [installed,automatic]
tlp/focal,focal,now 1.3.1-2 all [installed]
tp-smapi-dkms/focal,focal,now 0.43-1 all [installed]
In the image where you're testing the voltage of the battery you used some kind of thin metal cable inside the specific positive pin input and ground pin input of the battery, that's a great idea I didn't think of that, my multimeter probes wouldn't fit in the tiny area, thanks for showing me the way I think I'll try this out too.

I don't know if there is a specific relationship between voltage of the battery and the percentage, I could have a more precise idea what happens when the computer shows that the battery goes from 40% to 5% (the voltage reported to the system also drops a little).

I have removed the internal battery after that I started having all the issues I'm trying to describe here mainly because there were some real weird issues with it too.

Once I unplug the power adapter, the computer runs on the battery and the state goes from "unknown" to "discharging".

If I plug the power adapter back again, state goes from "discharging" to "unknown".

Once my external battery hits kind of 40%-37%, it drops kinds of instantly to 5%.
I've made a quick bash script that logs in some battery data periodically (from /sys/class/power_supply/BAT1/uevent and a utility called upower) every x minutes/seconds/hours.

Code: Select all

# time format is in 24h
Entry in logs made: 2020-07-21 15:51:13


  native-path:          BAT1
  vendor:               SANYO
  model:                45N1734
  serial:               15921
  power supply:         yes
  updated:              mar. 21 juil. 2020 15:50:01 (72 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               discharging
    warning-level:       none
    energy:              19.37 Wh
    energy-empty:        0 Wh
    energy-full:         47.52 Wh
    energy-full-design:  47.52 Wh
    energy-rate:         9.273 W
    voltage:             10.385 V --> voltage was ~10.4V before big drop.
    time to empty:       2.1 hours
    percentage:          40%
    capacity:            100%
    technology:          lithium-ion
    icon-name:          'battery-good-symbolic'
  History (charge):
    1595339401	40.000	discharging
  History (rate):
    1595339401	9.273	discharging

POWER_SUPPLY_NAME=BAT1
POWER_SUPPLY_STATUS=Discharging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=10800000
POWER_SUPPLY_VOLTAGE_NOW=10276000
POWER_SUPPLY_POWER_NOW=9330000
POWER_SUPPLY_ENERGY_FULL_DESIGN=47520000
POWER_SUPPLY_ENERGY_FULL=47520000
POWER_SUPPLY_ENERGY_NOW=19160000
POWER_SUPPLY_CAPACITY=40
POWER_SUPPLY_CAPACITY_LEVEL=Normal
POWER_SUPPLY_MODEL_NAME=45N1734
POWER_SUPPLY_MANUFACTURER=SANYO
POWER_SUPPLY_SERIAL_NUMBER=15921


 Entry in logs made : 2020-07-21 15:55:00

  native-path:          BAT1
  vendor:               SANYO
  model:                45N1734
  serial:               15921
  power supply:         yes
  updated:              mar. 21 juil. 2020 15:54:49 (11 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               discharging
    warning-level:       low
    energy:              2.78 Wh
    energy-empty:        0 Wh
    energy-full:         47.52 Wh
    energy-full-design:  47.52 Wh
    energy-rate:         9.836 W
    voltage:             9.778 V --> voltage dropped from 10.4V to 9.77V after few minutes.
    time to empty:       17.0 minutes
    percentage:          5%
    capacity:            100%
    technology:          lithium-ion
    icon-name:          'battery-caution-symbolic'
  History (charge):
    1595339659	5.000	discharging
  History (rate):
    1595339689	9.836	discharging
    1595339659	10.028	discharging
    1595339641	14.043	discharging
When I'm running at 0% of battery the computer takes then at least 5-7 minutes to shutdown.

I'm definitely interested to take a look at getting some of the hardware that you mentioned would allow to query more directly the battery as this could help me further investigate, I don't think I'll need to reset any specific flags or modify the preset values of the battery (so most probably the "sealed mode" will be enough.
I may have to go with the open-source software since I've got a bunch of Raspberry Pi's lying around.
P.S. You could be right that the EC is not at fault and it might be something else that's wrong with the motherboard, I haven't seen anything peculiar last time I opened up the computer but I haven't had a thorough look and tore apart everything.
P.S.S. I've seen that a logic analyzer and some software can be used to sniff the communication between the computer and the battery with enough luck and fiddling, here is an interesting blog post and also a Youtube talk given by the battery hacker about his steps to successfully hack the EC on a Thinkpad x230T to charge non-whitelisted batteries and boy it was quite an adventure I think.

Keep me updated if you ever get to have more information using the CP2112 (it's an SMBus to USB kind of device, I think that the battery uses mainly the SMBus protocol to discuss with the computer).

atagunov
Senior Member
Senior Member
Posts: 921
Joined: Thu Apr 02, 2020 3:11 pm
Location: London, UK

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#6 Post by atagunov » Wed Jul 22, 2020 8:21 pm

Th1kCh3ck wrote:
Wed Jul 22, 2020 6:52 pm
In the image where you're testing the voltage of the battery you used some kind of thin metal cable inside the specific positive pin input and ground pin input of the battery, that's a great idea I didn't think of that, my multimeter probes wouldn't fit in the tiny area, thanks for showing me the way I think I'll try this out too.
:-D I was looking for something suitable and decided I have too many diodes. So I broke one leg off one and used as a probe. You can see the diode still attached to the other leg! Not really great, they are kind of too thin to sit there snugly but at least they don't damage the battery. I was trying really hard not to short them too!
Th1kCh3ck wrote:
Wed Jul 22, 2020 6:52 pm
I don't know if there is a specific relationship between voltage of the battery and the percentage
There is. You can just look up "battery discharge graph" on any search engine online and you'll see plenty of them. They all have approximately same shape. 6 cell batteries for notebooks are all like this. 3 groups of 2 batteries each. Groups of 2 have those two in parallel. Then you connect 3 of them sequentially. Well photo says it all (not my photo). 9 cell batteries are also the similar. Only have 3 groups of 3 cells. Only found a video. Too lazy to photo the one I have opened just for exploration.. It's same. So max voltage is around 4.2 or 4.35 per cell so up to 13V maximum. Controller inside the battery asks notebook to charge it. Controller inside tells notebook up to what voltage to charge. The battery even has a couple of FET transistors inside (have seen them) so the controller can shut off charging/discharging entirely on its own. Plus the controller has a non-resettable fuse in there - probably you can read up online somewhere about it. So controller has ways to refuse charging or discharging. Battery is in control basically :) Notebook is the servant. Right so 12.5-13V corresponds to a fully charged batt, then it goes down. 9V is a dead batt I understand. Controller tries not to go there. And if it finds itself there it panics and cut shut off the battery for good. 3.6V per cell is known as nominal voltage so that's 10.8V. That is still a healthy voltage, but I don't know what % of charge it corresponds too. A quirk is this: suppose you have battery without load that is at 12.15V. Then you put a load of 1.5Amp on it - normal for a notebook, that's just 15Wt. The voltage immediately goes down - just because there is internal resistance ("impedance") in battery cells themselves. They work as resistors themselves too eating up some voltage probably proprotionate to the current as a normal resistor would do. Your voltage has gone down, but it doesn't mean your charge has gone down yet. So measuring remaining capacity on the basis of voltage only is too simplistic and the controller in the battery tries doing something more sophisticated. What it does exactly I don't know unfortunately. It may be measuring how many Amp*hours went out of the bat since it was last at 100% charge. 100% charge can probably be determined on voltage. In any case there is a voltage over which the controller won't allow it to go least the cells get damaged. So I presume controller knows when it's 100% by voltage and count Amp*hours from there.. Don't know.. Could be one way for it to compute remaining capacity.. BTW if you don't get voltage on batt terminals you could drill plastic on the sides and measure the cells directly :) I would probably then use glue gun to re-seal the holes.. Voltage on the holes but not on batt terminals will probably a battery that the controller has decided to shut off - either via those FET transistors or by blowing the fuse - which some people have replaced..
Th1kCh3ck wrote:
Wed Jul 22, 2020 6:52 pm
Once I unplug the power adapter, the computer runs on the battery and the state goes from "unknown" to "discharging". If I plug the power adapter back again, state goes from "discharging" to "unknown".
Once my external battery hits kind of 40%-37%, it drops kinds of instantly to 5%
I think this is your main complain. And it seems we have more or less clear picture here. Controller hasn't sealed the batt off. It hasn't blown that fuse. It is not closing the FET transistors. It allows normal operation. In fact if this is a knock-off battery controller would be less likely to take these drastic measures. Original batteries have paranoid controllers. When they smell rat they shut off the batt. Probably to prevent house fires and lawsuits.. Knock-offs I assume are a lot less concerned with lawsuits so are more likely to continue running no matter what. So you batt hasn't locked up. But one thing we don't like about it is that it's got an absolutely wrong idea about how much charge it has. It thinks and tells EC/Thinkpad/you that it's still got plenty of charge. And then ooops - it sees that voltage is gone through the floor and it has to stop supplying power least the cells get irreparably damaged. The battery is entirely wrong about how much Wh its got inside it. This is sad. I think this is actually the main complain about knock-off aftermarket batts: they advertise one capacity but are actually much smaller. And they behave exactly like you have described. The battery could have been poor from the start and this could have been the way in which it is poor.

But let us give it the benefit of the doubt.. The I suggest you recalibrate it. At least with original batts it works like this: you discharge the batt fully and then let it charge fully. And this in itself allows the battery controller to get a more accurate idea how much capacity it's got. "tlp recalibrate BAT1" I think does precisely that: discharges fully and then sets charging thresholds in such a way that the next charge is a full one. Well your thresholds are such anyway. So you can do this "tlp tecalibrate BAT1", wait for it to drain the energy fully - all still while connected; you can keep monitoring in 2nd terminal via 'tlp-stat -b BAT1'. The you allow it to charge fully and see if there is any difference.

What I don't like however about your print-out is that your battery says that it's current capacity exactly equals design capacity. This is not the case on the batteries that I think are genuine. This is no the case on what I think are high-quality aftermarket batts - KingSener from AliExpress. This recalibration process described above makes the battery realize its actual capacity is less than its design capacity. And % full are of this actual capacity. The fact your battery still reports actual capacity as exactly equal to design capacity makes me suspicious it's lying. That the firmware in its controller is not that good. And the battery overall is not that good..

You could make peace however with it. Yes your remaining capacity reported is bull. But you can still charge and get some work out of it. Think it's probably all it's good for. No need to talk SMBus to it. The reasons I suggested SMBus tools is because they are fun :) and because they would tell you if a battery is locked. But it's not locked. It's working just badly.

BTW this "unknown" state - have you seen it in my prev. message? I see it on my system too. It may just mean same as "idle"..
Th1kCh3ck wrote:
Wed Jul 22, 2020 6:52 pm
P.S. You could be right that the EC is not at fault and it might be something else that's wrong with the motherboard, I haven't seen anything peculiar last time I opened up the computer but I haven't had a thorough look and tore apart everything.
You've given me more info since previous post. It no longer sounds to me like Thinkpad is broken. More like the battery is in a poor shape - and maybe has always been a poor one.

How are things with the other battery?

And btw if you want advice on buying a cheap and reasonably good aftermarket batt - KingSener on AliExpress, think they are okay. Cost around £25-30 delivered in the UK, take a month to arrive even in times of pandemic. Other users have had good experience with original batts on ebay. I'm a fan of KingSener however :)
Th1kCh3ck wrote:
Wed Jul 22, 2020 6:52 pm
blog post
Yep seen that..
Th1kCh3ck wrote:
Wed Jul 22, 2020 6:52 pm
also a Youtube talk given by the battery hacker about his steps to successfully hack the EC on a Thinkpad x230T to charge non-whitelisted batteries and boy it was quite an adventure I think.
Yes.. that guy probably knows how to flash the EC :) I think Chinese guys behind KingSener and others have done something similar but while this guy hacked EC side they emulated original batteries from their side, so their batts I understand still work with non-hacked BIOS/EC. Thank you for the link to the video. I haven't seen it and it has some interesting info in it. For example that EC has got 100+Kb of flash. Wasn't the whole of BIOS only around 8Kb? I should watch it fully one of these days. Besides this guy is one of our heroes, I guess! We all love updated BIOS-es and he's one of those who've made them possible! He's talking about X230t and it's almost same as X230 hardware-wise and X230 is what I'm going to be upgrading my X220 to soon - still not done.. Been on to-do list for months.. So he is indeed my hero :-D
Th1kCh3ck wrote:
Wed Jul 22, 2020 6:52 pm
Keep me updated if you ever get to have more information using the CP2112 (it's an SMBus to USB kind of device, I think that the battery uses mainly the SMBus protocol to discuss with the computer).
If I get anywhere I may start a new topic in Offtopic section.. I may ping you if I remember to :-D BTW one way to sniff on commands is to make an extension cable to connect any battery to any laptop - more or less. Think the connectors are pretty much the same so extension cables are possible. Then it's easier to sniff on commands too. But you certainly don't need to do that to solve your situation. Just mentioning it because it's probably a bit of fun.

P.S. on my T520 there is some info on batt voltage here: "cat /sys/class/power_supply/BAT0/voltage_now" and there's voltage_min_design next to it. Not sure if these work on T450. If they do.. I know some people were writing their own scripts/apps to display remaining charge under Linux based on these values. As I noted above in principle this is less accurate than the more sophisticated methods available to the battery controller itself. But if battery controller is utterly wrong.. well you could try to do your own measurements on the basis of voltage. Think people probably managed to put that info on taskbar somehow but I don't know how to do that..

P.P.S. As you have noticed I actually think it's unlikely that re-flashing EC would help. I suppose you could measure voltage on batt via this Linux method or via volt-meter like me on a fully-charged and empty batt and make your conclusions. If those voltages make sense it may be proof that the EC is doing its job correctly and it's the battery that is the weak link. We can also discuss what your second batt does. But then what do I know :) I'd start with a new KingSener batt. It's probably less expensive than a repairman. Or some other known-good batt. Perhaps borrow it from somebody?
X220, 2 *T520

RealBlackStuff
Admin Emeritus
Admin Emeritus
Posts: 23812
Joined: Mon Sep 18, 2006 5:17 am
Location: Loch Garman, Éire

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#7 Post by RealBlackStuff » Thu Jul 23, 2020 2:32 am

You probably know already, but from xx30 onward all Thinkpads have a battery-check in their EC.
Using this github-project I removed the battery-check from my X230 (using Debian Jessie).
I also have an E530, but unfortunately they have a different type BIOS/EC and this trick doesn't work there.

And I have yet to see another project to remove this check from xx40 and up Thinkpads.
Lovely day for a Guinness! (The Real Black Stuff)
Lenovo: X240, X250, T440p, T480, M900 Tiny.

PS: the old Boardroom website is still available on the Wayback Machine
.

Th1kCh3ck
Posts: 14
Joined: Wed Jul 22, 2020 5:23 am
Location: Paris, France

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#8 Post by Th1kCh3ck » Thu Jul 23, 2020 10:03 am

atagunov wrote::-D I was looking for something suitable and decided I have too many diodes. So I broke one leg off one and used as a probe. You can see the diode still attached to the other leg! Not really great, they are kind of too thin to sit there snugly but at least they don't damage the battery. I was trying really hard not to short them too!
Using the diodes as probe is a brilliant idea, I'm going to try that for sure, If I understood well what I have to watch out for is to not short the diodes (and the battery too) ?
atagunov wrote:So measuring remaining capacity on the basis of voltage only is too simplistic and the controller in the battery tries doing something more sophisticated. What it does exactly I don't know unfortunately. It may be measuring how many Amp*hours went out of the bat since it was last at 100% charge. 100% charge can probably be determined on voltage.
I'll research more about this kinda of measuring (I'll cross compare values using the volt-meter) and about the "discharge graph" you've talked about.
atagunov wrote:They all have approximately same shape. 6 cell batteries for notebooks are all like this. 3 groups of 2 batteries each. Groups of 2 have those two in parallel. Then you connect 3 of them sequentially. Well photo says it all (not my photo). 9 cell batteries are also the similar. Only have 3 groups of 3 cells. Only found a video.
I never saw the inner of a battery, this is interesting, maybe I'll pull apart one (the official one but they don't look like they're very keen to open up), once it gets to 25% of capacity. Also thank you for the explanation about the battery controller and what is kinda of his job, if I ever open this knock-off battery, I'll gladly have a look (and compare with the official one) at everything that's inside.
Thanks also for more explanation on what the controller might be doing to report the current percentage and the voltage per cells as well as key values of voltage to watch out for, it's interesting to get more insight into what's going on and what to look out for.

This is indeed a knock-off battery bought from AliExpress, I'll try what the official battery gives me during today (her max capacity is lower than the design by like 25%, although trying to charge her I can only get to 50% not much more, before the issue it would charge to 75% as expected and discharge properly).
You're probably right in that the capacity reported by the battery controller is wrong.
After this whole issue, I've been thinking of only buying official Lenovo batteries because it has been so much pain for me, even if the price is like three times than a knock-off but I find it hard to actually find official batteries at least for my T450.

I did try a recalibration using TLP, what happened was again weird.
At first the battery was kinda of fully charged 93-94%.
Initiating the discharge, discharged the battery without too much hassle.
The big drop happens between 40% to 5%.
But then when it's kinda of near 0%, I got this error :

Code: Select all

Error: battery BAT1 was not discharged completely. Check your hardware.
The battery shows that it has 0% and that it's state is "unknown" or "idle" (idle is kinda of better since we kinda of know what's going on or at least we think we do) again.

Even then I tried the recalibration like three more times (had another error similar to this one issue 395 says "Error: BAT1 discharge malfunction" at 0% of capacity.
Until after enough tries I got some energy variable to 0mWh.

Once that happened, TLP said that the discharge was complete and that it was going to fully charge, it ended up not charging fully it got to 94%/93% and then got to the "idle" state, nonetheless no changes were made to the full capacity, it is still exactly the one by design.
atagunov wrote:You could make peace however with it. Yes your remaining capacity reported is bull. But you can still charge and get some work out of it. Think it's probably all it's good for. No need to talk SMBus to it. The reasons I suggested SMBus tools is because they are fun :) and because they would tell you if a battery is locked. But it's not locked. It's working just badly.
You're right about that, if I got the SMBus tools it's just for educational purposes in case I would run into some weird issues again or need to actually get into battery hacking, I've been thinking that maybe I should just give up and accept this kinda of semi-working but it's been a while now that I've been having to manually get the battery out of the computer when I plug the power adapter and I've grown tired of this issue where the battery will "idle" instead of charging normally, it's really annoying when I'm using the dock for instance.

The steps are :
- Unplug the computer from the dock.
- Unplug the power adapter from dock.
- Plug power adapter into computer.
- Unplug external battery.
- Re-plug external battery.
- Unplug power adapter from computer.
- Re-plug power adapter into dock.
- Plug computer back on the dock.

You can see how this kinda of routine can get really annoying over time.
atagunov wrote:What I don't like however about your print-out is that your battery says that it's current capacity exactly equals design capacity. This is not the case on the batteries that I think are genuine. This is no the case on what I think are high-quality aftermarket batts - KingSener from AliExpress. This recalibration process described above makes the battery realize its actual capacity is less than its design capacity. And % full are of this actual capacity. The fact your battery still reports actual capacity as exactly equal to design capacity makes me suspicious it's lying. That the firmware in its controller is not that good. And the battery overall is not that good..
It's true, you could be right that the knock-off battery is indeed wrong, another weird thing is that when I had the internal battery inside, when I plugged this knock-off external battery. The computer would never detect the knock-off external battery so at first I thought the knock-off was just kinda of broken when it arrived, the controller or it's firmware might be the one who's at play in this issue.

Notice that with the official external battery along with the internal battery which is BTW a KingSener one, both batteries were working and detected correctly until I activated the threshold feature which started some issues with charging and the "idle"/"unknown" states showing up more often.

Later, I got to remove the internal battery, and the knock-off external battery suddenly started working and was detected by the T450, I was dumbfounded when I found that out.

The battery hacker guy is kinda of an inspiration for me to keep trying to go as far as I can with this investigation to understand what the heck is going on.
atagunov wrote:I may ping you if I remember to :-D
Hope you will, I'll be on the lookout too just in case.
atagunov wrote:one way to sniff on commands is to make an extension cable to connect any battery to any laptop - more or less. Think the connectors are pretty much the same so extension cables are possible. Then it's easier to sniff on commands too. But you certainly don't need to do that to solve your situation. Just mentioning it because it's probably a bit of fun.
That's a good idea to have some kind of extension cable (maybe some long jumper cables, could do the trick, I'm not sure ?) for testing purposes, in case I'd need to test a bunch of batteries.
atagunov wrote:P.S. on my T520 there is some info on batt voltage here: "cat /sys/class/power_supply/BAT0/voltage_now" and there's voltage_min_design next to it. Not sure if these work on T450. If they do.. I know some people were writing their own scripts/apps to display remaining charge under Linux based on these values. As I noted above in principle this is less accurate than the more sophisticated methods available to the battery controller itself. But if battery controller is utterly wrong.. well you could try to do your own measurements on the basis of voltage. Think people probably managed to put that info on taskbar somehow but I don't know how to do that..
They actually do work, just that the voltage_min_design is missing I think but besides that all the other values are present.
atagunov wrote:We can also discuss what your second batt does. But then what do I know :) I'd start with a new KingSener batt. It's probably less expensive than a repairman. Or some other known-good batt. Perhaps borrow it from somebody?
I know someone else who has a T450 which is working okay with an external and internal battery but I'm afraid he is on holidays right now, I could try to have a look at what happens when I use my knock-off battery on his computer. If I were to buy a new battery I might go with an official one if possible.

RealBlackStuff
Admin Emeritus
Admin Emeritus
Posts: 23812
Joined: Mon Sep 18, 2006 5:17 am
Location: Loch Garman, Éire

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#9 Post by RealBlackStuff » Thu Jul 23, 2020 11:33 am

I have made such a battery extension cord: viewtopic.php?p=680106#p680106
Works on all external batteries from T60/R60/X60 onward.
Plus I also have an external Lenovo Battery Charger for those (but with a few mods).
https://support.lenovo.com/ie/en/solutions/migr-61244

I also made one for older batteries from T43/R52 downward.
Lovely day for a Guinness! (The Real Black Stuff)
Lenovo: X240, X250, T440p, T480, M900 Tiny.

PS: the old Boardroom website is still available on the Wayback Machine
.

atagunov
Senior Member
Senior Member
Posts: 921
Joined: Thu Apr 02, 2020 3:11 pm
Location: London, UK

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#10 Post by atagunov » Thu Jul 23, 2020 12:41 pm

To be honest I'm at a loss here.. So many things could be the reason for the bad behavior

- battery controller/battery cells being bad
- Thinkpad hardware faulty
- Thinkpad EC firmware faulty
Th1kCh3ck wrote:
Thu Jul 23, 2020 10:03 am
Using the diodes as probe is a brilliant idea, I'm going to try that for sure, If I understood well what I have to watch out for is to not short the diodes (and the battery too) ?
I was quite afraid these two pieces of wire would cross thus shorting the battery. The main concern was that battery controller might lock the battery up and never let me use it again
Th1kCh3ck wrote:
Thu Jul 23, 2020 10:03 am
This is indeed a knock-off battery bought from AliExpress, I'll try what the official battery gives me during today (her max capacity is lower than the design by like 25%, although trying to charge her I can only get to 50% not much more, before the issue it would charge to 75% as expected and discharge properly).
Sorry to hear that.. Actually what I see on worn batteries is that after a full charge the OS is showing me 100% full. Of course I'm aware these are not 100% of the design capacity printed on the battery itself but of what battery thinks it's current full capacity is. If you can't get a battery to show 100% charged something is wrong.
Th1kCh3ck wrote:
Thu Jul 23, 2020 10:03 am
After this whole issue, I've been thinking of only buying official Lenovo batteries because it has been so much pain for me, even if the price is like three times than a knock-off but I find it hard to actually find official batteries at least for my T450.
Many people have come to the same conclusion and also possibly the hard way, like yourself.
Th1kCh3ck wrote:
Thu Jul 23, 2020 10:03 am

Code: Select all

Error: battery BAT1 was not discharged completely. Check your hardware.
Super-dodgy. But again I don't know where the fault lies.
Th1kCh3ck wrote:
Thu Jul 23, 2020 10:03 am
- Unplug the computer from the dock.
- Unplug the power adapter from dock.
- Plug power adapter into computer.
- Unplug external battery.
- Re-plug external battery.
- Unplug power adapter from computer.
- Re-plug power adapter into dock.
- Plug computer back on the dock.
No I certainly wouldn't accept this...
Th1kCh3ck wrote:
Thu Jul 23, 2020 10:03 am
Notice that with the official external battery along with the internal battery which is BTW a KingSener one, both batteries were working and detected correctly until I activated the threshold feature which started some issues with charging and the "idle"/"unknown" states showing up more often.
Again very sorry to hear.. In my understanding the thresholds are set inside the battery. E.g. EC issues some kind of command directly or indirectly and this command ends up in an SMBus command sent to the battery controller. Then the battery controller acts on it. This was my understanding.. Btw I remember reading somewhere that removing the battery from Thinkpad should reset this. Here's one such article: https://support.lenovo.com/us/en/solutions/ht103159 It suggests
Shut down the computer.
With the battery in (remove the AC adapter), attempt to turn on the computer by holding down the power button for 30 seconds. This should not turn on the computer.
Remove the battery (if the battery is not detachable, skip this step).
Again, attempt to turn on the computer (AC adapter is not plugged in) by holding down the power button for 30 seconds. This should not turn on the computer either.
Re-attach the battery, plug in the AC adapter, and turn on the computer. The battery should begin charging.
Guess you can try this dance. In my understanding following this kind of procedure should undo the effect of setting thresholds entirely.. Similarly I remain convinced that the thresholds are not remembered by the EC or Thinkpad (apart from those /etc/tlp.conf) but by the battery. Therefore plugging in a known good battery - tested on another Thinkpad and/or known good original, and/or reputable aftermarket brand (you know which one I mean!) should also completely undo the effect of setting thresholds. For extra assurance press the power button a couple of times for 30sec without any batteries and without power supplied from AC adapter (as in Lenovo's instruction above). I guess the idea is to drain any remnants of power the Thinkpad could have had in its capacitors etc.

Because your issue seems so nasty and persistent I feel not confident to rule out hardware issues in Thinkpad itself.. But as I said faulty battery could also be the cause. Badly faulty EC firmware as well I guess...
Th1kCh3ck wrote:
Thu Jul 23, 2020 10:03 am
The battery hacker guy is kinda of an inspiration for me to keep trying to go as far as I can with this investigation to understand what the heck is going on.
My intuition is the solution would lie not in the kind of hacking magic he practiced but in trying known good batteries and possibly checking the motherboard for any burnt FET transistors close to battery connector or even having it examined by a knowledgeable repairman. Not Lenovo own :) Somebody the level of Louis Rossmann ideally :) If you've never seen him this is a fantastic youtube guy who is repairing Macbooks in downtown NY for $300 a piece. His youtube commentary is hilarious. Well, full disclosure: I don't know if there are repairmen of his level working on Thinkpads. As he himself explained Apple just makes a couple new models a year. So you can learn them, you can get motherboard circuity diagrams, you can get spares. Because Macbooks are so ubiquitous it makes sense. Not sure anybody is doing this for Thinkpads.. But then somebody might be.

You could perhaps also check if you can get a replacement motherboard from ebay for reasonable money. It won't be free but your time costs money as well.. This might be cheaper than trying to get your motherboard repaired. No idea. Never looked for T450 motherboards. Sometimes you have smashed Thinkpads on sale - screen broken, body badly scratched but still turns on.. I'd think these might be a source of replacement motherboards too.. First a known-good battery and then if it still doesn't work, probably a new motherboard. Unless you can get repaired cheaper. I guess. Would be my plan.

Good luck!
X220, 2 *T520

RealBlackStuff
Admin Emeritus
Admin Emeritus
Posts: 23812
Joined: Mon Sep 18, 2006 5:17 am
Location: Loch Garman, Éire

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#11 Post by RealBlackStuff » Fri Jul 24, 2020 12:07 am

I admire the patience of you both, but I would have gone out to beg/steal/borrow a genuine Lenovo battery loooong time ago. :roll:
Lovely day for a Guinness! (The Real Black Stuff)
Lenovo: X240, X250, T440p, T480, M900 Tiny.

PS: the old Boardroom website is still available on the Wayback Machine
.

atagunov
Senior Member
Senior Member
Posts: 921
Joined: Thu Apr 02, 2020 3:11 pm
Location: London, UK

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#12 Post by atagunov » Fri Jul 24, 2020 5:01 pm

Just found more voltage info on my T520:

Code: Select all

$ for f in `ls /sys/devices/platform/smapi/BAT0/*volt* /sys/class/power_supply/BAT0/*volt*`; do echo $f=`cat $f`; done
/sys/class/power_supply/BAT0/voltage_min_design=11100000
/sys/class/power_supply/BAT0/voltage_now=11860000
/sys/devices/platform/smapi/BAT0/charging_max_voltage=12600
/sys/devices/platform/smapi/BAT0/design_voltage=11100
/sys/devices/platform/smapi/BAT0/group0_voltage=3957
/sys/devices/platform/smapi/BAT0/group1_voltage=3958
/sys/devices/platform/smapi/BAT0/group2_voltage=3945
/sys/devices/platform/smapi/BAT0/group3_voltage=0
/sys/devices/platform/smapi/BAT0/voltage=11860
Apparently I can even know the voltage on each of the 3 groups of cells.
RealBlackStuff wrote:
Fri Jul 24, 2020 12:07 am
I admire the patience of you both, but I would have gone out to beg/steal/borrow a genuine Lenovo battery loooong time ago. :roll:
Testing with a known-good battery is the obvious thing to do, the advice may be hidden in my super-long posts but it's there. I was also seeking the reassure OP that charging thresholds he set previously will not transfer to a new battery and should in fact be possible to reset quite easily if both Thinkpad and battery operate correctly.

That said I'm not fully convinced his T450 doesn't have hardware issues.

Hijacking the topic..

Further the erratic battery behaviour when the upper charging threshold is in use is a real thing, I've seen it and I'd like to build up understanding on how batteries work so that I can find a work-around.

My present theory is that - on a healthy system with a good battery - when you discharge it to 0% or charge it to100% these conditions serve as "reference points" for battery controller and in the next battery cycle it can show remaining charge quite accurately. However if the charge fluctuates between 0% and 100% without reaching either I'm hypothesising that the controller may loose track of where things stand and show remaining charge incorrectly. According to this theory the controller can for example be overestimating the charge seriously and thus we may experience a sudden drop from 30% to 0%.

Then I thought one possible remedy could be instead of using stop charge threshold to always charge to 100% and then immediately go down from there to the desired charge level. Start charge threshold would still be used and set to a lower level. The hope is that for a Thinkpad which is plugged in most of the time this would
- cause less wear on the battery than letting it sit charged to 100% for long periods of time - when plugged in
- ensure correct display of remaining battery charge with no sudden drops - on those rare days when Thinkpad is running on battery
It's just a theory though at this point. I probably should script it and test it.

Notably TLP author did not like the theory and is apparently convinced that on systems where the erratic behaviour has been observed it's better to always charge the battery to 100% and let it sit at 100% for however long it may be required. In my case that may mean long months. I don't know if he's right or wrong..

P.S. apparently even genuine batteries can use different controllers and different algorithms; therefore it has just occurred to me that the erratic behaviour when upper charge threshold is in use may manifest itself on some genuine batteries but not on others. In particular I wouldn't be surprised if bq8030 family of controllers was better at handling the upper charge threshold (pure speculation at this point).. hmm.. actually when battery is at rest for prolonged periods of time (Thinkpad switched off) the controller should be able to estimate remaining charge quite accurately on the basis of voltage alone.. hmm..

It seems a bit difficult to test this theory for me though.. Even if I get that hardware/software to talk SMBus to batteries, I think the battery doesn't normally tell us which controller it's built around. In fact it seems one needs to open the battery up to confirm the controller.. But opening it up damages the case badly.. hmm..
X220, 2 *T520

Th1kCh3ck
Posts: 14
Joined: Wed Jul 22, 2020 5:23 am
Location: Paris, France

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#13 Post by Th1kCh3ck » Sat Jul 25, 2020 9:11 am

I'd like to begin by saying I haven't tried this possible solution :
aragunov wrote:Shut down the computer.
With the battery in (remove the AC adapter), attempt to turn on the computer by holding down the power button for 30 seconds. This should not turn on the computer.
Remove the battery (if the battery is not detachable, skip this step).
Again, attempt to turn on the computer (AC adapter is not plugged in) by holding down the power button for 30 seconds. This should not turn on the computer either.
Re-attach the battery, plug in the AC adapter, and turn on the computer. The battery should begin charging.
So now I've been testing using my official Lenovo battery (a bit old tho manufactured in 2015) that came initially working correctly with the computer before any of the threshold settings and I can see weird things happening again.

So to begin, I could charge the computer up to 37% only despite the full actual capacity being 76%.
Next thing I noticed was that after a night of trying to charge entirely, unlike the knock-off battery, the state doesn't change to unknown, it keeps the state charging sometimes (I haven't understood exactly but if the computer goes to sleep and keeps charging it can reach the dreaded "unknown" state).
Another thing, I noticed that was fishy, when having discharged the battery.
The battery reports being at 6% for about a hour, then starts dropping to 0 normally.
It looks like the actual capacity reported by the battery controller ? Or the OS is wrong ?
I haven't monitored what capacity Windows sees yet (but I think it will be the same probably).

Notice too, that this time there is no battery malfunction when recalibrating the battery, the only thing that is wrong is that it never charge up past 37% currently.
No threshold set is reported by TLP, just factory settings.

There is however something very weird happening indeed, when I boot up on Windows 10 and check using Lenovo Vantage, it reports that Battery Threshold is active with 90% start and 100% stop threshold set.
When I disable that, it seems to do pretty much nothing.

What I've noticed is that the battery threshold end up re-activating at least reported by Lenovo Vantage when I switch between the knock-off battery and the official battery.

I haven't verified much what happens with the internal battery yet (but I know she won't charge to 100% despite being a KingSener one !).
Maybe the issue could be magically fixed by placing back the computer in the first state when the issue took place.

Basically, putting back the internal KingSener battery and letting the official battery too and then trying to see how both charge up, according to TLP documentation, there is something called dualmode battery firmware which can conflict with TLP and raise issues with thresholds, if somehow the firmware had a really nasty bug and thinks somehow it should add up both batteries capacities and right now one is missing thus it could explains the missing capacity I've seen and the fact that I can't charge past a certain capacity, the computer isn't able to go up a limit perhaps set somewhere in the EC I suppose ?

I also noticed since just a day (after having "fully" charged at 37%, there is kind of a drop in the max capacity I can get to, now I can only get to 28% (now at 12.2V, currently saying 51 hours before it will be fully charged, since the energy rate decreases), the more I get to a higher capacity the more the time to full charge is increased (the best I've reached was 300 hours to fully charge so far).

What I noticed too is that when discharging the battery percentage goes down very fast (like .5% or more in just a second) until it hits 6%.

In this case too, the voltage seems to be a key, it goes down about 1.5V (from 11.5V to 10V) with quite some time (like I said a hour) when the capacity is always reported at 6%.
aragunov wrote:My intuition is the solution would lie not in the kind of hacking magic he practiced but in trying known good batteries and possibly checking the motherboard for any burnt FET transistors close to battery connector or even having it examined by a knowledgeable repairman. Not Lenovo own :) Somebody the level of Louis Rossmann ideally :) If you've never seen him this is a fantastic youtube guy who is repairing Macbooks in downtown NY for $300 a piece. His youtube commentary is hilarious. Well, full disclosure: I don't know if there are repairmen of his level working on Thinkpads. As he himself explained Apple just makes a couple new models a year. So you can learn them, you can get motherboard circuity diagrams, you can get spares. Because Macbooks are so ubiquitous it makes sense. Not sure anybody is doing this for Thinkpads.. But then somebody might be.
Since I have weird and different behaviors with at least 2 batteries (one official and a knock-off), I suppose that my hardware is the one that is faulty, I really need to start searching for the Louis Rossmann group of Thinkpads if I'm planning to get this sorted (I don't trust a lot average repair stores, also I really like too his commentary videos and his work, pure inspiration for me, glad to see someone else who appreciate them as well).

Before getting a new motherboard, I'm thinking of trying to go all in all flashing the EC back to an old version. See if it fixes the issues, if the flashing fails and I've got a toast, then a new motherboard is the way to go since I won't have any other solutions. I'm just hesitating to try and flash it right now, maybe I'll wait and get a new motherboard first (since it's my currently work kinda of laptop, I need it to work), there is also another solution that I could try is get a new T450 that has a warranty since 2021 and test with it (I've found one for 350$ so far), if anything weird shows up, I send it back to the manufacturer for a replacement.

I have tried to check like you if I could have the voltage of each cell, since my computer doesn't use tp_smapi, I have none of these information currently available.
aragunov wrote:P.S. apparently even genuine batteries can use different controllers and different algorithms; therefore it has just occurred to me that the erratic behaviour when upper charge threshold is in use may manifest itself on some genuine batteries but not on others. In particular I wouldn't be surprised if bq8030 family of controllers was better at handling the upper charge threshold (pure speculation at this point).. hmm.. actually when battery is at rest for prolonged periods of time (Thinkpad switched off) the controller should be able to estimate remaining charge quite accurately on the basis of voltage alone.. hmm..
That's interesting an investigation should be carried, prying open a few Lenovo official batteries and maybe trying to document their battery controller model but that could cost quite a bit tho.
Similarly I remain convinced that the thresholds are not remembered by the EC or Thinkpad (apart from those /etc/tlp.conf) but by the battery. Therefore plugging in a known good battery - tested on another Thinkpad and/or known good original, and/or reputable aftermarket brand (you know which one I mean!) should also completely undo the effect of setting thresholds.
I disagree on this with you, since in case there is an issue and battery threshold cannot be disabled (according to the TLP documentation) it could be a conflict between the dualmode firmware battery and the threshold settings, and the only fix is flashing the EC firmware again (to a newer version if possible) so wouldn't that mean that the EC registers the threshold values ? I've also read somewhere on github issues of TLP that what TLP does is use the correct drivers to write the threshold values to the proper EC registers, so they are probably sitting in the EC, I have found a C script that can dump the content of all the EC (if you have initially modprobed ec_sys module) registers that the systems has access to in hexadecimal, the scripts even allows you to monitor the EC registers, so I could set a threshold with TLP and see which registers changes and thus deduce which ones I should be looking out for.

Here is a dump of mine :

Code: Select all

     00  01  02  03  04  05  06  07  08  09  0A  0B  0C  0D  0E  0F
00:  a6  05  a0  c6  00  86  00  00  00  08  47  00  00  09  80  00 
10:  00  00  ff  ff  e0  3c  00  51  7b  ff  00  00  ff  ff  1d  00 
20:  00  00  00  00  00  00  00  66  00  00  00  00  00  00  58  80 
30:  00  00  00  00  70  04  00  00  00  a3  30  18  00  50  00  00 
40:  00  00  00  00  00  00  14  c6  42  1c  00  00  00  00  00  00 
50:  00  80  02  0c  00  01  02  03  04  05  06  07  8d  d7  aa  64 
60:  e6  ea  63  85  05  00  00  00  00  00  00  00  00  00  00  00 
70:  00  00  00  00  08  00  00  00  30  00  00  00  00  00  00  00 
80:  00  10  05  06  00  00  03  00  00  00  00  00  00  00  2b  00 
90:  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00 
A0:  fb  01  e9  06  ff  ff  1d  00  11  00  ae  2f  2c  01  80  00 
B0:  00  00  00  00  00  00  00  00  00  00  2d  05  00  96  01  00 
C0:  00  00  00  00  00  00  00  00  01  2d  00  06  00  72  00  00 
D0:  16  00  c0  01  00  00  00  00  00  00  00  00  00  00  00  00 
E0:  00  00  00  00  00  00  00  00  10  40  e8  19  e4  ae  44  03 
F0:  4a  42  48  54  31  37  57  57  20  57  4c  84  00  00  00  00 
Something interesting that I could get is the last line is the version of the embedded controller using a bit of python I could get back this 'J', 'B', 'H', 'T', '1', '7', 'W', 'W'.

I found even probably better maybe some gold, apparently with this bash wrapper around the script it allows writing directly values to the EC RAM, now I could maybe avoid the reflashing of the EC ? I know probably that if I do something wrong, I could probably toast the T450 EC chip too.

I'm also with you on the investigation to how exactly the threshold system works to understand how it can lead to such erratic batteries behavior.

Before trying anything funny with the scripts I mentioned here, I'm going to try the fix you have proposed to disable the threshold (the little dance with the power button).

Th1kCh3ck
Posts: 14
Joined: Wed Jul 22, 2020 5:23 am
Location: Paris, France

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#14 Post by Th1kCh3ck » Sat Jul 25, 2020 9:55 am

Here is some more info about the official battery charging :

It seems she stopped charging indeed at 29% according to ACPI.
Battery 0: Charging, 29%, charging at zero rate - will never fully charge.
Battery 0: design capacity 1897 mAh, last full capacity 1447 mAh = 76%
Here is what's contained in /sys/class/power_supply/BAT1/uevent

Code: Select all

POWER_SUPPLY_STATUS=Charging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11100000
POWER_SUPPLY_VOLTAGE_NOW=12225000
POWER_SUPPLY_POWER_NOW=0
POWER_SUPPLY_ENERGY_FULL_DESIGN=23200000
POWER_SUPPLY_ENERGY_FULL=17690000
POWER_SUPPLY_ENERGY_NOW=5250000
POWER_SUPPLY_CAPACITY=29
POWER_SUPPLY_CAPACITY_LEVEL=Normal
POWER_SUPPLY_MODEL_NAME=45N1775
POWER_SUPPLY_MANUFACTURER=SANYO
POWER_SUPPLY_SERIAL_NUMBER= 2975[\code]

Gonna shut off the computer and try to empty it from any power by holding power button 
for 30 seconds power adapter unplugged, battery unplugged as well.

atagunov
Senior Member
Senior Member
Posts: 921
Joined: Thu Apr 02, 2020 3:11 pm
Location: London, UK

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#15 Post by atagunov » Sat Jul 25, 2020 5:36 pm

To re-iterate one point I already made before. Look, this is my hopefully correctly working T520 with a 9 year old hopefully genuine battery:

Code: Select all

/sys/devices/platform/smapi/BAT0/design_capacity            =  86580 [mWh]
/sys/devices/platform/smapi/BAT0/last_full_capacity         =  73740 [mWh]
/sys/devices/platform/smapi/BAT0/remaining_capacity         =  52890 [mWh]
/sys/devices/platform/smapi/BAT0/remaining_percent          =     72 [%]
Charge                                                      =   71.7 [%]
Capacity                                                    =   85.2 [%]
Design capacity is 86.58Wh. Last full capacity is 73.74Wh. Think it's also known as FCC = full charge capacity. FCC is 73.73Wh. That is 85.2% of the design capacity. Thus my battery wear is 14.8%. The charge that battery controller is estimating my battery to currently have is 52.89Wh. And the charge is 71.7% This is what I see in top-right corner of my screen 71%. Please note: 52.89 / 73.73 = 71.7%. E.g. this 71.7% is the remaining charge compared to 73.74Wh not to 86.58Wh.

The battery charge as shown in top-right corner is the percentage compared to FCC not to design capacity! And indeed when my charging is done - which always happens overnight - I arrive at 100%. If your battery and your Thinkpad are operating correctly you should always see 100% charge after charging you battery fully with the threshold properly disabled. You should still reach 100% even if you battery is 25% worn. If you're not reaching 100% something is wrong.

I actually no longer believe the talk about "dual mode battery firmware". To begin with nobody knows what it is except for the author of TLP. He is certainly not talking about a Thinkpad with two batteries. He is quoting a 2015 response from Lenovo employee on Lenovo support forum:
There is not any Power Manager for Windows 10. Lenovo does not provide any feature to manage battery charge thresholds on Windows 10. The ThinkPad systems that are on the Windows 10 supported system list here all have dual-mode battery firmware. The battery firmware itself will recognize the scenario where the battery is ALWAYS fully charged 100% (over a period of many weeks) and adjust the full charge capacity downwards in a way to maintain maximum battery health. This is something that happens automatically in the battery firmware. There is nothing that a user needs to do manually, to maximize battery health on these batteries. For this reason, we don't provide any utility to manually manage battery charge thresholds on Windows 10.
This _is_ what he means when he talks of dual mode battery firmware. There's a a 2nd link that doesn't work for me. Maybe it works from Germany or if you have German as your main language in browser or in your OS don't know.. And this is the only place on the internet where it is claimed the battery has this ability. I actually think this is a false claim. EC firmware can probably be bad, but we don't know what "dualmode firmware" is. And the claim that under Windows 10 utilities to set charging thresholds are not provided is no longer true as far as I can tell. Are you running Windows 10? Can you set/view battery charging thresholds there? If the answer is yes then you yourself have proof that this talk about "dualmode battery firmware" is dodgy.
X220, 2 *T520

Th1kCh3ck
Posts: 14
Joined: Wed Jul 22, 2020 5:23 am
Location: Paris, France

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#16 Post by Th1kCh3ck » Sat Jul 25, 2020 7:54 pm

I can actually can set the battery threshold for any battery in Lenovo Vantage on Windows 10, so this statement about dual-mode battery firmware is indeed dodgy and I'd rather not believe in it anymore thank you for opening my eyes to this discrepancy.

I just have downgraded my EC firmware from (1.04 to 1.02, I checked in the BIOS the version number of the EC firmware), by flashing an older BIOS (and it did flash only the EC firmware weirdly, the BIOS is still at its latest version) a few hours ago.
I have not noticed any changes yet, I did re calibrate the official battery and saw no change when charging for the first time with the old EC firmware.

Now I'm starting to get worried at what might be wrong with my T450, flashing the EC wasn't enough to fix the issue then what will ? Maybe I should flash again to the old version ??

One very subtle thing I noticed the design capacity/last full capacity reported by ACPI of the knock-off battery seems to be changing the more she's charged, it lowers to 3917mWh instead of being 47.52mWh (when looking at /sys/.../BAT0/uevent).
And If I have a look at the current energy inside the battery it is of 44.49Wh, meaning it exceeds the capacity reported by ACPI which doesn't make any sense to be honest.

At the end of the day, I really don't know what to think of this issue anymore.

I'll be checking too whether the threshold are kinda of semi-apparent (like showing up on Windows 10 when swapping between knock-off external battery and official battery).

I think I'll end up mailing my T450 to Louis Rossmann (Somday or I'll get to NYC if needed, I'd need to send a mail before to ask if he's willing to take this kinda of repair) with the board schematics of the T440 (if you want them too I can send them to you via private messages) maybe he'll figure out something or I could start getting into it maybe.

I believe you're also right about the fact that I should see a 100% of charge even with 25% of battery wear, I understand that my battery should be able to charge up to her current full_capacity even if it has decreased a bit from the designed one.

If the dualmode battery firmware is just pure false information maybe it'd be nice to open up an issue on Github on the TLP repo to try and shed some truth and light, also update the documentation as I'm probably not the only one who has been duped by this, I was led to believe it was something genuinely conflicting with the threshold feature but it appears it does not even exists.

I have gotten my hands on some boards schematics for the T440, and I've found the same EC controller chip (MEC1633L-AUE) I've found a data line perhaps ? That is called EC_RESET and that receives a voltage from VCC3M (which I don't know where it comes from really but is probably High I think, (so putting it to ground could reset the EC maybe ???), I'm just a beginner with board schemes and this one is in a PDF format (text is searchable tho) so it's not like a full real board view software that I have where I can track the power rails and data lines precisely but it still doable).

I've noticed on that the EC receives information from the battery too such as BAT_FET_HOT, M_BATVOLT (M: for Main battery which is referring to the internal), M_TEMP, S_BATVOLT (S:Secondary, this the external battery), S_TEMP.
The M_TEMP and S_TEMP are protected with a resistor of 1K ohm I believe.
There are also I2C data lines named I2C_DATA_BT0, I2C_CLK_BT0 and the same for BT1 (BT1 is external and BT0 internal).
One last thing is BATMONT_EN which I don't know what it stands for really, battery monitoring English ?? :?:
The EC also is responsible for detecting whether an 65W, 45W or 90W AC power adapter is plugged in according to what I can see in the schematics.

To further diagnose what's going on, I'd really need to try and intercept the I2C data lines somehow and read the raw values given by the batteries I believe only then maybe I could see if there is an error before them arriving being treated by the EC, I should consider buying a new official battery too to try it out but I can't believe that out of the three batteries I have three are all faulty in some sort or have a controller that's behaving weirdly.

This is the first issue that I have seen so much resistance from in my entire life so far.

RealBlackStuff
Admin Emeritus
Admin Emeritus
Posts: 23812
Joined: Mon Sep 18, 2006 5:17 am
Location: Loch Garman, Éire

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#17 Post by RealBlackStuff » Sun Jul 26, 2020 2:24 am

Lovely day for a Guinness! (The Real Black Stuff)
Lenovo: X240, X250, T440p, T480, M900 Tiny.

PS: the old Boardroom website is still available on the Wayback Machine
.

atagunov
Senior Member
Senior Member
Posts: 921
Joined: Thu Apr 02, 2020 3:11 pm
Location: London, UK

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#18 Post by atagunov » Sun Jul 26, 2020 10:00 am

Th1kCh3ck wrote:
Sat Jul 25, 2020 7:54 pm
I think I'll end up mailing my T450 to Louis Rossmann (Somday or I'll get to NYC if needed
He did say in one of the videos his workshop is in downtown Manhattan, his rent is expensive and that is part of the reason his charges are high. I mentioned him an example of somebody passionate of what he's doing and apparently qualified too. Also quite funny to my taste :) (Quote from Porco Rosso: "What makes a good pilot? Inspiration")

I do think that testing needs to happen with a known-good battery. If you still can't charge it to 100% no matter what you do something may be wrong with the Thinkpad.

Another interesting bit of info to look at btw is current power consumption. It can only be measured by the battery when running on battery, think it can be obtained by doing 'cat /sys/devices/platform/smapi/BAT0/power_now' or something similar. My preferred way to check it is to run 'sudo powertop'. 'powertop' is a tool from Intel that shows a lot of information which in my view is of little interest.. but this bit of info is interesting: when on battery it does tell you current battery consumption. That still comes from battery controller itself, so I'd test on a good battery. I'm seeing between 10Wt and 25Wt on my X220 and T520 btw.. I don't trust that much the breakdown 'powertop' gives of where the power is going into.. I have a feeling it's guessing a lot of that. But the headline number when on battery looks correct.
X220, 2 *T520

Th1kCh3ck
Posts: 14
Joined: Wed Jul 22, 2020 5:23 am
Location: Paris, France

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#19 Post by Th1kCh3ck » Wed Jul 29, 2020 12:08 pm

Alright, so here is a little update from before.

I've tried the little dance you (atagunov) told me about with the power button and it changed nothing so far as well.

I've been going at a few repair shops near my area, none of them want my Thinkpad to repair.
One of them said that Lenovo uses a specific chip to block the charging of non-official batteries (yeah it's called the Embedded Controller but there is no whitelist for batteries on the T450 (only LCD screens as far as I know and it's possible to patch the EC to bypass them) but I didn't want to sound rude so I shut up and took my anger back home.

Following this, I've been looking at a store which sells a few useful stuff I'll need, I'm also going to get a logic analyzer from Amazon and I'll use it to try to sniff the SMBus communication from the battery (I just need to find the pinout for my batteries, I know where GROUND and the positive side but besides that, the SMBus Clock SDC and DATA SDA pin I guess).

If this doesn't help in any way I could try the I2C lines that are going to the EC, but it may be harder to attach the logic analyzer to them since it may require some soldering to the EC pins I believe.

I've also ordered a new official battery to test it out coming in 4-5 days.
This is more fun to try all that to find out what's going on than just live with these battery issues.

I'll also try to check what Powertop says however I once activated both by mistake both TLP and Powertop together and boy it wasn't fun.

So far what I've seen in the power_now value has been sometimes very wrong. When charging power_now says how much the battery charge back up I guess. With the official battery it states that the rate is 0 whilst it is being charged and at some point it starts going up miraculously.

atagunov
Senior Member
Senior Member
Posts: 921
Joined: Thu Apr 02, 2020 3:11 pm
Location: London, UK

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#20 Post by atagunov » Wed Jul 29, 2020 4:00 pm

Th1kCh3ck wrote:
Wed Jul 29, 2020 12:08 pm
I've tried the little dance you (atagunov) told me about with the power button and it changed nothing so far as well.
..well it was just a quote from Lenovo advice, from the page I linked to previously. Sorry to hear there's no change
Th1kCh3ck wrote:
Wed Jul 29, 2020 12:08 pm
I once activated both by mistake both TLP and Powertop together and boy it wasn't fun.
Okay, powertop has the feature to automatically optimize power usage. I don't like it and don't use it. I researched it at one point and concluded it's just not good for my purpose.. TLP is the tool that optimizes battery usage, not powertop, at least for me.

However once I just install powertop and invoke it from command line with no arguments then it does no tuning. It shows a whole screen of info that I don't find very useful. However when I'm running on battery that screen of info powertop shows contains one jewel of useful information: current power consumption in watts. Only when I'm on battery. That has to be coming from the battery controller somehow. And the values I've seen on X220 and T520 did make a lot of sense. Less when fully idle (11Wt), more when doing something (15Wt), max when watching videos on Youtube in Firefox over WiFi (over 20Wt). The time my Thinkpads were able to work on battery also roughly matched battery charge (as reported by "sudo tlp-stat -b") divided by those wattages reported by "sudo powertop".

I'm not sure what you mean by activating powertop but just running it without args (as "sudo powertop") appears totally safe and sometimes useful.
Th1kCh3ck wrote:
Wed Jul 29, 2020 12:08 pm
So far what I've seen in the power_now value has been sometimes very wrong. When charging power_now says how much the battery charge back up I guess. With the official battery it states that the rate is 0 whilst it is being charged and at some point it starts going up miraculously.
I don't know enough about this to advise. I think when Thinkpad runs on battery current power consumption can be retrieved. Powertop does it somehow. Possibly via those files in /sys. I'm not sure what those files give us when we're not running on battery. So my idea was that you'd check how many watts your Thinkpad is drawing. Here's a hypothesis which I had in mind and wanted to prove correct or to reject: imagine battery is okay but Thinkpad is consuming too much power (there's a short somewhere or something like that). Then the power consumption would be too high, the battery controller would be able to see and report this and you would be able to see that via powertop when running on battery. The number is worth looking at I'd say.
X220, 2 *T520

Th1kCh3ck
Posts: 14
Joined: Wed Jul 22, 2020 5:23 am
Location: Paris, France

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#21 Post by Th1kCh3ck » Wed Jul 29, 2020 5:00 pm

Something very weird happened today.

It may be that I am onto the way of it getting fixed rather unexpectedly.
So I had my knock-off battery plugged in and charged at 95% for the whole day (in "idle/unknown" state).
I took it out and plugged it back inside.
The status changes to "charging" but this time the battery actually loses percentage.
I went from 95% to 52% right now still going down.
So I checked using the acpi command line tool.
The battery or the EC at first when at 95%, reported the last full capacity to be around 3920mAh.

Here is the data I've stored :

Code: Select all

Battery 0: Charging, 91%, charging at zero rate - will never fully charge.
Battery 0: design capacity 3969 mAh, last full capacity 3969 mAh = 100%
Battery 0: Charging, 91%, charging at zero rate - will never fully charge.
Battery 0: design capacity 3965 mAh, last full capacity 3965 mAh = 100%
Battery 0: Charging, 91%, charging at zero rate - will never fully charge.
Battery 0: design capacity 3965 mAh, last full capacity 3965 mAh = 100%
Battery 0: Charging, 91%, charging at zero rate - will never fully charge.
Battery 0: design capacity 3965 mAh, last full capacity 3965 mAh = 100%
Battery 0: Charging, 91%, charging at zero rate - will never fully charge.
Battery 0: design capacity 3965 mAh, last full capacity 3965 mAh = 100%
Battery 0: Charging, 91%, charging at zero rate - will never fully charge.
Battery 0: design capacity 3968 mAh, last full capacity 3968 mAh = 100%
Battery 0: Charging, 91%, charging at zero rate - will never fully charge.
Battery 0: design capacity 3968 mAh, last full capacity 3968 mAh = 100%
Battery 0: Charging, 90%, charging at zero rate - will never fully charge.
Battery 0: design capacity 3975 mAh, last full capacity 3975 mAh = 100%
Battery 0: Charging, 90%, charging at zero rate - will never fully charge.
Battery 0: design capacity 3974 mAh, last full capacity 3974 mAh = 100%
Battery 0: Charging, 90%, charging at zero rate - will never fully charge.
Battery 0: design capacity 3974 mAh, last full capacity 3974 mAh = 100%
Battery 0: Charging, 89%, charging at zero rate - will never fully charge.
Battery 0: design capacity 3980 mAh, last full capacity 3980 mAh = 100%
Battery 0: Charging, 86%, charging at zero rate - will never fully charge.
Battery 0: design capacity 3997 mAh, last full capacity 3997 mAh = 100%
Battery 0: Charging, 86%, charging at zero rate - will never fully charge.
Battery 0: design capacity 3997 mAh, last full capacity 3997 mAh = 100%
Battery 0: Charging, 86%, charging at zero rate - will never fully charge.
Battery 0: design capacity 3997 mAh, last full capacity 3997 mAh = 100%
Battery 0: Charging, 86%, charging at zero rate - will never fully charge.
Battery 0: design capacity 3996 mAh, last full capacity 3996 mAh = 100%
Battery 0: Charging, 86%, charging at zero rate - will never fully charge.
Battery 0: design capacity 3996 mAh, last full capacity 3996 mAh = 100%
Battery 0: Charging, 86%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4002 mAh, last full capacity 4002 mAh = 100%
Battery 0: Charging, 85%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4003 mAh, last full capacity 4003 mAh = 100%
Battery 0: Charging, 85%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4006 mAh, last full capacity 4006 mAh = 100%
Battery 0: Charging, 84%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4006 mAh, last full capacity 4006 mAh = 100%
Battery 0: Charging, 84%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4025 mAh, last full capacity 4025 mAh = 100%
Battery 0: Charging, 83%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4020 mAh, last full capacity 4020 mAh = 100%
Battery 0: Charging, 83%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4018 mAh, last full capacity 4018 mAh = 100%
Battery 0: Charging, 83%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4017 mAh, last full capacity 4017 mAh = 100%
Battery 0: Charging, 83%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4017 mAh, last full capacity 4017 mAh = 100%
Battery 0: Charging, 83%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4017 mAh, last full capacity 4017 mAh = 100%
Battery 0: Charging, 83%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4017 mAh, last full capacity 4017 mAh = 100%
Battery 0: Charging, 82%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4021 mAh, last full capacity 4021 mAh = 100%
Battery 0: Charging, 82%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4022 mAh, last full capacity 4022 mAh = 100%
Battery 0: Charging, 80%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4032 mAh, last full capacity 4032 mAh = 100%
Battery 0: Charging, 80%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4038 mAh, last full capacity 4038 mAh = 100%
Battery 0: Charging, 79%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4042 mAh, last full capacity 4042 mAh = 100%
Battery 0: Charging, 79%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4042 mAh, last full capacity 4042 mAh = 100%
Battery 0: Charging, 79%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4049 mAh, last full capacity 4049 mAh = 100%
Battery 0: Charging, 78%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4050 mAh, last full capacity 4050 mAh = 100%
Battery 0: Charging, 78%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4053 mAh, last full capacity 4053 mAh = 100%
Battery 0: Charging, 77%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4055 mAh, last full capacity 4055 mAh = 100%
Battery 0: Charging, 77%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4059 mAh, last full capacity 4059 mAh = 100%
Battery 0: Charging, 77%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4060 mAh, last full capacity 4060 mAh = 100%
Battery 0: Charging, 76%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4062 mAh, last full capacity 4062 mAh = 100%
Battery 0: Charging, 75%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4070 mAh, last full capacity 4070 mAh = 100%
Battery 0: Charging, 75%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4070 mAh, last full capacity 4070 mAh = 100%
Battery 0: Charging, 74%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4087 mAh, last full capacity 4087 mAh = 100%
Battery 0: Charging, 74%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4075 mAh, last full capacity 4075 mAh = 100%
Battery 0: Charging, 74%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4076 mAh, last full capacity 4076 mAh = 100%
Battery 0: Charging, 73%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4083 mAh, last full capacity 4083 mAh = 100%
Battery 0: Charging, 72%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4088 mAh, last full capacity 4088 mAh = 100%
Battery 0: Charging, 72%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4089 mAh, last full capacity 4089 mAh = 100%
Battery 0: Charging, 72%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4092 mAh, last full capacity 4092 mAh = 100%
Battery 0: Charging, 72%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4091 mAh, last full capacity 4091 mAh = 100%
Battery 0: Charging, 71%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4095 mAh, last full capacity 4095 mAh = 100%
Battery 0: Charging, 69%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4100 mAh, last full capacity 4100 mAh = 100%
Battery 0: Charging, 68%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4100 mAh, last full capacity 4100 mAh = 100%
Battery 0: Charging, 68%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4101 mAh, last full capacity 4101 mAh = 100%
Battery 0: Charging, 68%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4102 mAh, last full capacity 4102 mAh = 100%
Battery 0: Charging, 63%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4130 mAh, last full capacity 4130 mAh = 100%
Battery 0: Charging, 63%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4130 mAh, last full capacity 4130 mAh = 100%
Battery 0: Charging, 62%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4136 mAh, last full capacity 4136 mAh = 100%
Battery 0: Charging, 62%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4136 mAh, last full capacity 4136 mAh = 100%
Battery 0: Charging, 60%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4150 mAh, last full capacity 4150 mAh = 100%
Battery 0: Charging, 60%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4151 mAh, last full capacity 4151 mAh = 100%
Battery 0: Charging, 59%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4155 mAh, last full capacity 4155 mAh = 100%
Battery 0: Charging, 59%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4158 mAh, last full capacity 4158 mAh = 100%
Battery 0: Charging, 55%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4191 mAh, last full capacity 4191 mAh = 100%
Battery 0: Charging, 54%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4208 mAh, last full capacity 4208 mAh = 100%
Battery 0: Charging, 52%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4240 mAh, last full capacity 4240 mAh = 100%
The fact that ACPI reports that the max capacity was 3920mAh at first make me think that this is why it never charged up to the full capacity since it thought it was already there.
Now I know for a fact that this knock-off battery can go to 4700mAh maximum I believe.
But going from 3920mAh to 4700mAh this isn't like 5% of battery, it looks like almost 20% was missing or I may be wrong.
If 4700mAh was is the full capacity then 3920mAh is only 83% of the full capacity so I don't really understand how I am currently at 48% of battery with the design capacity/last full capacity at almost 4300mAh maybe it's more complicated than I thought to know the percentage based on mAh.

I'd like to install powertop right now and have a look at the charging rate/discharging rate?? But I think I should just wait just in case powertop would do something (post-installation hooks maybe) that would halt this process until it has finished kinda of showing the true max_capacity.

According to /sys/.../power_supply/BAT1/uevent, the values POWER_SUPPLY_ENERGY_FULL_DESIGN=47520000
POWER_SUPPLY_ENERGY_FULL=47520000
Do not change.
The voltage does change it seems to be going lower.
This value changes as well
POWER_SUPPLY_ENERGY_NOW=22510000
The capacity goes down as well.
Status is indeed charging.
POWER_SUPPLY_STATUS=Charging

To recap here are all the values of uevent :

Code: Select all

POWER_SUPPLY_NAME=BAT1
POWER_SUPPLY_STATUS=Charging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=10800000
POWER_SUPPLY_VOLTAGE_NOW=11027000
POWER_SUPPLY_POWER_NOW=0
POWER_SUPPLY_ENERGY_FULL_DESIGN=47520000
POWER_SUPPLY_ENERGY_FULL=47520000
POWER_SUPPLY_ENERGY_NOW=22380000
POWER_SUPPLY_CAPACITY=47
POWER_SUPPLY_CAPACITY_LEVEL=Normal
POWER_SUPPLY_MODEL_NAME=45N1734
POWER_SUPPLY_MANUFACTURER=SANYO
POWER_SUPPLY_SERIAL_NUMBER=15921
I don't really know what's going on, maybe the battery is re-calibrating itself or the controller has initiated something of that sort.
Finally here is what TLP says :

Code: Select all

--- TLP 1.3.1 --------------------------------------------

+++ Battery Features: Charge Thresholds and Recalibrate
natacpi    = active (data, thresholds)
tpacpi-bat = active (recalibrate)
tp-smapi   = inactive (ThinkPad not supported)

+++ ThinkPad Battery Status: BAT1 (Ultrabay / Slice / Replaceable)
/sys/class/power_supply/BAT1/manufacturer                   = SANYO
/sys/class/power_supply/BAT1/model_name                     = 45N1734
/sys/class/power_supply/BAT1/cycle_count                    = (not supported)
/sys/class/power_supply/BAT1/energy_full_design             =  47520 [mWh]
/sys/class/power_supply/BAT1/energy_full                    =  47520 [mWh]
/sys/class/power_supply/BAT1/energy_now                     =  21580 [mWh]
/sys/class/power_supply/BAT1/power_now                      =      0 [mW]
/sys/class/power_supply/BAT1/status                         = Charging

/sys/class/power_supply/BAT1/charge_start_threshold         =     96 [%]
/sys/class/power_supply/BAT1/charge_stop_threshold          =    100 [%]
tpacpi-bat.BAT1.forceDischarge                              =      0

Charge                                                      =   45.4 [%]
Capacity                                                    =  100.0 [%]
It feels like that the battery is discharging but the state is charging which feels like it's impossible to me that the battery does indeed discharge while being in this state, no force discharge is active.

EDIT : Actually I think that I'm being wrong for the maximum capacity it is around 4400mAh usually for my computer official battery. On this knock-off there is written about 5200mAh as being the maximum.
I'm currently at :

Code: Select all

Battery 0: Charging, 39%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4674 mAh, last full capacity 4674 mAh = 100%
EDIT 2 :
Just now I've received the famous drop from 40% to 5%, I'm thinking that the battery is indeed discharging very weirdly.

Code: Select all

Battery 0: Charging, 5%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4845 mAh, last full capacity 4845 mAh = 100%
Battery 0: Charging, 0%, charging at zero rate - will never fully charge.
Battery 0: design capacity 4987 mAh, last full capacity 4987 mAh = 100%
Battery 0: Charging, 0%, charging at zero rate - will never fully charge.
Battery 0: design capacity 5025 mAh, last full capacity 5025 mAh = 100%
Battery 0: Charging, 0%, charging at zero rate - will never fully charge.
Battery 0: design capacity 5116 mAh, last full capacity 5116 mAh = 100%
At some point, the computer shut off instantly, just now at 0%, while the power adapter was still plugged in, and the battery "charging", so the issue is nowhere near resolved, silly me for thinking it was finally okay.
Unless I had unplugged the power adapter and re plugged it, it didn't boot at all.

Here is the ACPI outputs after the boot :

Code: Select all

Battery 0: Charging, 1%, 02:11:35 until charged
Battery 0: design capacity 4598 mAh, last full capacity 4598 mAh = 100%
Battery 0: Charging, 2%, 01:48:30 until charged
Battery 0: design capacity 4569 mAh, last full capacity 4569 mAh = 100%
Battery 0: Charging, 2%, 01:44:26 until charged
Battery 0: design capacity 4558 mAh, last full capacity 4558 mAh = 100%
Battery 0: Charging, 2%, 01:48:08 until charged
Battery 0: design capacity 4556 mAh, last full capacity 4556 mAh = 100%
Battery 0: Charging, 3%, 02:07:45 until charged
Battery 0: design capacity 4439 mAh, last full capacity 4439 mAh = 100%
Battery 0: Charging, 6%, 01:39:36 until charged
Battery 0: design capacity 4285 mAh, last full capacity 4285 mAh = 100%
Battery 0: Charging, 6%, 01:39:36 until charged
Battery 0: design capacity 4285 mAh, last full capacity 4285 mAh = 100%
Battery 0: Charging, 6%, 01:39:04 until charged
Battery 0: design capacity 4279 mAh, last full capacity 4279 mAh = 100%
This is still a big mess but the battery is charging for real this time.

EDIT 3:

Installed powertop, here is the output while charging about the power consumption, the computer is mostly idle right now.
System baseline power is estimated at 6.06 W
Here is another one :
System baseline power is estimated at 4.30 W

Seems to be correct to me.

Th1kCh3ck
Posts: 14
Joined: Wed Jul 22, 2020 5:23 am
Location: Paris, France

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#22 Post by Th1kCh3ck » Thu Jul 30, 2020 1:37 am

Here are some measurements I've made of the official battery and the knock-off using a paper clip as probes.

So at first, I tried this on the official battery (shows up being at 0% despite being recharged by the computer, was not entirely fully charged) :

The reading began kinda at 11V and kept getting higher as time moved on, here is a picture 11.48V (I apologize for the bit of mess, although one could say that these batteries made me pull my hair).
After a while the voltage of the battery kept going up until it hit 12.65V 12.66V, it became thus stable.

This is for the knock-off battery (this one was in the computer charging all day and was at 90%) :
It almost instantly gave me this stable reading (another picture) 13.75V, this time with the knock-off.

I'd like it Aragunov if you could tell me if you have kinda of some of these similar behaviors with one of your Lenovo batteries if that's fine with you, also the voltage being reported by the computer seems to be always a bit lower for instance for the knock-off battery, it is reported at 12.15V instead of 13.75V and the same but less bigger difference is also noticeable with the official battery, when at 12.65V, the computer reports it being at ~11.01V.

I've tried to measure the "internal" battery resistance for each of these but the reading were very unstable and switching every 100ms I'd say so it wasn't really conclusive.

One thing that is very weird tho is that for the internal battery (the KingSener) the readings were correctly reported to the computer. The voltage being read by the multi-meter was very close, almost the same as the one reported by the computer. But for the external batteries, this does not hold true, maybe I'm missing something ? Or could this be where the problem lies ?

atagunov
Senior Member
Senior Member
Posts: 921
Joined: Thu Apr 02, 2020 3:11 pm
Location: London, UK

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#23 Post by atagunov » Fri Jul 31, 2020 4:54 pm

Th1kCh3ck wrote:
Thu Jul 30, 2020 1:37 am
The reading began kinda at 11V and kept getting higher ... after a while the voltage of the battery kept going up until it hit 12.65V, it became thus stable
12.65 doesn't sound too weird btw, 12.65 / 3 = 4.21
there are different kinds of cells around, some should be charged to 4.20V others to 4.25V
and the controller in the battery is supposed to know which cells it's got and it should instruct Thinkpad to charge the battery accordingly

when the battery was at 12.65V was it seen as 100% charged by the OS?
it seems like it should have been
Th1kCh3ck wrote:
Thu Jul 30, 2020 1:37 am
the knock-off battery (.. was in the computer charging all day and was at 90%) .. almost instantly gave me this stable reading 13.75V
13.75 / 3 = 4.58

Now I'm not an expert on cells at all, but doesn't it look a bit high?
Doesn't it look like the cells have been overcharged badly?
To the point of death?
Th1kCh3ck wrote:
Thu Jul 30, 2020 1:37 am
I'd like it Aragunov if you could tell me if you have kinda of some of these similar behaviours with one of your Lenovo batteries if that's fine with you
Yes, I should probably overcome my laziness and do a few more measurements at different levels of charge..
Th1kCh3ck wrote:
Thu Jul 30, 2020 1:37 am
also the voltage being reported by the computer seems to be always a bit lower for instance for the knock-off battery, it is reported at 12.15V instead of 13.75V and the same but less bigger difference is also noticeable with the official battery, when at 12.65V, the computer reports it being at ~11.01V
So when you measured the official battery outside the computer the voltmeter showed 12.65V
When that battery was in the computer the computer itself reported 11.01V

One crucial question: was the laptop running on battery or on AC when you took the reading of 11.01V?

The reason I'm asking is because my hypothesis is this: under load (when battery is in use) the voltage will be always lower. The difference should equal the current (measured in amperes, A the usual letter to denote current is I) times the internal resistance of the battery: Udiff = I * Rinternal, or because wattage (power) W = U * I where I is current and U is voltage, we get Udiff = (W / U ) * Rinternal. From here we get Rinternal = Udiff * U / W. This is actually one way to estimate the internal resistance of the battery. Udiff is the difference between voltage observed on disconnected battery and on battery in use. W is the wattage reported by powertop. For U I guess we can take the voltage on the battery in use. Now there are two options to get the voltage of battery in use: rely on what Thinkpad reports or somehow attach thin wires to battery contacts and make them stick out even when battery is connected. Then you can measure with voltmeter which is probably more accurate.
Th1kCh3ck wrote:
Thu Jul 30, 2020 1:37 am
I've tried to measure the "internal" battery resistance for each of these but the reading were very unstable and switching every 100ms I'd say so it wasn't really conclusive.
Heh that can't be measured directly :) I guess the way to measure it is to compare the voltage on battery at different loads, e.g. when different currents run through battery. You should get the biggest voltage when there is no current (battery is idle). The more load there is on battery (the bigger the current going through it) the smaller voltage you get. Knowing all other parameters one can calculate the internal resistance of battery. Actually above I sketched how exactly I'd go about it.

That said you don't need to know the exact value normally. But you need to know that internal resistance exists and that it explains voltage drop on battery that is in use.
Th1kCh3ck wrote:
Thu Jul 30, 2020 1:37 am
One thing that is very weird tho is that for the internal battery (the KingSener) the readings were correctly reported to the computer. The voltage being read by the multi-meter was very close, almost the same as the one reported by the computer. But for the external batteries, this does not hold true, maybe I'm missing something ? Or could this be where the problem lies ?
Could it be that you looked at the numbers when the Thinkpad was running on external battery and internal battery was not in use? If that was the case it would explain the behaviour. Otherwise I'm at a loss..

BTW you may find this post interesting. RealBackStuff has shown two stand-alone chargers for Thinkpad batteries. I didn't even know they existed and didn't need one that much, they also cost upwards of £40 but you may find them useful.. They talk SMBus to battery like a Thinkpad does. They ask the battery to tell it which voltage to charge it too and at what maximum current, etc.
X220, 2 *T520

Th1kCh3ck
Posts: 14
Joined: Wed Jul 22, 2020 5:23 am
Location: Paris, France

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#24 Post by Th1kCh3ck » Sun Aug 02, 2020 1:51 pm

aragunov wrote:when the battery was at 12.65V was it seen as 100% charged by the OS?
it seems like it should have been
I believe it was not, it was just beginning to charge up a bit, it was reporting to be at perhaps 20% or maybe even lower.
12.65V yeah didn't look to weird to me too.
aragunov wrote:13.75 / 3 = 4.58

Now I'm not an expert on cells at all, but doesn't it look a bit high?
Doesn't it look like the cells have been overcharged badly?
To the point of death?
The knock-off has probably 6 cells, so I think so it should be still okay.
I should have said this kind of information in my last post sorry.
aragunov wrote:So when you measured the official battery outside the computer the voltmeter showed 12.65V
When that battery was in the computer the computer itself reported 11.01V

One crucial question: was the laptop running on battery or on AC when you took the reading of 11.01V?
I was running on AC when I took the reading of 11.01V from the computer.
aragunov wrote:Could it be that you looked at the numbers when the Thinkpad was running on external battery and internal battery was not in use? If that was the case it would explain the behaviour. Otherwise I'm at a loss..
To be honest I'm at a loss too, but I was running on AC when having the internal battery inside.

I've had a look at the external chargers (thanks for the information, this could be a solution for me) which I think none supports the batteries I have I could be wrong since some batteries work with different laptop models, but I'll need to have a more thorough look or contact the seller on Ebay about this information.

Finally, I come with lots of news on the official external battery.
I've gotten what I needed to sniff SMBus communication although using what I had around to insert things in the pins of the battery (whilst connected to the computer) which proved harder than I thought but still I got around it (I'm even getting used to it).

I hooked up a logic analyzer, I've just received on another computer and went for multiple captures.
Now to understand all the data, one need to have a thorough look at the SBS (Smart Battery Specification) (I know that there is a more recent revision, rev 2.0 but I couldn't find it easily).

So here are some bits that were interesting on the capture.

First of all, I've seen some kind of authentication exactly the one seen by the battery hacker Matthew Chapman.
The battery sends a "Lenovo Japan" string + 4 bytes to the EC and then a second authentication happens.

Code: Select all

Start: 0.192722780
Write address VT  ACK Protocol=Process call
Command OptionalMfgFunction4 <
Byte count EOT
Byte NUL ACK
Byte l ACK
Byte NUL ACK
Byte NUL ACK
PEC (225) OK

Start: 0.299001300 -------> FIRST AUTHENTIFICATION
Write address VT  ACK Protocol=Block write
Command OptionalMfgFunction4 <
Read address VT  ACK Protocol=Block write
Byte count DLE
Byte L ACK
Byte e ACK
Byte n ACK
Byte o ACK
Byte v ACK
Byte o ACK
Byte (SP) ACK
Byte J ACK
Byte a ACK
Byte p ACK
Byte a ACK
Byte n ACK
Byte (249) ACK
Byte ^ ACK
Byte (137) ACK
Byte DC1 ACK
PEC (236) OK

Start: 0.310921740
Write address VT  ACK Protocol=Read word
Command <error> 5
Read address VT  ACK Protocol=Read word
Word (32768) ACK
PEC (156) OK

Start: 0.318869540
Write address VT  ACK Protocol=Block write
Command <error> 7
Read address VT  ACK Protocol=Block write
Byte count BS 
Byte ETX ACK
Byte NUL ACK
Byte (180) ACK
Byte NUL ACK
Byte NUL ACK
Byte ETX ACK
Byte L ACK
Byte STX ACK
PEC (193) OK

Start: 0.328804660
Write address VT  ACK Protocol=Block write
Command OptionalMfgFunction5 / ----------> SECOND AUTHENTIFICATION
Read address VT  ACK Protocol=Block write
Byte count VT 
Byte 1 ACK
Byte Z ACK
Byte W ACK
Byte 0 ACK
Byte Z ACK
Byte 5 ACK
Byte 8 ACK
Byte * ACK
Byte EM  ACK
Byte ) ACK
Byte SUB NACK
Bad PEC ' should be (238)
This bit of code still remains in the EC even though there is no whitelist for the batteries on the T450.
It was interesting, but to know more about what would be going on, we'd need to have the EC firmware (just download it from an update for your specific laptop model is sufficient) and then extract the firmware and disassemble it (I'm doing some research on this) then reverse it and try to understand what it does when these instructions fails (maybe no-op?).
Although some parts of it are probably encrypted.

Next up, some battery information which would shed some light on the very issue going on :

Code: Select all

BatteryMode (9344) INTERNAL_CHARGE_CONTROLLER=0, 
PRIMARY_BATTERY_SUPPORT=0, 
CONDITION_FLAG=1, 
CHARGE_CONTROLLER_ENABLED=0, 
PRIMARY_BATTERY=0, 
ALARM_MODE=1, 
CHARGER_MODE=0, 
CAPACITY_MODE=0
Alright, first to understand all these set flags, I went to look at the trusty SBS specification.
Here is what the specs says about the first one for instance.
SBS wrote:INTERNAL_CHARGE_CONTROLLER bit set indicates that the battery pack contains its own internal charge controller. When the bit is set, this optional function is supported and the CHARGE_CONTROLLER_ENABLED bit will be available for activation and control of the actual internal charger.
In here everything is summed up for every flags that is reported by the BatteryMode function.

The thing that caught my eye is the CONDITION_FLAG=1 (CAPACITY_MODE=0 is important too, it says that some values reported by the battery are in mAh), it was stated that the battery needed a conditioning cycle, later in the SBS spec, I read that it was basically a re-calibration of the battery, full charge, full discharge, then full charge again but since I could never fully charge no wonder this was set.
The spec stated that if this flag was set the data reported by the battery was less accurate (Useable, Safe, Reliable, but less accurate).

Here is some detail from the spec (if you're curious you may have to peek someday there too Aragunov).
SBS wrote:The CONDITION_FLAG is the first signal from the Smart Battery that it has limited ability to determine the present state-of-charge. As a result other data values may be less accurate than required by this specification.
(A more serious flag is the INITIALIZED status bit flag found in the BatteryStatus() register.
Refer to Section 5.1.21 for the BatteryStatus() register.)
After reading this, I'm thinking that the battery did indeed grow kind of an issue somehow after a lot of repeated non-full charge.
Later I discovered that the INITIALIZED flag was also set to 0 meaning this that the battery is Useable, Safe, but use data with caution (less reliable).
Looking at more detailed info this is what it meant for this flag to be cleared (it was initially set at 1 when the battery was manufactured).
SBS wrote:Battery electronics have determined that calibration or configuration information has been lost and accuracy is significantly impaired. (User should be notified to be skeptical of battery data.)
So the data reported by the battery is indeed somehow very rubbish.
I've found a few rubbish things indeed looking at the manufacture date for instance (ManufactureDate (6727) 2/7/1993), I'm like excuse me ? Lenovo Vantage in Windows 10 apparently finds out her true ManufactureDate someway (so maybe it's just that my Software that decrypts SMBus communication could be wrong here or that Windows stored the value in some registers when the battery worked fine and never updates it unless I delete the register values).

But later I found more information which I didn't know if they made real sense such as the CycleCount being at 28673 units is said to be in decimal in the spec.
The DesignCapacity reported was of 2052 which is in mAh, making 2.052Ah which kinda of is correct looking at what's written on the battery I believe.

I found later the BatteryStatus.

Code: Select all

BatteryStatus (49152) OVER CHARGED ALARM=1, --> This means the battery is over charged and the computer has to stop charging.
TERMINATE CHARGE ALARM=1,  --> This states that the battery is fully charged yes exactly WTF
OVER TEMP ALARM=0, 
TERMINATE DISCHARGE ALARM=0, 
REMAINING CAPACITY ALARM=0, 
REMAINING TIME ALARM=0, 
INITIALIZED=0, --> This is bad, not really accurate data 
DISCHARGING=0, 
FULLY CHARGED=0, 
FULLY DISCHARGED=0, 
ErrorCode=OK
Here are the two first values means according to the spec.

There is a lot more to be said about my SMBus captures but that's a lot already, I'm thinking of maybe writing a blog after all these battery issues, maybe it will help someone in the future (I can send the capture data to you Aragunov by private message perhaps if you want to have a thorough look if you're not too busy that is, you'll need to get familiar with the SBS but it isn't that hard to be honest).

After a bunch of capture, I've seen that the TERMINATE CHARGE ALARM=1 is cleared, it goes to 0 which meant the battery was not fully charged (which seemed correct to me), but OVER CHARGED ALARM=1 never goes to 0, meaning the battery still thinks either that she is overcharged and it is true or the data used by the battery to monitor herself is so rubbish that it makes her think she's overcharged.
Currently I think that we are in the first case somehow, because of the fact that when I'm at 6%, the battery holds like for one hour and 15min or so then goes down at 0%.

Right now, I have charged the official battery all night long until it hit the "unknown/idle" state and I'm probably going to try to do some more captures and compare the data against the one whilst it was charging.

The best thing that could be done, would be to have another T450 (currently a friend has that but is in holidays, I'll probably have more chance to see him in September so no luck there) which has working batteries then plug for instance one of the official battery and maybe if possible do a re-calibration of the battery that has all the bad flags set up if not then do another SMBus capture.

I have yet to even just do one or two capture of the knock-off battery too, it's a bit of work to be honest.
I don't know if there is any chance, I can find out the real issue of what's going on right now, I have more data, I'm at a lower level but I'm still a bit confused by all of this, I still don't really know if the computer is part of the issue, I think it still is part of the issue but I can't really figure out in what way it is.

atagunov
Senior Member
Senior Member
Posts: 921
Joined: Thu Apr 02, 2020 3:11 pm
Location: London, UK

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#25 Post by atagunov » Sun Aug 02, 2020 1:57 pm

Th1kCh3ck wrote:
Thu Jul 30, 2020 1:37 am
I'd like it Aragunov if you could tell me if you have kinda of some of these similar behaviors with one of your Lenovo batteries if that's fine with you, also the voltage being reported by the computer seems to be always a bit lower for instance for the knock-off battery, it is reported at 12.15V instead of 13.75V and the same but less bigger difference is also noticeable with the official battery, when at 12.65V, the computer reports it being at ~11.01V ...
One thing that is very weird tho is that for the internal battery (the KingSener) the readings were correctly reported to the computer. The voltage being read by the multi-meter was very close, almost the same as the one reported by the computer. But for the external batteries, this does not hold true
Okay, I've done "sudo tlp discharge BAT0" and immediately pulled out 42T4969 55+ 11.1V 8.4Ah battery out of my T520. Voltmeter read 10.23V. Computer was reporting around 0%. Sorry, didn't check "/sys/devices/platform/smapi/BAT0/voltage" then.

I started charging the battery. When OS was reporting 8.7% I did "cat /sys/devices/platform/smapi/BAT0/voltage" and saw 11739, presumably 11.7V. I pulled out the battery and voltmeter measured 10.81V.

I then executed "sudo tlp recalibrate BAT0". TLP discharged my battery fully and exited. I left Thinkpad on overnight. Think I could have left it off but on AC too. In the morning I observed that battery was "100% charged", "capacity" as reported by "sudo tlp-stat -b" went down about 1% to 85.2% making my wear 14.8%. This was expected as in fact I'd done "calibration" - had the battery fully discharged and then fully charged. This is when "capacity" gets updated. Battery was "idle" according to "sudo tlp-stat -b" - neither charging nor discharging. "cat /sys/devices/platform/smapi/BAT0/voltage" showed 12481, e.g. 12.5V. I took the battery out and measured with voltmeter. It read 12.01V.

I don't know what to think. I'm observing a discrepancy between "cat /sys/devices/platform/smapi/BAT0/voltage" and voltmeter just like you. This is when Thinkpad is running on AC and battery is idle. I don't know why. Voltmeter shows less. Theoretically I could drill holes in the plastic on the sides of my battery and measure the cells pack with voltmeter directly. It is possibly that I'd measure more than what I measure on the battery connector and it would match "cat /sys/devices/platform/smapi/BAT0/voltage".. Don't know..

Also my fully charged voltage seems to be 4.16V per cell if I trust "cat /sys/devices/platform/smapi/BAT0/voltage" and 4.0V if I trust voltmeter. Hmm.. 4.16 isn't too off is it? If these are 4.20V cells this might be correct.. In fact I did not check "cat /sys/devices/platform/smapi/BAT0/group0_voltage" nor group1, group2 when my battery was full.. perhaps one cell group was at 4.20V precisely and others slightly bellow.. and the controller stopped charging as soon as one group reached max voltage. That could explain why overall I did not see 4.2 * 3 = 12.6V

I've been running on battery for a couple of hours not doing much, and I'm now at 72% charge. I think the battery generally operates okay.

Update: do you have reverse discrepancy compared to mine? Do you see _more_ voltage when measuring with voltmeter compared to "cat /sys/devices/platform/smapi/BAT0/voltage"? I'm seeing _less_ when measuring with voltmeter. Your discrepancy could be explained if you're taking your "cat /sys/devices/platform/smapi/BAT0/voltage" readings when your battery is "discharging". I suggest taking the reading instead when it is "idle". My discrepancy could be explained if there is somehow a voltage drop between actual cells pack and the battery connector..
X220, 2 *T520

Th1kCh3ck
Posts: 14
Joined: Wed Jul 22, 2020 5:23 am
Location: Paris, France

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#26 Post by Th1kCh3ck » Sun Aug 02, 2020 2:28 pm

atagunov wrote:
Sun Aug 02, 2020 1:57 pm
Update: do you have reverse discrepancy compared to mine? Do you see _more_ voltage when measuring with voltmeter compared to "cat /sys/devices/platform/smapi/BAT0/voltage"? I'm seeing _less_ when measuring with voltmeter. Your discrepancy could be explained if you're taking your "cat /sys/devices/platform/smapi/BAT0/voltage" readings when your battery is "discharging". I suggest taking the reading instead when it is "idle". My discrepancy could be explained if there is somehow a voltage drop between actual cells pack and the battery connector..
Thanks a lot for the bunch of measures you've made.

To answer you.
I see more voltage when measuring with voltmeter compared to "cat /sys/class/power_supply/BAT1/voltage_now" since my computer is not supported by smapi, I don't have the same files as you, all my measures were done while the computer was plugged to AC and battery was in charging state, none were made during the discharging state.
atagunov wrote:
Sun Aug 02, 2020 1:57 pm
I don't know what to think. I'm observing a discrepancy between "cat /sys/devices/platform/smapi/BAT0/voltage" and voltmeter just like you. This is when Thinkpad is running on AC and battery is idle. I don't know why. Voltmeter shows less. Theoretically I could drill holes in the plastic on the sides of my battery and measure the cells pack with voltmeter directly. It is possibly that I'd measure more than what I measure on the battery connector and it would match "cat /sys/devices/platform/smapi/BAT0/voltage".. Don't know..
I don't think you should do some of these battery modifications, unless you really needed them, it's fine thank you for trying to help me as much as you can.
You could be probably right about the voltage drop between connector and cells.
I'll keep in mind for my next measures to actually take them when the battery is in "idle".

atagunov
Senior Member
Senior Member
Posts: 921
Joined: Thu Apr 02, 2020 3:11 pm
Location: London, UK

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#27 Post by atagunov » Sun Aug 02, 2020 4:00 pm

Wasn't really going to drill :) Was just explaining my only hypothesis. In case you're wondering these two agree on my T520:

Code: Select all

$ cat /sys/devices/platform/smapi/BAT0/voltage
11613
$ cat /sys/class/power_supply/BAT0/voltage_now 
11613000
X220, 2 *T520

Th1kCh3ck
Posts: 14
Joined: Wed Jul 22, 2020 5:23 am
Location: Paris, France

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#28 Post by Th1kCh3ck » Sat Aug 08, 2020 6:36 pm

Coming with some good news.

I have received a new battery from Amazon, I still went for knock-off but a really accurate one (I got a bit tricked I'd say, they printed kinda of almost the same logos and things on it).

So I did some tests with it even did SMBus captures.

So far, it is working correctly, at first it fully charged for the first time ever, I also checked the battery threshold on Windows Lenovo Vantage, the setting was indeed disabled.

A few days pass, I did some recalibrations as the SMBus capture showed some flags that said the battery needed a re-conditioning cycle.

I lost like almost 20% of the original capacity so I'm going to receive a new battery from Amazon.

Besides that, no weird issues besides one.

The threshold has activated itself automagically, basically I just fully charged. I quickly moved the computer along the charger to another plug but then saw the battery was not charging and was at 99%.
I was like hmm okay so if the battery is respecting the factory settings according to TLP.

Code: Select all

+++ ThinkPad Battery Status: BAT1 (Ultrabay / Slice / Replaceable)
/sys/class/power_supply/BAT1/manufacturer                   = SANYO
/sys/class/power_supply/BAT1/model_name                     = 45N1125
/sys/class/power_supply/BAT1/cycle_count                    = (not supported)
/sys/class/power_supply/BAT1/energy_full_design             =  72150 [mWh]
/sys/class/power_supply/BAT1/energy_full                    =  57130 [mWh]
/sys/class/power_supply/BAT1/energy_now                     =  55970 [mWh]
/sys/class/power_supply/BAT1/power_now                      =   4420 [mW]
/sys/class/power_supply/BAT1/status                         = Charging

/sys/class/power_supply/BAT1/charge_start_threshold         =     96 [%]
/sys/class/power_supply/BAT1/charge_stop_threshold          =    100 [%]
tpacpi-bat.BAT1.forceDischarge                              =      0

Charge                                                      =   98.0 [%]
Capacity                                                    =   79.2 [%]
Once I hit 95.9%, I should be able to charge up. But what happened instead is that the threshold was still active. Now since this issue has been dooming me for awhile. I knew for a fact that once the threshold activates itself automatically. On Windows Lenovo Vantage reports the charge_start_threshold = 95%.
So I'm thinking no issue, let's wait for 94.9%, and it works.

Right now, I'm thinking of opening up an issue on TLP to ask where the hell does these values come from ?
The EC registers cannot have like two values in them at the same time and this threshold feature is definitely OS independent so why the reading is incorrect ?
(That alone remains a mystery).

I've noticed also something during the charges sometimes the Wattage on Windows was reported at 30W while charging.
But when the battery capacity went up it went low to 4W and then back up, I don't know if this is normal and nothing to worry about.

PS : Aragunov have you read my detailed SMBus capture post a few posts up ?

EDIT :

PS2: I did downgrade flash the EC so I thought that the feature charge threshold would have been disabled by that it seems not, I could still upgrade back again to further try to solve this issue.

PS3: If I remove the feature on Windows then unplug the battery physically from the laptop then put it back the charge threshold feature comes back ON, this maybe the root of my issue so far but nothing about charge threshold is mentioned in any SMBus capture I have made and the SBS (Smart Battery specification doesn't mention anything about charge threshold either so to find exactly what is at play research elsewhere is needed).

atagunov
Senior Member
Senior Member
Posts: 921
Joined: Thu Apr 02, 2020 3:11 pm
Location: London, UK

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#29 Post by atagunov » Sun Aug 09, 2020 6:16 pm

Th1kCh3ck wrote:
Sat Aug 08, 2020 6:36 pm
The threshold has activated itself automagically, basically I just fully charged. I quickly moved the computer along the charger to another plug but then saw the battery was not charging and was at 99%.
Is this the 96% start charging threshold that gets activated automatically?
96% looks pretty normal to me, might be the default
Th1kCh3ck wrote:
Sat Aug 08, 2020 6:36 pm
PS : Aragunov have you read my detailed SMBus capture post a few posts up ?
I'm sorry, I didn't look in any detail.. There was a binary dump a few posts above, so I thought that was some sort of a dump of internal EC memory/registers?..
X220, 2 *T520

Th1kCh3ck
Posts: 14
Joined: Wed Jul 22, 2020 5:23 am
Location: Paris, France

Re: [T450] Battery erratic behaviour need probably to reflash EC firmware

#30 Post by Th1kCh3ck » Sat Aug 15, 2020 6:36 am

atagunov wrote:
Sun Aug 09, 2020 6:16 pm
Is this the 96% start charging threshold that gets activated automatically?
96% looks pretty normal to me, might be the default
It seems to not be 96% but 95%. Lenovo Vantage seems to be more accurate than TLP I wonder if I change the threshold values on Windows if TLP will read them rightly (or not).

I've opened up an issue on the TLP Github but got quickly shut down since it's most likely an issue with kernel interface/drivers ? (all this looks fishy to me I don't really believe anything is wrong with the interface/drivers)
atagunov wrote:
Sun Aug 09, 2020 6:16 pm
I'm sorry, I didn't look in any detail.. There was a binary dump a few posts above, so I thought that was some sort of a dump of internal EC memory/registers?..
It's not about the dump of internal EC memory/registers (these were on really old posts), there were SMBus Smart Battery capture data that I posted and tried to interpret/analyze using the Smart Battery specification, it is reply #24.
Try to give it a quick look when you have some time and tell me what you think of it all.

Post Reply
  • Similar Topics
    Replies
    Views
    Last post

Return to “ThinkPad T430-T490 / T530-T590 Series”

Who is online

Users browsing this forum: No registered users and 122 guests