uConsole: How Does Charging Work?

This works for me BUT you need to make sure the three definitions are on a new line. So the file /etc/udev/rules.d/99-devterm-charging.rules should look like this. Then, after a reboot my amps went from 0,7A to almost 2A

KERNEL=="axp20x-battery",
ATTR{constant_charge_current_max}="2500000", 
ATTR{constant_charge_current}="2400000" 
6 Likes

For me the change above also changed the offline charging behavior. So for charging faster both online and offline, you will need this udev change.

Individual rules in udev rules files must be on a single line or they’re not parsed and applied correctly. Whatever your udev rule is doing is not what you think it’s doing.

2 Likes

Yes, that is what I said…

Your rules file is nonsensical. That anything regarding the charging current changed is a coincidence.

Yeah the ATTR lines in this rule would likely be ignored in this case and the change is probably from some default value being used. We can test this two ways

  1. Use udevadm to check the udev rules that are applied to the device
    See udev - ArchWiki for usage examples

  2. Comment out or remove the ATTR lines and see if performance changes. No change means the ATTR lines were not doing anything

hmm what I understand is that three rules are introduced:

  1. Match the axp228 module, and do nothing
  2. Anything with a constant_charge_current_max, set to 2500000
  3. Anything with a constant_charge_current, set to 2400000

… which kinda works correctly in this case?

1 Like

Well since this is a place of learning, LETS FIND OUT WHAT WORKS!

---------Testing Methodology------------

  • rebooted uConsole after each change
  • measurement taken after reboot, uConsole power ON
  • fresh uConsole image (official)
  • in-line USB meter readings constantly change, 3 samples taken at about 10s intervals & averaged
  • Starting battery charge level reported by uConsole: 72%

NOTE: all tests done with same Amazon Basics 5v 2a wall wart and USB A to C cable because I dont have a C to C in-line USB tester to try a higher power TypeC charger

---------------RESULTS-------------------
Testing @supercom32’s version first

  1. Default (no charging rules file)
    4.77v 3.968w 0.80a
  2. Empty file (no rules)
    No Change 4.75v 4.101w 0.84a
  3. Rule added KERNEL=="axp20x-battery"
    No Change 4.81v 4.012w 0.85a
  4. Rule changed: KERNEL=="axp20x-battery", ATTR{constant_charge_current_max}="2500000"
    No Change 4.72v 3.877w 0.82a
  5. Rule changed: KERNEL=="axp20x-battery", ATTR{constant_charge_current_max}="2500000", ATTR{constant_charge_current}="2400000"
    4.69v 6.284w 1.33a

Testing @Dezorian’s version

  1. Default (no charging rules file)
    4.78v 4.120w 0.86a
  2. Empty file (no rules)
    No Change 4.74v 4.087w 0.81a
  3. Rule added KERNEL=="axp20x-battery"
    No Change 4.79v 4.133w 0.85a
  4. Rule added on new line: ATTR{constant_charge_current_max}="2500000"
    No Change 4.82v 4.069w 0.84a
  5. Rule added on new line: ATTR{constant_charge_current}="2400000"
    4.72v 6.701w 1.41a
    NOTE: This method was consistently slightly higher while charging on my uConsole than supercom32’s method.

Testing each rule by itself

  1. Default (no charging rules file)
    4.79v 3.988w 0.79a
  2. Empty file (no rules)
    No Change 4.80v 4.010w 0.82a
  3. Rule added KERNEL=="axp20x-battery"
    No Change 4.91v 4.107w 0.87a
  4. Removed last rule, added rule: ATTR{constant_charge_current_max}="2500000"
    No Change 4.92v 4.32w 0.90a
  5. Removed last rule, added rule: ATTR{constant_charge_current}="2400000"
    No Change 4.87v 4.28w 0.84a
  6. Looks like both ATTR are needed for this to work. Edited file like so: ATTR{constant_charge_current_max}="2500000",
    ATTR{constant_charge_current}="2400000"
    4.71v 6.782w 1.45a

Conclusion:
Both ways work, and the uConsole takes longer to reboot than I would like. Will def just reload the udev rules for testing next time im playing with this myself, but wanted to make sure there was no interference in the testing im sharing here.

@SamusAranX you may be interested in these findings too :smiley:

7 Likes

Slightly off topic:

Just so that everyone can benefit, I just realised that while installing the black power button is ascetically pleasing, it’s really is a beginners trap! I had no idea that there were power and charging LEDs under the button (which is why they provide a clear button option). Since the manual didn’t mention anything about it, I assumed the white buttons was for the other uConsole color scheme.

So if you want to see your power status and charge status, you need to use the white button. Unfortunately, since it’s buried under the entire main-board assembly, you’ll need to take the unit completely apart to access it. So save yourself the trouble and just use it from the start if you want all your LED indicators to be visible.

5 Likes

Is the modification valid only for the CM4 version? Is the modification applicable to the A06 version?

Barry checked this rule change on the A06 and didn’t see any appreciable benefit. Here is a link to his post earlier in this thread:

Thanks this worked on my CM4
(Assuming i can trust cat /sys/class/power_supply/axp20x-battery/constant_charge_current)

hmm maybe this is better
alex@uConsole:~ $ cat /sys/class/power_supply/axp20x-battery/uevent
POWER_SUPPLY_NAME=axp20x-battery
POWER_SUPPLY_TYPE=Battery
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_ONLINE=1
POWER_SUPPLY_STATUS=Charging
POWER_SUPPLY_VOLTAGE_NOW=4173000
POWER_SUPPLY_CURRENT_NOW=680000
POWER_SUPPLY_CONSTANT_CHARGE_CURRENT=2400000
POWER_SUPPLY_CONSTANT_CHARGE_CURRENT_MAX=2400000
POWER_SUPPLY_HEALTH=Good
POWER_SUPPLY_VOLTAGE_MAX_DESIGN=4200000
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=3300000
POWER_SUPPLY_CAPACITY=85
POWER_SUPPLY_ENERGY_FULL=8000000
POWER_SUPPLY_ENERGY_NOW=7500000

1 Like

If anyone is looking through this thread wondering how to just fix the charging current and speed up charging, here’s a canonical one-liner to make it happen:

Run:

echo 'KERNEL=="axp20x-battery", ATTR{constant_charge_current_max}="2200000", ATTR{constant_charge_current}="2000000"' | sudo tee /etc/udev/rules.d/99-uconsole-charging.rules

And reboot.

Note that I’ve chosen a slightly lower current to balance heat with speed. Tune as desired.

15 Likes

Perhaps if someone has the ability, we can simply update the core OS image to have these settings set by default to something sane. This would basically eliminate this whole topic all together. :smiley:

1 Like

trisweb > It works. Now I see over 2.000mA in charging. But when battery got 100% it is not stopping to charge, still 2.000mA. Is it safe at all?!

Yes, most likely fine. The charging circuitry is embedded, so the logic for charging the battery correctly is baked in. It’s most likely just not fully complete with its cycle despite reading 100%. Most Lithium Ion chargers will switch to a constant-voltage mode to top up the battery to the right level, sometimes for a long time, before being completely finished.

by the way i was just wondering, What if we increase the value to be more than 2500000 then will it increase the charging speed or will it explode in my hand.

And if we can increase it then till what value it will be safe

I believe that 2.2 amps is the most current that the axp228 can actually supply. AXP228_PMU_Power_Product_X-Powers

Your batteries should have a spec sheet which lists the maximum charge and discharge they are rated for.