LEDs
#11
Just to be complete; I added my userid harmar to group gpio; as well the debian id-- in /etc/group

gpio:x:999:debian, harmar

When finished with the pin,

echo 359 > /sys/class/gpio/unexport

... will be playing around with longsleep's script and my LED lab / keep you posted, but excited to have the sysfs working embedded within Python scripting using subprocess...
#12
@longsleep, thanks again for the script reference (works well), and just a note I did have to change the shabang line (#!/usr/bin/python2) because it won't run in Python3, not as written anyway; string doesn't have an uppercase attribute.

I was able to cross reference the LEDs on my lab board and wiggle all their pins with sysfs very nicely/

Quote:BCM GP    Name  sysfs   Board
GPIO27     PH9      233    pin(13)
GPIO26     PC16      80    pin(37)
GPIO25     PC15      79    pin(22)
GPIO24     PC14      78    pin(18)
GPIO23     PC13      77    pin(16)
GPIO22     PC12      76    pin(15)
GPIO21     PC11      75    pin(40)
GPIO20     PC10      74    pin(38)
GPIO19     PC9        73    pin(35)
GPIO18     PC8        72    pin(12)
These pins were chosen because they are on a contiguous block (for the ribbon cable) plugging into the Sparkfun breakout board.
Big Grin

Grüß
#13
I am not a Linux expert, but I have some further information that might help with the LEDs.

CHGLED: According to the data sheet for the AXP803, REG 32H controls the charge LED output. Page 61 and 62 lists the function of each bit. The default value is 43H.

The bits that are relevant to the charge LED are bits 5 and 4:
CHGLED pin control
00: Hi-Z, 01: 25% 0.5Hz toggle, 10: 25% 2Hz toggle, 11: drive low, default: 00

The default setting disables the CHGLED output, so to enable it, bits 5 and 4 need to be changed. So depending on preference, there are two blink options, and full on.
The AXP803 is connected to USB0 according to the schematic (page 6).
I do not know how to write to it.

Now, the activity LED. While I was researching device trees, I came across code for the act LED on the Raspberry Pi 2 in the book ‘Exploring Raspberry Pi’, by Derek Molloy.

Code:
&leds {
         act_led: act {
                 label =  “led0”;
                 linux,default-trigger = “mmc0”;
                 gpios = <&gpio 47 0>;
         };
         pwr_led: pwr {
                 label = “led1”;
                 linux,default-trigger = “input”;
                 gpios = <&gpio 35 0>;
         };
};
#14
The AXP803 is connected via the RSB bus to the A64 (I2C compatible), the USB pins are connected for charger class detection but carry no data...

You can program the AXP registers either from u-boot or the AXP linux kernel driver, also the Pine dts contains most of the registers for the AXP...

How the AXP is handled is a bit more complicated since the A64 has an embedded management processor (OpenRISC based AR100, see http://linux-sunxi.org/AR100) which gets loaded with firmware during boot as part of loading the ATF and u-boot. This embedded managmenet processor handles most of the power-management tasks and suspend states. I wrote up some of my research on that over here:

https://forum.pine64.org/showthread.php?...ght=AXP803

I recently figured out some more info on how to properly add battery parameters and will make a post about that...

Programming the charge LED registers works for me, also programing the LED on the GPIO can be done via sysfs or the LED class as you described above, but you have to adapt the mappings for the pinmux...
Come have a chat in the Pine IRC channel >>


Forum Jump:


Users browsing this thread: 2 Guest(s)