Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums



(Advanced Search)

Forum Statistics
» Members: 30,113
» Latest member: moses
» Forum threads: 16,362
» Forum posts: 117,533

Full Statistics

Latest Threads
Pinephone software
Forum: General Discussion on PinePhone
Last Post: Csanderson0313
Yesterday, 05:22 PM
» Replies: 2
» Views: 167
Rock64 v2.0 u-boot SPI is...
Forum: General Discussion on ROCK64
Last Post: ju0n
07-05-2026, 11:02 AM
» Replies: 0
» Views: 83
Libby - ebook reader that...
Forum: PineNote Software
Last Post: kiwigoldfish
07-04-2026, 04:41 PM
» Replies: 6
» Views: 4,038
PineNote v1.2 - Charges N...
Forum: General Discussion on Pinebook Pro
Last Post: ttsp
07-02-2026, 02:52 AM
» Replies: 0
» Views: 246
How to change the PineNot...
Forum: General Discussion on PineNote
Last Post: cameronharring
07-01-2026, 12:22 PM
» Replies: 0
» Views: 136
PinePhone Pro disable Vol...
Forum: PinePhone Pro Hardware
Last Post: FR_IV
07-01-2026, 10:53 AM
» Replies: 1
» Views: 1,604
Star64/Starpro64 kernel b...
Forum: General
Last Post: tgbgreen
06-30-2026, 12:17 PM
» Replies: 1
» Views: 2,216
Manjaro affected by Arch ...
Forum: General
Last Post: tantamount
06-28-2026, 10:45 AM
» Replies: 0
» Views: 280
Fix Bricked SPI Flash, Pi...
Forum: PinePhone Pro Hardware
Last Post: FR_IV
06-27-2026, 05:00 PM
» Replies: 0
» Views: 198
irradium (based on crux l...
Forum: Linux on RockPro64
Last Post: mara
06-27-2026, 04:09 PM
» Replies: 12
» Views: 19,674

 
  Improve the life of your Pinebook battery by setting charger's voltage limits
Posted by: wlad - 06-11-2019, 02:27 PM - Forum: Linux on Pinebook - No Replies

It is a good practice for lithium battery powered devices to briefly think about the charging configuration which can significantly influence the health and usable capacity over time of a battery. Typically, a LiPo battery -- as is also used in the Pinebook -- has a minimum voltage of 3.0 volts (falling below quickly damages the battery) and a maximum voltage of slightly above 4.2 volts (further charging can destroy the battery and even ignite a fire). 

The higher the difference of the battery voltage to these two extremes is, the longer it will keep its initial capacity and the less stress it has to withstand (temperature as another dimension can be critical also, but will be ignored for now). So, quite good voltage limits for charging your Pinebook may be 3.2 to 4.0 volts. The more tentative these limits are set, the less actual battery capacity will be usable, thus less time your Pinebook will be working on battery before it needs to charge.

Luckily, the power management unit AXP803 of the Pinebook allows you to configure, how you wish to set the voltage limits for your actual use case. To this end, you can use the virtual sysfs files in '/sys/class/power_supply/axp20x-battery/' which allow read and write access. I tested this on the current Armbian 5.86, but other distros may offer similar functionality, as they might use the same "axp20x" kernel module for accessing the AXP803 power management unit. 

With read access, you can find out how the limits are currently set. By echoing values into the virtual files, you can persistently write settings to the unit (yes, written values reside on the AXP803 and keep changed even after reboot or shutdown). As the AXP803, for instance, supports only four possible maximum voltages (4.10v, 4.15v, 4.20v, or 4.35v), invalid values as write attempts are caught by the operating system.

Code:
cat /sys/class/power_supply/axp20x-battery/voltage_max_design
cat /sys/class/power_supply/axp20x-battery/voltage_min_design


Charging voltage limits (example with a range of 3.2v ... 4.1v) can be set with:

Code:
echo 4100000 > /sys/class/power_supply/axp20x-battery/voltage_max_design
echo 3200000 > /sys/class/power_supply/axp20x-battery/voltage_min_design


It seems that the maximum voltage is handled by AXP803 (or the kernel driver) with precaution so that my Pinebook battery only charged to up to 4.0 volts with this configuration. The capacity value that is provided in '/sys/class/power_supply/axp20x-battery/capacity' is adjusted automatically to the min and max settings.

I hope, some of you can use these hints to improve the endurance of your Pinebook's battery. Please post a message on your findings relating to practical observations or a different OS.

See for reference on more internals on the power management unit as investigated by xalius:
AXP803 Battery Charger Support


  Adding coherent_pool to boot.cmd on Xenial Mate by Ayufan causes boot loop
Posted by: k_mp - 06-11-2019, 01:36 PM - Forum: Linux on Pinebook - No Replies

Hi,

Due to my external WiFi driver, I added,

Code:
coherent_pool=4M
in /boot/boot.cmd at the end of
Code:
setenv bootargs
and ran
Code:
$ sudo mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr

But after a restart, the Pinebook didn't load up anymore and stuck in the boot loop (hangs on the logo). I'm using the Xenial Mate by Ayufan (the original factory distribution). Is there any solution to solve it? I know how to restore it. But to get my external WiFi works, I also need to have coherent_pool.
Unfortunately, since the Pinebook stuck in the boot logo, I can't see any logs.


  How to use dts or other setup to declare gpio pin Interrupt (e.g. a button)?
Posted by: dkebler - 06-11-2019, 01:11 PM - Forum: Pi2, Euler and Exp GPIO Ports - Replies (1)

Using armbian bionic mainline kernel on A64-v1.1 board
Linux pine64 4.19.38-sunxi64 #5.83 SMP Fri May 3 21:02:31 CEST 2019 aarch64 aarch64 aarch64 GNU/Linux

In RPI bionic could just set values in boot.txt.  Is this possible in armbian bionic mainline?

I know that one can use device tree overlays but can't find any examples specific to the A64.

Anyone have a dts file or otherwise know how to declare a pin as an interruptible input?  I've come across nothing in any A64 docs.


  HDMI out not working on Pine64 11.6" XFCE
Posted by: Fox7799 - 06-11-2019, 12:23 PM - Forum: Linux on Pinebook - Replies (3)

This is the software that came with my Pinebook 11.6" laptop but HDMI out doesn't work with XFCE or Plasma so I can't display on external screens. Everything else works well. Xubuntu is my preferred software so I don't want to install something else. How soon can this be fixed? Thanks


  Display battery charge value with LXDE and lxpanel
Posted by: wlad - 06-11-2019, 09:56 AM - Forum: Linux on Pinebook - Replies (1)

In my opinion, Armbian with LXDE as window manager is a good fitting combination for the limited power of the Pinebook. LXDE provides only few visual effects, so the system can be used with acceptable performance. Unfortunately, I had an issue with the battery plugin of the lxpanel (the bar where all current windows/processes are stacked into). 

Indication: Battery plugin (batt) of lxpanel does not show the current "capacity" (charged value in percent) of Pinebook's battery. Instead, it displays "0% charged" and continuously fires the low-battery alarm.

Reason: The integrated functionality of the battery plugin calculates the charged value by using the coulomb-based counters "charge_now" and "charge_full" (or alternatively "energy_now" and "energy_full"). These counters are usually provided by the power management unit's Linux kernel module. The kernel module (axp20x) for the AXP803 power management unit of the Pinebook does not provide "charge_now" and "charge_full" information. Instead, a percentage value for the current charge is provided as "capacity" (try 'cat /sys/class/power_supply/axp20x-battery/capacity').

Solution: I have changed the source code for the batt plugin with respect to the above mentioned reasons. Now, the percentage value is directly read from the corresponding sysfs file and not longer calculated indirectly.

The original code (lxpanel version 0.10.0) that you can find in 'lxpanel-0.10.0/plugins/batt/batt_sys.c' looked like this: 

Code:
battery* battery_update(battery *b) {
   gchar *gctmp; int promille;

   /* [...] */

   /* read from sysfs */
   b->charge_now = get_gint_from_infofile(b, "charge_now");
   b->energy_now = get_gint_from_infofile(b, "energy_now");

   b->current_now = get_gint_from_infofile(b, "current_now");
   b->power_now   = get_gint_from_infofile(b, "power_now");

   if (b->current_now < -1)
           b->current_now = - b->current_now;

   b->charge_full = get_gint_from_infofile(b, "charge_full");
   b->energy_full = get_gint_from_infofile(b, "energy_full");

   b->charge_full_design = get_gint_from_infofile(b, "charge_full_design");
   b->energy_full_design = get_gint_from_infofile(b, "energy_full_design");

   b->voltage_now = get_gint_from_infofile(b, "voltage_now");

   gctmp = get_gchar_from_infofile(b, "type");
   b->type_battery = gctmp ? (strcasecmp(gctmp, "battery") == 0) : TRUE;
   g_free(gctmp);

   g_free(b->state);
   b->state = get_gchar_from_infofile(b, "status");
   if (!b->state)
       b->state = get_gchar_from_infofile(b, "state");
   if (!b->state) {
       if (b->charge_now != -1 || b->energy_now != -1
               || b->charge_full != -1 || b->energy_full != -1)
           b->state = g_strdup("available");
       else
           b->state = g_strdup("unavailable");
   }

   if (b->charge_now != -1 && b->charge_full != -1)
       promille = (b->charge_now * 1000) / b->charge_full;
   else if (b->energy_full != -1 && b->energy_now != -1)
       /* no charge data, let try energy instead */
       promille = (b->energy_now * 1000) / b->energy_full;
   else
       promille = 0;

   b->percentage = (promille + 5) / 10; /* round properly */
   if (b->percentage > 100)
       b->percentage = 100;

/* [...] */

   return b;
}

This code has been changed to the following:

Code:
battery* battery_update(battery *b) {
   gchar *gctmp; int promille;
    /* [...] */

   /* read from sysfs */
   b->charge_now = get_gint_from_infofile(b, "charge_now");
   b->energy_now = get_gint_from_infofile(b, "energy_now");

   b->current_now = get_gint_from_infofile(b, "current_now");
   b->power_now   = get_gint_from_infofile(b, "power_now");

   if (b->current_now < -1)
           b->current_now = - b->current_now;

   b->charge_full = get_gint_from_infofile(b, "charge_full");
   b->energy_full = get_gint_from_infofile(b, "energy_full");

   b->charge_full_design = get_gint_from_infofile(b, "charge_full_design");
   b->energy_full_design = get_gint_from_infofile(b, "energy_full_design");

   b->voltage_now = get_gint_from_infofile(b, "voltage_now");
   // changed to direct read of percentage value (supported by pinebook)
   b->percentage = get_norm_gint_from_infofile(b, "capacity");

   gctmp = get_gchar_from_infofile(b, "type");
   b->type_battery = gctmp ? (strcasecmp(gctmp, "battery") == 0) : TRUE;
   g_free(gctmp);

   /* [...] */
   
   if (b->charge_now != -1 && b->charge_full != -1)
       promille = (b->charge_now * 1000) / b->charge_full;
   else if (b->energy_full != -1 && b->energy_now != -1)
       /* no charge data, let try energy instead */
       promille = (b->energy_now * 1000) / b->energy_full;
   else
       promille = 0;

   // percentage was indirectly calculated, this has changed to direct read of value
   //b->percentage = (promille + 5) / 10; /* round properly */
   if (b->percentage > 100)
       b->percentage = 100;

   /* [...] */
   return b;
}

As this requires a new function for reading the numerical value as provided by '/sys/class/power_supply/axp20x-battery/capacity', I introduced the following function which was inserted below the existing function "static gint get_gint_from_infofile(battery *b, gchar *sys_file)" in the same source code file "batt_sys.c":

Code:
/* get_norm_gint_from_infofile():
*         If the sys_file exists, then its value is converted to an int,
*         and returned.
*         Failure is indicated by returning -1. */
static gint get_norm_gint_from_infofile(battery *b, gchar *sys_file) {
   gchar *file_content = parse_info_file(b, sys_file);
   gint value = -1;

   if (file_content != NULL)
       value = atoi(file_content);
   g_free(file_content);

   return value;
}

The most time consuming part of this change was building the plugin's shared library file 'batt.so' because of all the required dependencies. But finally, it worked and I could replace the original file in '/usr/lib/aarch64-linux-gnu/lxpanel/plugins/'. The charge indicator now works as it should (except that I see no practical way how to predict the remaining power-on time).

I provide to you my build of 'batt.so' here (together with the changed 'batt_sys.c'), so that you do not need to build it by yourself:
.zip   lxde-lxpanel_batt-plugin.zip (Size: 39.15 KB / Downloads: 755)  
I use it on Armbian 5.86 Debian stretch with LXDE 9.9 and lxpanel version 0.9.3. It may also work with other versions of LXDE/lxpanel and in combination with different Armbian versions. Please post your message on whether it worked for you by mentioning your system configuration. Thanks!


  Udev rule for gpios for non root access
Posted by: dkebler - 06-11-2019, 09:06 AM - Forum: Pi2, Euler and Exp GPIO Ports - Replies (2)

Using armbian bionic mainline kernel on A64-v1.1 board
Linux pine64 4.19.38-sunxi64 #5.83 SMP Fri May 3 21:02:31 CEST 2019 aarch64 aarch64 aarch64 GNU/Linux

Need to allow non-root access to gpio pins (i.e. gpio group with access to export and unexport etc) via udev.  I've done this successfully before on an RPI but no matter what I try the gpio group and permissions are not set.   Maybe it's something specific to Pine64 so asking here.  

here is one version of rules I've tried.   using udevadm I've confirmed the file is read and loaded but the changes are not made

Code:
SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c 'find -L /sys/class/gpio/ -maxdepth 2 -exec chown root:gpio {} \; -exec chmod 770 {} \; || true'"


Any suggestions?  Anyone have a successful udev rules for this board?  If so please share


  Request for new Open Source Driver
Posted by: khaosgrille - 06-11-2019, 07:20 AM - Forum: Linux on RockPro64 - Replies (1)

Hi,

there is a new driver coming to the 5.2 linux kernel called Panfrost https://gitlab.freedesktop.org/panfrost. Afaik Rockpro6 has a Mali GPU and maybe it could use these drivers. Are there any plans to backport them to the current kernel or to jump to a newer kernel in the near future?
Kodi for example supports Panfrost and should be running much better with it.

Greetings,
Khaosgrille


  SPI support in GPIO
Posted by: mr_rabbit - 06-11-2019, 05:07 AM - Forum: General Discussion on ROCKPRO64 - Replies (2)

Hi!

I recently bought a RockPro64 with 4GB and would like to control a 1.8 LCD screen with SPI interface using the pins on the GPIO header.

The system is running ayufan's Ubuntu minimal. 

I had success in simple GPIO switching by using the RP64-GPIO library:
https://forum.frank-mankel.org/topic/292...-rp64-gpio

However, I was not able to access SPI. I could not find any help or documentation on the internet, not even on the Wiki.

Anyone had success with this?


  Failure in setting the display backlight with Armbian 5.86 [SOLVED]
Posted by: wlad - 06-11-2019, 03:36 AM - Forum: Linux on Pinebook - No Replies

I tested both current Armbian mainline images (Armbian_5.86_Pinebook-a64_Ubuntu_bionic_next_4.19.38_desktop and Armbian_5.86_Pinebook-a64_Debian_stretch_next_4.19.38) with my Pinebook 11.6" shipped in May '19 and both images have issues with the display brightness settings. 

Indication: After boot up, the backlight is set to maximum brightness and resetting it to other values in /sys/class/backlight/backlight/brightness (or via desktop power manager tool) shows no effect. The brightness level stays the same, although 'cat  /sys/class/backlight/backlight/brightness' returns changed values.

Solution: I managed to work around the issue by modifying the sun50i-a64-pinebook.dtb in /boot/dtb/allwinner/ in the following way:

(You can convert the dtb file to human-readable dts-format with 'dtc -I dtb -O dts /boot/dtb/allwinner/sun50i-a64-pinebook.dtb > converted.dts')

Initial content was:

Code:
[...]
backlight {
compatible = "pwm-backlight";
   pwms = < 0x43 0x00 0xc350 0x01 >;
brightness-levels = < 0x0 0x5 0xa 0xf 0x14 0x1e 0x28 0x37 0x46 0x55 0x64 >;
default-brightness-level = < 0x2 >;
  enable-gpios = < 0x22 0x03 0x17 0x00 >;
phandle = < 0x98 >;
};
[...]

After I removed the line with "phandle = < 0x98 >;", setting backlight brightness worked again. Unfortunately, the levels were reversed (1 meaning brightest, 9 meaning darkest, 0 and 10 turned off the backlight completely). Thus, I have changed the line with "brightness-levels" with inversed level values.

Overall, the final content of the dts file is:
Code:
[...]
backlight {
  compatible = "pwm-backlight";
   pwms = < 0x43 0x00 0xc350 0x01 >;
  brightness-levels = < 0x64 0x55 0x46 0x37 0x28 0x1e 0x14 0xf 0xa 0x5 0x0 >;
  default-brightness-level = < 0x2 >;
  enable-gpios = < 0x22 0x03 0x17 0x00 >;
};
[...]

In order to apply the changes, you have to compile the dts file back to dtb format and overwrite the original file in /boot/dtb/allwinner/. We will backup the original file before overwriting, in case after the reboot you end up with a dark display and need to boot from sd-card in order to undo the changes.
Code:
sudo cp /boot/dtb/allwinner/sun50i-a64-pinebook.dtb /boot/dtb/allwinner/sun50i-a64-pinebook.dtb.bac
sudo dtc -I dts -O dtb converted.dts > /boot/dtb/allwinner/sun50i-a64-pinebook.dtb

Please note, that this is only a shallow workaround. I do not know, what the effect of the phandle line was and why it works to set brightness without it. All I can say is that until now, I saw no negative side effects of this "solution".


  Pine hangs up on boot if I add my exFAT USB drive to /etc/fstab
Posted by: pqueiro - 06-10-2019, 12:07 PM - Forum: Ubuntu - No Replies

I can mount it manually fine off the CLI but if I add it to /etc/fstab it hangs the entire system when booting. I've got it on fstab as

Code:
/dev/sda2    /mnt/verbatim    exfat    defaults    0    1

Am I missing something in the options? Is it just checking something on boot and taking a long time? (it's a 2TB drive)

Given that it works if I mount it manually, I'm not sure what I'm doing wrong here  Sad

EDIT: setting pass to 0 and changing defaults to rw,auto,user,gid=1000,uid=1000 seems to have fixed it. I'm not 100% sure but I suspect it may have been the pass going to 0 that did it (as noted earlier in my original post, it's a 2TB USB3.0 drive and checking that filesystem would certainly have taken a long time). This means I have to be more hands-on about checking and maintaining the file system, but at least it now boots and mounts it correctly.