[BPI-R2] Control On-board LEDs

blinking can be disabled by echo 0 > /sys/class/leds/bpi-r2:isink:green/brightness

frequency can changes, you can try

echo 100 > /sys/class/leds/bpi-r2:isink:green/delay_on

echo 100 > /sys/class/leds/bpi-r2:isink:green/delay_off

and

echo 1000 > /sys/class/leds/bpi-r2:isink:green/delay_on

echo 100 > /sys/class/leds/bpi-r2:isink:green/delay_off

and compare what diffrences between the two set of commands

It seems hardware characteristics. i have checked the hardware value written by the driver, it indeed to writing the same value to their leds registers but there’s brightness differences

:stuck_out_tongue: then the led is off :wink: i want a steady-on

with 100/1000 i see no difference…tried with 10/1000 …there is a difference

echo 1 > /sys/class/leds/bpi-r2:isink:green/brightness

it is steady on on my setup …

[11:45] root@bpi-r2:~# L=/sys/class/leds/bpi-r2\:isink
[12:05] root@bpi-r2:~# echo 0 > $L:green/brightness                 #goes off 
[12:05] root@bpi-r2:~# echo 1 > $L:green/brightness                 #starts blinking

weird. it is different with my test.

echo 0 (to cancel blinking), and then echo 1 , i can get a always steady on

how about the other two leds ?

driver should use the same programming to those leds

the other 2 (red/blue) go on (1) and off (0), no blinking

timing with delay-nodes ist strange anyway…hard to describe

i see no difference between red,blue and green: https://github.com/frank-w/BPI-R2-4.14/blob/b80a9345899842733507fe40decec0ab7f0ba3cd/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts#L72

btw. i have HW rev 1.1 (if it matters), running debian 8 on my test-system with kernel 4.14.34

LEDs in /sys/class/leds/bpi-r2:pio (next to gpio40-header) are also strange:

  • red cannot be set
  • blue and green are swapped
  • 0/1 is swapped (1 turnes off, 0 turns on)

it looks like gpio problem

it can be solved by change properties such as label and low or high-active in gpio leds nodes in dts. Could you help to try which one is good setting?

where are the pio-leds defined? i lokked in bananapi.dts and mt7623.dtsi…found only the isink leds

how about the blinking of green isink-led? any idea? which HW-revision/kernel do you use?

compatible string is gpio-led, see

https://elixir.bootlin.com/linux/v4.17-rc1/source/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts#L87

it looks like board issue, I am using v1.1 with v4.16 rc5 and code is almost same between 4.14 you used and 4.16.

1 Like

ok, found it, thank you…in dts the are defined as high-active…in shematics they look low-active (led between vcc and gpio)…thats the first problem…to bad that in shematics the colors are not described…so we can only swap green&blue but have no clue whats up with red

fixed green and blue: https://github.com/frank-w/BPI-R2-4.14/commit/5da2e20c279ae77f13ea92d11f2e4c8c17ab0ce2 working now as expected and do not light the entire time (only red is always on).

in shematics the leds are named

led0=239 (r)
led1=241 (b)
led2=240 (g)

as you see by reading gpio-order you get r-g-b, with led-numbers you get r-b-g…seems like thats the reason for swapped green/blue

1 Like

xbgmsharp tested also the green-led-behaviour: green light is only blinking

On my board, the resistors R303 and R239-R240 are not populated, so the red LED can not be controlled. It is used only as a power indicator.

then i need to disable blinking of green isink led

@frank-w I clonned your git repo for kernel 4.14-main, configure it to have built in SATA and RAID support and then compile it using your build.sh script: build.sh build and then build.sh pack. I got an archive bpi-r2_4.14.34_main.tar.gz which I extract to SDCard to root. Now, when I try to boot from this kernel, it hangs on ā€œStarting kernelā€¦ā€. How can I debug what is wrong?

Part    Start Sector    Num Sectors     UUID            Type
  1     204800          524288          03ecee97-01     0c
  2     729088          14211072        03ecee97-02     83
mmc0 is available
reading bananapi/bpi-r2/linux/uEnv.txt
811 bytes read in 5 ms (158.2 KiB/s)
Loaded environment from uEnv.txt
Banana Pi bpi-r2 chip: mt7623n Service: linux
reading bananapi/bpi-r2/linux/uImage
8895605 bytes read in 544 ms (15.6 MiB/s)
reading bananapi/berryboot.img
** Unable to read file bananapi/berryboot.img **
bootm flag=0, states=70f
## Booting kernel from Legacy Image at 84000000 ...
   Image Name:   Linux Kernel 4.14.34-main
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    8895541 Bytes = 8.5 MiB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK

Starting kernel ...

in 4.14 the needed commands are:

  • ./build.sh importconfig
  • ./build.sh config to add raid-support
  • ./build.sh

The tar contains folders bpi-boot for uImage and bpi-root for modules…extract with same folders to the right partition

For debug you can use this Steps (done that for dma-debug):

To enable the earlyprintk :

-> make menuconfig -> kernel hacking -> early printk

options used to have the debugs on the serial port :

root=/dev/mmcblk0p2 rootfstype=ext4 rootwait console=ttyS0,115200 earlycon=uart8250,mmio32,0x11004000 earlyprintk=serial,ttyS0,115200 debug=7 loglevel=7 initcall_debug=1 ignore_loglevel=1 bootopts=vmalloc=496M

As I found a little free time I’m back to this task :slight_smile: After enabling debug I have: https://pastebin.com/BXXqwGMn So, I think I have not enabled some important options in kernel config, right?

@frank-w ./build.sh importconfig will be working only the system running from BPI-R2 motherboards, right? I’m compile this kernel on Virtual machine with Ubuntu 16.04 so, importconfig will be works on x86_64 arch too?

It maybe important: I use BPI-R2-EMMC-boot0-DDR1600-0k-0905.img.gz

bpi-bootsel BPI-R2-EMMC-boot0-DDR1600-0k-0905.img.gz /dev/mmcblk1boot0

build.sh from my repo works also with crosscompile…i also compile on x86_64.

You can look in my defconfig and compare with yours

Preloader has nothing to do with kernel…you do not need to change it

Try using an existing image and only replace uImage on boot-part and add modules folder to root…just to verify your kernel works

As for your log it seems pinctl-driver (mt2701) is missing

could not find pctldev for node /pinctrl@10005000/pcie_pin_default,

I’m update my local kernel source to 4.14.39 from your git repo. Run

./build.sh importconfig

and then

./build.sh config

to add RAID support. After that I compile the kernel using

./build.sh build

and then copy kernel image and modules to correct path on SDCard. When I have:

root=/dev/mmcblk0p2 rootfstype=ext4 rootwait console=ttyS0,115200 earlycon=uart8250,mmio32,0x11004000 earlyprintk=serial,ttyS0,115200 debug=7 loglevel=7 initcall_debug=1 ignore_loglevel=1 bootopts=vmalloc=496M

options for debug in uEnv.txt the boot process hangs on

[    4.289399] initcall exar_pci_driver_init+0x0/0x30 returned 0 after 30 usecs
[    4.296439] calling  mtk8250_platform_driver_init+0x0/0x28 @ 1
[    4.322980] 11004000.serial: ttyS0 at MMIO 0x11004000 (irq = 197, base_baud = 1625000) is a ST16650V2

If I’m back to default options in uEnv.txt file BPI finish booting and I can logon to OS but HDMI not works :confused:

In kernel 4.14.39 - it is possible to have old network interface name eth0 and eth1 instead wan@eth0 lanX@eth0 etc.?