Jump to content

Recommended Posts

Posted

EDIT: 04.01.2020 - Fixed patches to work with latest armbian sources. (references have changed)

 

Hi everybody,

 

Here is a tutorial to enable the Lemaker 7" Touchscreen on BananaPi Pro with Debian Buster and Mainline-Kernel 5.XX.XX.

 

Kernel: Mainline 5.4.6 / Buster
Board: BananaPi Pro

 

WebLinks:

    • https://forum.armbian.com/topic/1905-enabling-lcd-in-u-boot-kernel-472/
    • https://forum.armbian.com/topic/1849-touch-driver-banana-pi/
    • http://www.atakansarioglu.com/getting-started-bananapi-linux/
    • http://forum.lemaker.org/thread-15482-1-1.html
    • http://linux-sunxi.org/LCD

 

To make the 7"LCD and the Touchscreen working with BananaPi Pro we need to patch some files and change the kernel config to build the driver for the touchscreen.
To do this we need a working setup of the Armbian build tool chain (https://docs.armbian.com/Developer-Guide_Build-Preparation/)

 

/home/<USER>/build/cache/sources/u-boot/v201X.XX/configs/Bananapro_defconfig
/home/<USER>/build/cache/sources/u-boot/v201X.XX/arch/arm/dts/sun7i-a20-bananapro.dts
/home/<USER>/build/cache/sources/linux-mainline/linux-4.XX.y/arch/arm/boot/dts/sun7i-a20-bananapro.dts

 

1. U-Boot ( u-boot version that supports the LCD - must be compiled)

 

Start the build process with ./compile.sh CREATE_PATCHES=yes

 

When asked for:
[ warn ] Applying existing u-boot patch [ /home/[USER]/build/output/patch/u-boot-sunxi-current.patch ]
[ warn ] Make your changes in this directory: [ /home/[USER]/build/cache/sources/u-boot/v201X.XX ]
[ warn ] Press <Enter> after you are done [ waiting ]

 

a) edit /home/<USER>/build/cache/sources/u-boot/v201X.XX/configs/Bananapro_defconfig

 

add the following:

#7" LVDS LCD
CONFIG_VIDEO_LCD_MODE="x:1024,y:600,depth:24,pclk_khz:55000,le:100,ri:170,up:10,lo:15,hs:50,vs:10,sync:3,vmode:0"
CONFIG_VIDEO_LCD_PANEL_LVDS=y
CONFIG_VIDEO_LCD_POWER="PH12"
CONFIG_VIDEO_LCD_BL_EN="PH8"
CONFIG_VIDEO_LCD_BL_PWM="PB2"

 

b) edit /home/<user>/build/cache/sources/u-boot/v201X.XX/arch/arm/dts/sun7i-a20-bananapro.dts

 

 add after:

 

&i2c2 {
    ...
};

 

the following:

&i2c3 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&i2c3_pins>;
	edt: edt-ft5x06@38 {
		compatible = "edt,edt-ft5x06", "edt,edt-ft5206";
		reg = <0x38>;
		pinctrl-names = "default";
		pinctrl-0 = <&edt_ft5x06_pins_a &edt_ft5x06_pins_b>;
		interrupt-parent = <&pio>;
		interrupts = <7 9 IRQ_TYPE_EDGE_FALLING>;
		touchscreen-size-x = <1024>;
		touchscreen-size-y = <600>;
	};
};

 

Add these two new sections to the end of the file:

&pio {
    edt_ft5x06_pins_a: ft5@0 {
        pins = "PH9";
        function = "irq";
        drive-strength = <20>;
        bias-pull-up;
    };
    edt_ft5x06_pins_b: ft5@1 {
        pins = "PH7";
        function = "gpio_out";
        drive-strength = <20>;
        bias-pull-up;
        output-high;
    };
};

&pwm {
      pinctrl-names = "default";
      pinctrl-0 = <&pwm0_pin>, <&pwm1_pin>;
      status = "okay";
};

 

Then save and press <Enter> to continue.

 

2. Kernel patches - DTB (Device Tree Blob) file that fits to your Kernel and supports pwm

 

When asked for:
[ warn ] Applying existing kernel patch [ /home/<USER>/build/output/patch/kernel-sunxi-current.patch ]
[ warn ] Make your changes in this directory: [ /home/<USER>/build/cache/sources/linux-mainline/orange-pi-5.XX ]
[ warn ] Press <Enter> after you are done [ waiting ]

 

c) edit /home/<USER>/build/cache/sources/linux-mainline/orange-pi-5.XX/arch/arm/boot/dts/sun7i-a20-bananapro.dts

 

add the same lines like section b)

 

Then save and press <Enter> to continue.

 

3. Compile Touchdriver

 

menuconfig > Device Drivers > Input Device Support > Touchscreens > EDT FocalTech FT5x06 I2C Touchscreen support

 

grafik.png.75a03d1a3b2332b9aaf10e31edfb6198.png

 

Exit and save the Kernel configuration.

 

This is the outcome. You probably have a newer version than 19.11.4:

2020-01-04_18h35_16.thumb.png.3a14d78e4e914cdb8a82cf2423e60d93.png

 


Now you can flash the image to a SD-Card or you have to install the new DEBs.

 

2020-01-04_18h38_18.png.6633f8519e653fc1eeee3602a7364c4c.png

 

dpkg -i linux-u-boot-current-bananapipro_19.11.4_armhf.deb
dpkg -i linux-dtb-current-sunxi_19.11.4_armhf.deb
dpkg -i linux-image-current-sunxi_19.11.4_armhf.deb

 

reboot

 

The result:

 

The LCD and the touchscreen are working. :D

 

Attention!
There is still the problem with the shutdown.
When the patches were made for the LCD, the board did not shut down completely during a shutdown (LCD still had voltage and the red LED on the board did not go out).
 

Workaround:

 

We need to disable the LCD before the shutdown is finished.

Therfore we have to create a script in the folder /lib/systemd/system-shutdown

 

e.g. (as root)

 

touch /lib/systemd/system-shutdown/lcd_off.sh

chmod +x /lib/systemd/system-shutdown/lcd_off.sh

nano /lib/systemd/system-shutdown/lcd_off.sh

 

add these lines:

 

#!/bin/bash

# LCD Power			PH12	H=8		(8-1)*32+12		= 236
# Backlight enable	PH8		H=8		(8-1)*32+8		= 232
# Backlight PWM		PB2		B=2		(2-1)*32+2		= 34

if [ ! -d "/sys/class/gpio/gpio34" ] 
then
    sudo sh -c 'echo "34" > /sys/class/gpio/export'
	sudo sh -c 'echo "out" > /sys/class/gpio/gpio34/direction'
	sudo sh -c 'echo "1" > /sys/class/gpio/gpio34/value'
fi
if [ ! -d "/sys/class/gpio/gpio232" ] 
then
    sudo sh -c 'echo "232" > /sys/class/gpio/export'
	sudo sh -c 'echo "out" > /sys/class/gpio/gpio232/direction'
	sudo sh -c 'echo "1" > /sys/class/gpio/gpio232/value'
fi
if [ ! -d "/sys/class/gpio/gpio236" ] 
then
    sudo sh -c 'echo "236" > /sys/class/gpio/export'
	sudo sh -c 'echo "out" > /sys/class/gpio/gpio236/direction'
	sudo sh -c 'echo "1" > /sys/class/gpio/gpio236/value'
fi

# LCD on/off
sudo sh -c 'echo "0" > /sys/class/gpio/gpio34/value'
sudo sh -c 'echo "0" > /sys/class/gpio/gpio232/value'
sudo sh -c 'echo "0" > /sys/class/gpio/gpio236/value'

 

The script will be executed right before the board powers off.

 

Measured power consumption:

 

PowerON (booting / lcd still off) = 0.4A - 0.5A

LCD turns on (still booting) = 0.85A - 1.05A

Boot process ended (LCD on) = 0.75A

Board on, LCD off = 0.35A - 0.45A ( -> LCD needs around 0.4A power )

shutdown -h now = 0.00A :D

 

4. Control the Power of the Backlight:

 

The backlight PWM is on PIN CON2 PB2.

 

Following the instructions on

http://linux-sunxi.org/GPIO#Accessing_the_GPIO_pins_through_sysfs_with_mainline_kernel

http://forum.lemaker.org/thread-10852-1-1.html

we have to export GPIO-PIN 34.

 

(position of letter in alphabet - 1) * 32 + pin number

position of letter in alphabet: B = 2
pin number: 2

 

( 2 - 1 ) * 32 + 2 = 34

 

echo 34 > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio34/direction

 

Power on the Backlight:
echo "1" > /sys/class/gpio/gpio34/value

 

Power off the Backlight:
echo "0" > /sys/class/gpio/gpio34/value

 

Now we could use a switch connected to a GPIO-IN to control the backlight.

 

Steffen

Posted

I have another board BananaPi - not BananaPi PRO

and have erroros:

 

arch/arm/boot/dts/sun7i-a20.dtsi:1126.20-1132.5: ERROR (phandle_references): /soc/pwm@1c20e00: Reference to non-existent node or label "pwm0_pins_a"

  also defined at arch/arm/boot/dts/sun7i-a20-bananapi.dts:280.6-284.3
arch/arm/boot/dts/sun7i-a20.dtsi:1126.20-1132.5: ERROR (phandle_references): /soc/pwm@1c20e00: Reference to non-existent node or label "pwm1_pins_a"

  also defined at arch/arm/boot/dts/sun7i-a20-bananapi.dts:280.6-284.3
arch/arm/boot/dts/sun7i-a20.dtsi:1371.21-1382.5: ERROR (phandle_references): /soc/i2c@1c2b800: Reference to non-existent node or label "i2c3_pins_a"

  also defined at arch/arm/boot/dts/sun7i-a20-bananapi.dts:168.7-182.3
ERROR: Input tree has errors, aborting (use -f to force output)
make[1]: *** [arch/arm/boot/dts/sun7i-a20-bananapi.dtb] Error 2
make[1]: *** Waiting for unfinished jobs....

 

sun7i-a20-bananapi.dts

Posted

Hi norrest,

 

I was able to fix my tutorial to work with the latest armbian sources.

The errors in your post are based on changed references in the *.dtsi file (e.g. old label: "pwm0_pins_a" new label: "pwm0_pin" ...).

 

Please try to follow the updated tutorial.

 

Steffen

Posted

Hello!

I did all as in this tutorial. Everything complied fine but when I try to install the u-boot package I get the following message:

dpkg -i linux-u-boot-current-bananapi_19.11.9_armhf.deb 
dpkg: regarding linux-u-boot-current-bananapi_19.11.9_armhf.deb containing linux-u-boot-bananapi-current:
 linux-u-boot-bananapi-next conflicts with armbian-u-boot
  linux-u-boot-bananapi-current provides armbian-u-boot and is to be installed.

dpkg: error processing archive linux-u-boot-current-bananapi_19.11.9_armhf.deb (--install):
 conflicting packages - not installing linux-u-boot-bananapi-current
Errors were encountered while processing:
 linux-u-boot-current-bananapi_19.11.9_armhf.deb

What could be the reason? Display is not outputting so far.

Thank you!

Posted

Tried with latest Armbian source and lemakers 5" lcd (without touch), which worked fine with the legacy kernel.

So I tried the CONFIG_VIDEO_LCD_MODE from an older post here and skipped all the i2c3 and pio and touchdriver stuff.

but unfortunately, all I achieved is an enlighted backlight. The Display doesn't react. HDMI is still working fine.

Does somebody know the correct settings in a) for the 5" display?

Thx

BR

Guido

 

Posted

OK - Found the line in http://linux-sunxi.org/LCD:

#5" LVDS LCD
CONFIG_VIDEO_LCD_MODE="x:800,y:480,depth:24,pclk_khz:30000,le:40,ri:40,up:29,lo:13,hs:48,vs:3,sync:3,vmode:0"
CONFIG_VIDEO_LCD_POWER="PH12"
CONFIG_VIDEO_LCD_BL_EN="PH8"
CONFIG_VIDEO_LCD_BL_PWM="PB2"

 

Adding this in /home/<USER>/build/cache/sources/u-boot/v*/configs/Bananapro_defconfig

and adding the pwm-section (exactly as above) in /home/<user>/build/cache/sources/u-boot/v*/arch/arm/dts/sun7i-a20-bananapro.dts and /home/<USER>/build/cache/sources/linux-mainline/orange-pi-5.4/arch/arm/boot/dts/sun7i-a20-bananapro.dts at the given time while executing ./compile.sh CREATE_PATCHES=yes creates the deb-files,

from which I applied the named three on a fresh installation from an image made by ./compile.sh without modifications.

But still - no output on Display - what have I overseen?

PWM is working and I can controll it via gpio34 as described above.

 

In the description is written, that 7"-Display is LVMS and 5"-Display is RGB, what doesn't make much sense, but I think this is meant by the presence ofthe Line CONFIG_VIDEO_LCD_PANEL_LVDS=y in case of 7"-LCD and the absence in case of 5"-LCD.

 

Is there anything else to be done? Any special driver to be activated, which isn't active by default?

 

Please, give me a hint!

 

BR

Guido

Posted

Thank you for grate tutorial.

I was able to compile kernel on vmware station, and install using dpkg on my old banana pi pro, but still 7 inch screen is black.

Maybe it's related to it's version. It's labelled as BL070-LVDS-002...

kernel seems to be installed and loaded correctly...

 

Spoiler

qczek@bananapipro:~$ uname -r
5.9.11-sunxi
qczek@bananapipro:~$ dpkg --list | grep linux-image
ii  linux-image-current-sunxi             21.02.0-trunk                       armhf        Linux kernel, version 5.9.11-sunxi

 

armianmonitor link: http://ix.io/2Gne

 

What do i wrong?

Thank you in advance

Kris

 

 

 

Posted

Can anyone in this thread comment on this section of documentation?  Is it still correct?  Needs updating?

 

I was updating some part of docs recently, but that part looked very old and I never tried to connect any screen, so I was not sure if it was still valid or not.  If anyone with more experience in this area could confirm or deny, I would appreciate it.

 

Of course a PR to improve documentation would be even better.  :thumbup:

Posted
Am 1.3.2020 um 21:40 schrieb gdampf:

Tried with latest Armbian source and lemakers 5" lcd (without touch), which worked fine with the legacy kernel.

So I tried the CONFIG_VIDEO_LCD_MODE from an older post here and skipped all the i2c3 and pio and touchdriver stuff.

but unfortunately, all I achieved is an enlighted backlight. The Display doesn't react. HDMI is still working fine.

Does somebody know the correct settings in a) for the 5" display?

Thx

BR

Guido

 

I had it previously working with stretch (see https://forum.armbian.com/topic/1905-enabling-lcd-in-u-boot-kernel-472/?do=findComment&comment=46632 ) but no luck yet with buster. Exactly the same result as you - backlight OK but no display on screen with 5" display.

 

Maybe boot.cmd or armbianEnv.txt need some tweaks? To be honest, I have no clue...

Posted
Am 5.1.2021 um 13:31 schrieb PavelR:

Hi,

I think that problem is with LVDS driver in Kernel. I am able to start LVDS during u-boot but when kernel is starting LVDS turn off.  I found this:

 

https://forum.armbian.com/topic/14560-sun4i-drm-and-lcd-panels/?do=findComment&comment=106071

 

 

The thread mentioned seems to be related to DRM. In the past it was much "simpler" to get the basic display to run (yet cumbersome enough) - only some dtb entries and the basic u-boot stuff, compile and dpkg. I do have a custom u-boot ready built and will try with the new DTB Editor and check if I can get it to work with an older kernel first. According to the above it should have worked with 5.4.6 ?! I suspect the LCD difficulties to be related to the HDMI troubles that have been reported as well here. I think I briefly saw that HDMI stopped working when kernel stepped in when I connected my PI to the TV last week for troubeshooting the LAN issue.

My new "spare" SD card should arrive this week, I tend not to harm my "production" system but am curious to get this going again in a safe environment.

Will provide update when I have any news!

Posted

I tried with 5.8.16 (current custom u-boot and custom dtb) and was not successful either. Going back to legacy (5.4.xx) would have required a legacy u-boot compiled and I refrained from doing that. If anyone else is lucky with a current kernel, pkease let me know...

Posted

Hello

Is there an image of the system already with 7" LCD support available somewhere?

 

I need to run the screen on Armbian but skip the compilation and installation. Unless there is no image ready I will have to sit down to do it ;)

Posted

Hello.
 

I followed the entire procedure. On different kernels and versions of the system. Always the same problem. When booting the system, the screen only boots up for a while and then it's dark. I can control the backlight.

Has anyone had the same problem?
Tomorrow I will check on another LCD because I have several (7" lcd for banana pro)

Posted (edited)

I checked the screen and it works normally. The power supply gets illuminated it can be seen that it works normally. To me the problem is with the framebuffer configuration

 

Edited by Cyryllo

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines