Difference between revisions of "Template:S5Pxx18-SPI-2.8TFT"
Line 23: | Line 23: | ||
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 /> | 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 /> | ||
− | + | 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> | ||
− | + | 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 /> | ||
Line 33: | Line 33: | ||
<br /> | <br /> | ||
− | + | 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> | ||
− | + | 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 /> | ||
− | + | 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. | |
− | + | ||
====在2.8寸屏上运行Lubuntu桌面==== | ====在2.8寸屏上运行Lubuntu桌面==== |
Revision as of 06:37, 15 December 2017
1 Connect SPI 2.8"LCD to S5P4418/S5P6818 Based Board
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 在2.8寸屏上运行Lubuntu桌面
在 lubuntu desktop系统里执行以下操作:
首先删除armsoc的配置文件:
sudo rm -f /usr/share/X11/xorg.conf.d/20-armsoc.conf
然后新建一个配置文件 /etc/X11/xorg.conf:
sudo vi /etc/X11/xorg.conf
内容如下:
Section "Monitor" Identifier "Primary" VendorName "FriendlyARM" EndSection Section "Device" Identifier "Primary" Driver "fbdev" Option "fbdev" "/dev/fb1" EndSection
重启后可以看到图像:
目前暂时不支持触摸屏,可使用鼠标和键盘操作。
1.2 在2.8寸屏上运行Qt程序
在friendly-core系统终端里执行以下命令,运行一个Qt示例:
. 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