[TRACKING] Battery flipping between charging and discharging / Draws from battery even on AC

Additionally, it seems my Ugreen 45W charger also works like a charm now.

I tested it under full load (using all cores with blender rendering)

Note: I have a system tray widget that shows me the power drain/charge from the battery by using/sys/class/power_supply/BAT1/current_now and /sys/class/power_supply/BAT1/voltage_now

  • started off as “fully charged”
  • after 10ish seconds, my widget showed me a battery drain of 0.5W
  • A couple seconds later it increased to 2W
  • Only after another couple seconds (maybe half a minute after starting the render), my system reported the battery discharging
  • When the render was done, the system reported normal charging of the battery
  • After it was full again, the system now is still happy with the 45W charger. I now even attached my phone to it, so the charging is halfed. Still no problems

Hm, I guess these settings in theory shouldn’t trigger what you see, i.e., that the CPU is limited even on AC. But I’d recommend disabling all the options, and starting from scratch.

Hm, I just took a look at Optimizing Ubuntu Battery Life, and I think the recommendations are a bit strange. In general, I’d recommend keeping most of the defaults. TLP has pretty good defaults, and many ticked checkboxes in the guide are not necessary because they correspond to the default. And where they differ, what the guide recommends can be questionable. For example, CPU_SCALING_GOVERNOR_ON_AC=performance seems to be a strange recommendation. Okay, it doesn’t matter that much on AC, but performance just disables all energy CPU optimizations, even those that make sense on AC and don’t hurt performance noticeably. Also, this setting just means that CPU_ERNGERY_PERF_POLICY_ON_AC will be ignored anyway, so it’s rather confusing to set both. See intel_pstate CPU Performance Scaling Driver — The Linux Kernel documentation for details.

The recommendations may seem odd, but the idea is a user is either connected to power or not, thus disabling everything in terms of noticeable performance or not noticeable performance. It’s merely a suggestion based on what worked best for us.

Do try the TLP defaults to see if you end up with any difference in flipping.

@real_or_random agreed, that most settings don’t make much sense.

After playing around some more, I can definitely say that the boosting is causing this.
But that includes the GPU boosting!

For 2 days I now only have following settings set via TLP (and kept BAT and AC settings the same):

  • CPU_BOOST set to off
  • CPU_HWP_DYN_BOOST to off
  • GPU frequencies set to the max that is output via tlp-stat -g, but set the boost frequency to the regular max frequency, so it doesn’t boost up.

Important: it seems that TLPUI doesn’t always load the new settings when saving, so a quick tlp start is often needed to actually apply the changes (I suspect this behavior screwed with some of the tests I did before)

This works on a i7-1260P as well as i5-1340P framework

Do keep sharing what you find as I lack the cycles right now to dedicate specific time to replicate this. If you find something hyper-specific we can improve in docs, awesome share how you arrived there and with your specific hardware and TLP config.

The other day I had some rare flipping again, and I suspect it’s because my kernel got updated from oem-22.04c to the generic one.

Some of the TLP settings didn’t seem to apply with the generic kernel running (mostly the CPU performance settings).

I switched to the newer oem-22.04d and the problem went away again

1 Like

Glad to hear this resolved itself. We do have a little application that installed, will monitor for changes in the kernel and alert you.

On my 11th Gen, IF I have an external hub plugged into the back right USB C port, the back left USB C port where I have the power plug will flip-flop between charging and discharging the battery. The solution is a kludge. Unplug the left power for a second and plug it back in. The system then prioritizes that USB C port or so it seems to this layman. The other way to go here is to not plug in the right-hand USB C hub until after the laptop powers up, in which case no flip-flopping. (This on Windows 11 Pro)

I get similar behaviour on the framework 13 amd with ec3.03 watching the EC console I see no events for when it’s been booted powered from the left PD port after an unplug. I get an event again from the right. But it’s not complete and there is a TODO message in the EC console about implementing PD port switching logic. Suspending unplugged seems to bring proper AC powered messages back again after resume when plugging on either side

What I don’t understand is why the right USB C port causes problems?

Are both right ports affected by this?

II was responding to jwp who has done a more detailed study of the issue. Mine was the left back port flip-flopping. My guess would be that having a usb hub plugged in to the right back port reduces the power to the left meaning that there is no dedicated power plug USB C port at all.

I would wonder if the problem has to do with the problem where there was a component overheating causing the left side ports to go totally inop.

I have no idea. I am a pure layman here and will just leave it to those who can troubleshoot better than I.

Fwiw, when I tried this a while ago, I could reproduce the problem with all four ports, even with the modules removed. (Support had asked me to try this, that’s why I did some more tested.)

Please help me
If you are able to solve this problem ? I HAVE SAME PROBLEM battery is not charging now my laptop is dead ,it was keeping flipping btw charging and discharging, i have hp 12 gen laptop and had a kali linux base os

You should probably contact HP. Please don’t contact Framework support over this because they only support Framework laptops.

1 Like

Just upgraded to the latest BIOS 3.05 and this is still happening, when the limit is set at 80% it flips between charging and discharging it never says charged. It does seem less of a problem when the limit is set to 100% though, it seems to switch to discharging when put under stress then after a few seconds goes back to fully-charged.

1 Like