Jump to content

rtc battery low


marcoaurelio

Recommended Posts

RTC battery charging in AXP209 PMU is disabled by default (in case there is no battery, or, mainly, non-rechargeable battery is used).

AXP20x driver in legacy kernel (3.4.x) can enable RTC battery charging if it is configured in script.bin for the device, but mainline (4.x) kernel doesn't have this function yet, and without proper method for per-board configuration (Device Tree) enabling it by default is unsafe.

 

Edit: I checked legacy kernel sources, looks like there is no code that reenables battery recharging, so once battery got discharged enough, it won't be charged again.

Link to comment
Share on other sites

I had the same problems. We run the device at a location without internet. I removed the RTC battery and measured the voltage: nothing.

After some hours of googling I found a solution to activate the charging power in the AXP209 PMU:

 

sudo apt-get install i2c-tools
sudo i2cset -f -y 0 0x34 0x35 0xA3

 

I checked this out and it works. It's probably an evil hack, but nevertheless the voltage measures ~3.0 V now. I checked the i2c bus register with i2cget first and the register showed the default value 0x22 according to the documentation.

 

The battery (at least in my device) is a MS621FE. The datasheet shows 2.8V to 3.3V (3.1V Standard) charging power. So the voltage is probably OK. I'm not sure about the charging current and if it is necessary to switch of charging after the battery is fully charged. The guy in [1] apparently has the same battery and says it works. I will resolder my battery and post a follow up on this.

 

And remember: USE THIS AT YOUR OWN RISK

 

Holger

 

References:

[1] http://learn.linksprite.com/pcduino/pcduino-hardware-basic-and-improve/how-to-change-axp209-registers/

[2] http://forum.linksprite.com/index.php?/topic/3051-change-axp209-registers-%EF%BC%88rtc%EF%BC%89/

[3] http://linux-sunxi.org/AXP209(look for register 0x35)

[4] http://datasheetz.com/data/Batteries/Lithium/MS621FE-datasheetz.html

Link to comment
Share on other sites

... or in new Armbian mainline kernel with my patch it can be activated by writing "1" to "/sys/power/axp_pmu/control/charge_rtc_battery"

 

I cheched AXP datasheet and battery (at least model mentioned in cubietruck schematics) datasheet, and if all AXP registers were reset, default values for voltage and current should be safe.

Link to comment
Share on other sites

Works like charm tnx!

 

The value seems to be persistant. Does the kernel save it or is the pmu config memory non-volatile?

 

The only Problem I have now is that the hwclock is ignored in the Ubuntu Vanilla Image. It does work in Jessie however.

The apparent main difference is that ubuntu seems to use initrd and jessie does not. Otherwise the kernel and boot

config do not show any difference. Could it be that the initrd clears the hwclock? (just a vague guess)

 

I switched to the Jessie image, now everything woks like expected.

Link to comment
Share on other sites

The value seems to be persistant. Does the kernel save it or is the pmu config memory non-volatile?

While PMU has any kind of power source available (main battery, RTC battery, AC IN or VBUS) it will keep this value in its internal register.

 

The only Problem I have now is that the hwclock is ignored in the Ubuntu Vanilla Image. It does work in Jessie however.

The apparent main difference is that ubuntu seems to use initrd and jessie does not. Otherwise the kernel and boot

config do not show any difference. Could it be that the initrd clears the hwclock? (just a vague guess)

Setting system time from RTC on boot is disabled on purpose, more info in this message.

Initrd needs to be configured in u-boot, otherwise it's not used (by default).

Link to comment
Share on other sites

Yes I saw that post. Interestingly it works nevertheless with the debian jessie image

Armbian_4.5_Cubietruck_Debian_jessie_4.2.3, apt-get upgraded to kernel 4.4.1.

 

One of the last messages on poweroff is sth. like: saving clock to hardware clock.

I left it for one night without power and restarted the next morning without network

and the time was set correctly. Maybe it has something to do with the fact that I

used a pre 4.3.3 image that was upgraded rather than using the post 4.3.3 image

mentioned in the post.

 

The ubuntu image Armbian_4.5_Cubietruck_Ubuntu_trusty_4.2.3, upgraded to 4.4.1

does not work.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines