Difference between revisions of "Template:S5Pxx18-SPI-2.8TFT"

From FriendlyELEC WiKi
Jump to: navigation, search
(Under S5P4418 & Linux-3.4 Kernel)
(Connect SPI 2.8"LCD to S5P4418/S5P6818 Based Board)
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
===在S5P4418/S5P6818平台使用SPI 2.8寸屏===
+
===S5P4418/S5P6818===
  
以下内容仅适用于Linux-4.4内核, 以NanoPi Fire3为例,开机后,在终端上执行以下命令初始化SPI 2.8寸屏,这些操作只需要执行一次:
+
The following steps only apply to Kernel Linux-4.4. We took the NanoPi Fire3 as an example. Run the following commands to initialize FriendlyElec's 2.8" SPI LCD. These commands need to be run only once. <br />
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
sudo mount /dev/mmcblk0p1 /boot
 
sudo mount /dev/mmcblk0p1 /boot
Line 12: Line 12:
 
sudo reboot
 
sudo reboot
 
</syntaxhighlight>
 
</syntaxhighlight>
注意,在上述命令中,s5p6818-nanopi3-rev05.dtb是NanoPi Fire3开发板所用的内核dtb文件,其它开发板型号需要自已查看文件 /sys/devices/platform/board/info 中的信息来确定文件名,输入如下命令: <br />
+
Note: the "s5p6818-nanopi3-rev05.dtb" file is the kernel dtb file for the NanoPi Fire3. For another board you need to check its system's "/sys/devices/platform/board/info" file to figure out its dtb file.: <br />
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
cat /sys/devices/platform/board/info
 
cat /sys/devices/platform/board/info
 
</syntaxhighlight>
 
</syntaxhighlight>
在NanoPi Fire3开发板上,info文件的内容如下: <br />
+
Here is the info file's content for the NanoPi Fire3: <br />
 
Hardware        : NANOPI3<br />
 
Hardware        : NANOPI3<br />
 
Revision        : 0005<br />
 
Revision        : 0005<br />
 
Serial          : fa6818dba7110739<br />
 
Serial          : fa6818dba7110739<br />
其中,Hardware字段是NANOPI3,Revision字段是0005,CPU是S5P6818,所以内核dtb文件名为 s5p6818-nanopi3-rev05.dtb。<br />
+
The "Hardware" here is "NANOPI3", "Revision" is "0005", "CPU" is "S5P6818", therefore the NanoPi Fire3's kernel dtb file name is "s5p6818-nanopi3-rev05.dtb".<br />
 
<br />
 
<br />
配置完dtb文件,重启开发板后,可以用lsmod命令检查下是否加载了fb_st7789v模块:
+
After the dtb file is confirmed you can reboot your board and run the following command to check if the fb_st7789v module is loaded:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
lsmod
 
lsmod
 
</syntaxhighlight>
 
</syntaxhighlight>
正常会输出如下内容: <br />
+
Here is what you expect to see:<br />
 
Module                  Size  Used by<br />
 
Module                  Size  Used by<br />
 
fb_st7789v              3315  0<br />
 
fb_st7789v              3315  0<br />
 
fbtft                  31881  1 fb_st7789v<br />
 
fbtft                  31881  1 fb_st7789v<br />
 
<br />
 
<br />
以及用dmesg命令可以查看到SPI屏已经被初始化为fb1设备:
+
 
 +
Or you can run dmesg to check that. In our case after we ran dmesg we found that the SPI LCD was recognized as an "fb1" device:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
dmesg | grep fb_st7789v
 
dmesg | grep fb_st7789v
 
</syntaxhighlight>
 
</syntaxhighlight>
正常会输出如下内容: <br />
+
 
 +
Here is what you expect to see:<br />
 
[    6.728000] fb_st7789v: module is from the staging directory, the quality is unknown, you have been warned.<br />
 
[    6.728000] fb_st7789v: module is from the staging directory, the quality is unknown, you have been warned.<br />
 
[    6.908000] graphics fb1: fb_st7789v frame buffer, 320x240, 150 KiB video memory, 4 KiB buffer memory, fps=35, spi0.0 at 50 MHz<br />
 
[    6.908000] graphics fb1: fb_st7789v frame buffer, 320x240, 150 KiB video memory, 4 KiB buffer memory, fps=35, spi0.0 at 50 MHz<br />
接下事的情况就比较简单,无论是运行Qt,还是X-Windows,只需要正确设置Framebuffer设备为fb1即可。
+
Now as long as you set your system's framebuffer device to fb1 in either Qt or X-Windows you will see output in your LCD.
  
 
+
====Launch Lubuntu Desktop on 2.8"LCD====
====在2.8寸屏上运行Lubuntu桌面====
+
On lubuntu desktop run the following commands: <br />
lubuntu desktop系统里执行以下操作:
+
Firstly remove the armsoc configuration file:
首先删除armsoc的配置文件:
+
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
sudo rm -f /usr/share/X11/xorg.conf.d/20-armsoc.conf
 
sudo rm -f /usr/share/X11/xorg.conf.d/20-armsoc.conf
 
</syntaxhighlight>
 
</syntaxhighlight>
  
然后新建一个配置文件 /etc/X11/xorg.conf:
+
Secondly create a new configuration file /etc/X11/xorg.conf:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
sudo vi /etc/X11/xorg.conf
 
sudo vi /etc/X11/xorg.conf
 
</syntaxhighlight>
 
</syntaxhighlight>
  
内容如下:
+
Here is its content:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
Section "Monitor"
 
Section "Monitor"
Line 66: Line 67:
 
EndSection
 
EndSection
 
</syntaxhighlight>
 
</syntaxhighlight>
重启后可以看到图像: <br />
+
After reboot you will see the following GUI:<br />
[[File:s5pxx18-lubuntu-spi2.8tft.png|frameless|600px|s5pxx18-lubuntu-spi2.8tft.png]]
+
[[File:s5pxx18-lubuntu-spi2.8tft.png|frameless|600px|s5pxx18-lubuntu-spi2.8tft.png]]<br />
目前暂时不支持触摸屏,可使用鼠标和键盘操作。
+
A touch panel is currently not supported yet. You need to use a mouse and keyboard to operate.
  
====在2.8寸屏上运行Qt程序====
+
====Run Qt Application on 2.8"LCD====
在friendly-core系统终端里执行以下命令,运行一个Qt示例:
+
Open a terminal in friendly-core and run the following commands to start a Qt demo:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
. setqt5env
 
. setqt5env
Line 79: Line 80:
 
$QTDIR/examples/widgets/widgets/tetrix/tetrix
 
$QTDIR/examples/widgets/widgets/tetrix/tetrix
 
</syntaxhighlight>
 
</syntaxhighlight>
Qt示例画面如下所示:<br />
+
Here is a Qt demo:<br />
[[File:S5pxx18-friendlycore-spi2.8tft.png|frameless|600px|s5pxx18-lubuntu-spi2.8tft.png]]
+
[[File:S5pxx18-friendlycore-spi2.8tft.png|frameless|600px|s5pxx18-lubuntu-spi2.8tft.png]]<br />
目前暂时不支持触摸屏,可使用鼠标和键盘操作。
+
A touch panel is currently not supported yet. You need to use a mouse and keyboard to operate.
 +
 
 +
==Update Log==
 +
===Dec-15-2017===
 +
* Released English version

Latest revision as of 02:26, 21 December 2018

1 S5P4418/S5P6818

The following steps only apply to Kernel Linux-4.4. We took the NanoPi Fire3 as an example. Run the following commands to initialize FriendlyElec's 2.8" SPI LCD. These commands need to be run only once.

sudo mount /dev/mmcblk0p1 /boot
sudo apt-get update
sudo apt-get install device-tree-compiler
sudo fdtput /boot/s5p6818-nanopi3-rev05.dtb spi0/spidev@0 status -t s "disabled"
sudo fdtget /boot/s5p6818-nanopi3-rev05.dtb spi0/spidev@0 status
sudo fdtput /boot/s5p6818-nanopi3-rev05.dtb spi0/fbtft@0 status -t s "okay"
sudo fdtget /boot/s5p6818-nanopi3-rev05.dtb spi0/fbtft@0 status
sudo reboot

Note: the "s5p6818-nanopi3-rev05.dtb" file is the kernel dtb file for the NanoPi Fire3. For another board you need to check its system's "/sys/devices/platform/board/info" file to figure out its dtb file.:

cat /sys/devices/platform/board/info

Here is the info file's content for the NanoPi Fire3:
Hardware  : NANOPI3
Revision  : 0005
Serial  : fa6818dba7110739
The "Hardware" here is "NANOPI3", "Revision" is "0005", "CPU" is "S5P6818", therefore the NanoPi Fire3's kernel dtb file name is "s5p6818-nanopi3-rev05.dtb".

After the dtb file is confirmed you can reboot your board and run the following command to check if the fb_st7789v module is loaded:

lsmod

Here is what you expect to see:
Module Size Used by
fb_st7789v 3315 0
fbtft 31881 1 fb_st7789v

Or you can run dmesg to check that. In our case after we ran dmesg we found that the SPI LCD was recognized as an "fb1" device:

dmesg | grep fb_st7789v

Here is what you expect to see:
[ 6.728000] fb_st7789v: module is from the staging directory, the quality is unknown, you have been warned.
[ 6.908000] graphics fb1: fb_st7789v frame buffer, 320x240, 150 KiB video memory, 4 KiB buffer memory, fps=35, spi0.0 at 50 MHz
Now as long as you set your system's framebuffer device to fb1 in either Qt or X-Windows you will see output in your LCD.

1.1 Launch Lubuntu Desktop on 2.8"LCD

On lubuntu desktop run the following commands:
Firstly remove the armsoc configuration file:

sudo rm -f /usr/share/X11/xorg.conf.d/20-armsoc.conf

Secondly create a new configuration file /etc/X11/xorg.conf:

sudo vi /etc/X11/xorg.conf

Here is its content:

Section "Monitor"
    Identifier          "Primary"
    VendorName          "FriendlyARM"
EndSection
 
Section "Device"
    Identifier          "Primary"
    Driver              "fbdev"
    Option              "fbdev" "/dev/fb1"
EndSection

After reboot you will see the following GUI:
s5pxx18-lubuntu-spi2.8tft.png
A touch panel is currently not supported yet. You need to use a mouse and keyboard to operate.

1.2 Run Qt Application on 2.8"LCD

Open a terminal in friendly-core and run the following commands to start a Qt demo:

. setqt5env
export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb1
export QT_QPA_EGLFS_TSLIB=1
export QT_QPA_GENERIC_PLUGINS=tslib,evdevkeyboard
$QTDIR/examples/widgets/widgets/tetrix/tetrix

Here is a Qt demo:
s5pxx18-lubuntu-spi2.8tft.png
A touch panel is currently not supported yet. You need to use a mouse and keyboard to operate.

2 Update Log

2.1 Dec-15-2017

  • Released English version