Difference between revisions of "Template:7inch DSI LCD C User Manual"

From Waveshare Wiki
Jump to: navigation, search
Line 57: Line 57:
  
 
#Step 2: Enter uname -a in the terminal to view the kernel version and input cd to find the corresponding file directory
 
#Step 2: Enter uname -a in the terminal to view the kernel version and input cd to find the corresponding file directory
 +
#5.15.61 runs the following command
 +
cd 5.15.61
 
#5.15.32 runs the following command
 
#5.15.32 runs the following command
cd 5.15.32
+
#cd 5.15.32
 
#5.15.56 runs the following command
 
#5.15.56 runs the following command
 
#cd 5.15.56
 
#cd 5.15.56

Revision as of 09:55, 23 September 2022

Overview

Features

  • 7inch IPS display with a capacitive touch panel, and its hardware resolution is 1024 x 600.
  • Supports up to 5-point capacitive touch.
  • Toughened glass capacitive touch panel with 6H hardness.
  • DSI interface, refresh rate up to 60Hz.
  • Working with Raspberry Pi, we provide the driver for Raspberry Pi OS.
  • Brightness is adjustable by software.
  • Support Pi 4B/3B+/3A+, CM3+/4 must be used with adapter cable.

Working with Raspberry Pi

Hardware Connection

  1. Connect the 7inch DSI LCD (C) (display hereafter) to the DSI interface of Raspberry Pi boards by 15PIN FPC cable.
  2. For the convenience of use, you can fix the Raspberry Pi board to the backside of the display by standoffs and screws provided.
  3. Connect the 4PIN cable between the display and the 40PIN of Raspberry Pi according to the picture below.

7inch DSI LCD C Wiring.jpg
The final connection is shown below:
7inch-DSI-LCD-C-5.jpg

Install Driver

Method 1: Use a pre-built image

We provide a ready-to-use image based on the 2022-01-28-raspios-bullseye-arm image. Please download it and unzip it to get the img file. Write the .img file to your TF card and test it in your Raspberry Pi.

Method 2: Install the driver manually

Note: If you use the Raspberry Pi OS system and don’t know the two branches of Raspberry Pi OS, you can check the following introduction #Raspberry Pi OS branch introduction

  1. Download the newest Raspberry Pi OS and unzip it.
  2. Connect the TF card to your PC and format it by SDFormatter software.
  3. Write the .img file to your TF card by Win32DiskImager software. Please take care of the drive and the file path when writing.
  4. After the image has finished writing, eject the TF card from PC and connect to the Raspberry Pi board.
  5. Power on Raspberry Pi, enable the terminal and run the following commands to install the driver. (You may need to log in the Pi via SSH or connect an HDMI display for installation).
#Step 1: Download and enter the Waveshare-DSI-LCD driver folder
git clone https://github.com/waveshare/Waveshare-DSI-LCD
cd Waveshare-DSI-LCD

#Step 2: Enter uname -a in the terminal to view the kernel version and input cd to find the corresponding file directory
#5.15.61 runs the following command
cd 5.15.61
#5.15.32 runs the following command
#cd 5.15.32
#5.15.56 runs the following command
#cd 5.15.56
#5.10.103 runs the following command
#cd 5.10.103

#Step 3: Please check the number of bits of the system currently in use as the 32-bit system should enter the 32 directory and the 64-bit system should enter the 64 directory
cd 32
#cd 64

#Step 4: Enter the command corresponding to your model to install the driver, pay attention to the selection of the I2C DIP switch
#7inch DSI LCD (C) 1024 × 600 Driver:
sudo bash ./WS_xinchDSI_MAIN.sh 7INCH I2C1
#7.9ich DSI LCD 400 × 1280 Driver:
#sudo bash ./WS_xinchDSI_MAIN.sh 7_9INCH I2C0
#11.9inch DSI LCD 320 × 1480 Driver:
#sudo bash ./WS_xinchDSI_MAIN.sh 11_9INCH I2C0
#2.8inch DSI LCD 480 × 640 Driver:
#sudo bash ./WS_xinchDSI_MAIN.sh 2_8INCH I2C0
#4inch DSI LCD 480 × 800 Driver:
#sudo bash ./WS_xinchDSI_MAIN.sh 4INCH I2C0

#Step 5: Wait for a few seconds, when the driver installation is complete and no error is prompted, restart and load the DSI driver and it can be used normally
sudo reboot

Note: To install the driver, the Raspberry Pi needs to be connected to the network
6. Reboot the Raspberry Pi and test

Rotation

Method 1

In the start menu, select: Preferences->Screen Configuration->Configure->Screens->DSI-1->Orientation, select the corresponding angle in it, click "√", select Yes, and restart.
4inch-DSI-LCD-Manual-02.jpg
2022/2/10 Note:

Known bugs in the current Bullseye branch:

1. If you use the above method to rotate after opening VNC, the rotation direction of the touch will be wrong.
2. The above rotation method will also rotate abnormally on Pi3. These two bugs will be fixed in later versions.
If you need to open VNC and rotate at the same time, or use it on Pi3, you can use method 2.

Method 2

Display rotation:

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
#Enter the command corresponding to the display rotation angle at the end of the autostart file, and it will take effect after rebooting the system.
#display rotated 90 degrees
xrandr --output DSI-1 --rotate right
#display rotated 180 degrees
xrandr --output DSI-1 --rotate inverted
#display rotated 270 degrees
xrandr --output DSI-1 --rotate left

Touch to Rotate:

sudo nano /boot/config.txt
#Modify the instruction of the touch rotation angle at the end of the config.txt file, and it will take effect after rebooting the system (The 0° touch direction instruction exist by default)
#90°:
dtoverlay=WS_xinchDSI_Touch,invertedx,swappedxy
#180°:
dtoverlay=WS_xinchDSI_Touch,invertedx,invertedy
#270°:
dtoverlay=WS_xinchDSI_Touch,invertedy,swappedxy
#0°:
dtoverlay=WS_xinchDSI_Touch

Backlight Control

Method 1

sudo nano /boot/config.txt
#In config.txt, change dtoverlay=WS_7inchDSI1024x600_Screen to the following command, where x is 0-255, 0 is the darkest, 255 is the brightest, and the default is the brightest)
dtoverlay=WS_7inchDSI1024x600_Screen,Backlight=x
#Such as:
dtoverlay=WS_7inchDSI1024x600_Screen,Backlight=100
# Just restart
reboot

Method 2

Waveshare provides a software for adjusting brightness in GUI (only supports Raspberry Pi OS), you can install it with the following commands.

cd 7inch-DSI-LCD-C
#If you are using the 32-bit system please enter 32 directory, for 64-bit system please enter 64 directory
cd 32
#cd 64
cd Backlight
sudo ./install.sh

After installing, you can choose Menu -> Accessories -> Brightness to open the software and adjust.

Top-2.png

Use CSI Camera on the Buster Branch

  • Description

The use of the DSI LCD needs to load the KMS display driver, which will conflict with the default camera subsystem raspicam of the Buster branch.

The libcamera camera subsystem needs to be compiled and installed before using the CSI camera normally if you are using the Buster branch system.

If the user uses the Bullseye branch, then no action is required when using the Raspberry Pi related CSI camera.

  • Hardware connection

Shutdown Raspberry Pi first, connect the camera to Raspberry Pi and power it on again.

Note: Please do not replug the camera while the Raspberry Pi is working, otherwise, the camera interface and camera may be damaged.

  • Update and open the camera

The libcamera-apps application supports Pi3 and Pi4. Before installing, you need to update your Raspberry Pi software:

sudo apt update

Configure the correct dtoverlay in /boot/config.txt file according to the camera type.

sudo nano /boot/config.txt

Add the following lines to the config.txt file:

# Take RPi Camera V2 as an example, the photosensitive chip is Sony IMX219, then add the following code:
dtoverlay=imx219
#Similarly, for OV5647 chip:
#dtoverlay=ov5647
#IMX477 chip:
#dtoverlay=imx477

Open camera by raspi-config:

sudo raspi-config

Choose Interface Options -》 P1 Camera and choose Yes -》 Finish -》 Yes, finally, reboot Raspberry Pi.

Install libcamera

Method 1

Note 1: It is recommended to use Pi4 to install and compile libcamera-apps instead of Pi3, because Pi4 has stronger performance and compilation is not easy to have errors. The compiled image can also be used on Pi3.

Note 2: In the process of installing libcamera, there may be errors in some steps. If you are a novice, it is recommended to directly burn #Method 1:use the pre-installed driver image,in which we have installed libcamera.

Install denpendencies of libcamera:

 sudo apt install libboost-dev -y
 sudo apt install libgnutls28-dev openssl libtiff5-dev -y
 sudo apt install qtbase5-dev libqt5core5a libqt5gui5 libqt5widgets5 -y
 sudo apt install meson -y
 sudo pip3 install pyyaml ply
 sudo pip3 install --upgrade meson

Download and built the libcamera:

 git clone git://linuxtv.org/libcamera.git
 cd libcamera
 meson build
 cd build
 meson configure -Dpipelines=raspberrypi -Dtest=false
 cd ..
 ninja -C build
 sudo ninja -C build install
  • libepoxy

Libcamera-apps requires libepoxy to be installed. First install its prerequisites:

sudo apt install libegl1-mesa-dev

Then download and build libepoxy:

cd
git clone https://github.com/anholt/libepoxy.git
cd libepoxy
mkdir _build
cd _build
meson
ninja
sudo ninja install
  • libcamera-apps

Libcamera-apps further operates as follows:

sudo apt install cmake libboost-program-options-dev libdrm-dev libexif-dev

To build libcamera-apps, enter:

cd
git clone https://github.com/raspberrypi/libcamera-apps.git
cd libcamera-apps
mkdir build
cd build
cmake ..
make -j4

Test the camera by libcamera-hello:

 ./libcamera-hello

About the comamnd:

 libcamera-still   #Similar to raspistill
 libcamera-vid     #Similar to raspivid
 libcamera-raw     #a version of libcamera-vid, use for save original video without compression.
 libcamera-hello   #Basic command for previewing camera.
 libcamera-jpeg    #A simple version of libcamera——Preview and captur JPEG.

Note: the libcamera-app will conver the original DSI driver, you need to install it again for displaying.

#For 7inch DSI LCD (C):
cd 7inch-DSI-LCD-C
cd xxx/xxx #Use different kernels, different interfaces, need to enter different directories
sudo ./WS_7inchDSI1024x600_MAIN.sh
sudo reboot
#For 4inch DSI LCD:
cd 4inch-DSI-LCD
cd xxx/xxx #Use different kernels, different interfaces, need to enter different directories
sudo ./WS_4inchDSI480x800_MAIN.sh
sudo reboot
#For 2.8inch DSI LCD:
cd 2.8inch-DSI-LCD
cd xxx/xxx #Use different kernels, different interfaces, need to enter different directories
sudo ./WS_2_8inchDSI480x640_MAIN.sh
sudo reboot
#For 7.9inch DSI LCD:
cd 7.9inch-DSI-LCD
cd xxx/xxx #Use different kernels, different interfaces, need to enter different directories
sudo ./WS_7_9inchDSI400x1280_MAIN.sh
sudo reboot
#For 11.9inch DSI LCD:
cd 11.9inch-DSI-LCD
cd xxx/xxx #Use different kernels, different interfaces, need to enter different directories
sudo ./WS_11_9inchDSI320x1480_MAIN.sh
sudo reboot

Method 2

Since there are many steps to install libcamera, it takes a long time. We provide a script for direct installation.
The specific operation steps are as follows:
1. Please update the Raspberry Pi first:

sudo apt-get update

2. Download the libcamera-install file and install it

git clone https://github.com/waveshare/libcamera-install.git
cd libcamera-install
sudo chmod +x install_libcamera_all.sh
sudo ./install_libcamera_all.sh

3. It is successful if the line "echo "install Succeed" is printed, and it is failed if the line "echo "install Fail" is printed.

After installing, three folders are saved in the libcamera-install directory, libcamera libcamera-apps libepoxy folders. If you want to reinstall the libcamera, you need to detect these folders first.

Affected by the network, the installation may be unsuccessful if you run it once, and you can run it several times.

Note: After installing libcamera-apps, the original DSI driver will be overwritten. In order to make the DSI LCD work normally, you need to reinstall the driver:

#For 7inch DSI LCD (C):
cd 7inch-DSI-LCD-C
cd xxx/xxx #Use different kernels, different interfaces, need to enter different directories
sudo ./WS_7inchDSI1024x600_MAIN.sh
sudo reboot
#For 4inch DSI LCD:
cd 4inch-DSI-LCD
cd xxx/xxx #Use different kernels, different interfaces, need to enter different directories
sudo ./WS_4inchDSI480x800_MAIN.sh
sudo reboot
#For 2.8inch DSI LCD:
cd 2.8inch-DSI-LCD
cd xxx/xxx #Use different kernels, different interfaces, need to enter different directories
sudo ./WS_2_8inchDSI480x640_MAIN.sh
sudo reboot
cd 7.9inch-DSI-LCD
cd xxx/xxx #Use different kernels, different interfaces, need to enter different directories
sudo ./WS_7_9inchDSI400x1280_MAIN.sh
sudo reboot
#For 11.9inch DSI LCD:
cd 11.9inch-DSI-LCD
cd xxx/xxx #Use different kernels, different interfaces, need to enter different directories
sudo ./WS_11_9inchDSI320x1480_MAIN.sh
sudo reboot


4. Restart the software.

sudo reboot


5. Test the camera to preview for 5s

cd /home/pilibcamera-install/libcamera-apps/build
./libcamera-hello

More

For more information about the libcamera, please refer to:

https://www.raspberrypi.org/documentation/linux/software/libcamera/README.md

https://github.com/raspberrypi/libcamera-apps/blob/main/README.md

https://www.raspberrypi.org/documentation/linux/software/libcamera/rpi_SOFT_libcamera_1p2.pdf

Raspberry Pi OS Introduction

On December 2, 2021, the Raspberry Pi OS was divided into two branches, the Buster branch, and the Bullseye branch.

  • The Buster branch is a continuation of the old system and is more stable. Use raspicam as the default camera subsystem. The Bullseye branch adds some new features, among which KMS is used as the default display driver, and libcamera is used as the default camera subsystem.
  • For projects that work with this display, we recommend that users use the Bullseye branch system, Because on this system it can be used normally with a simple configuration, and also can use the default I2C0 of the DSI interface to communicate without occupying the I2C1 in 40PIN GPIO of the Raspberry Pi.
  • For users who must use the Buster branch, we currently also provide related drivers, but because the DSI driver needs to load the KMS display driver by default, the default camera subsystem of raspicam under the Buster branch cannot be used and needs to be recompiled and installed the libcamera camera subsystem (for novices, there is a certain degree of difficulty). And in order to prevent the raspcam camera subsystem from conflicting with the DSI driver, the DSI driver will occupy the I2C1 in the Raspberry Pi 40PIN GPIO.
  • For the Bullseye branch, the Waveshare R&D team will maintain long-term updates. For the Buster branch, we will continue to support it until June 2024 (because the Raspberry Pi Foundation will not support the Buster branch after this time).

The following is the system support list for this display:

System name Branch Operating system bits
2022-01-28-raspios-bullseye-arm64 bullseye 64 bits
2022-01-28-raspios-bullseye-armhf bullseye 32 bits
2022-01-28-raspios-buster-armhf buster 32 bits
2021-10-30-raspios-bullseye-armhf bullseye 32 bits
2021-12-02-raspios-buster-armhf buster 32 bits


The download link of the image
RASPBERRY-PI-OS-BUSTER-BULLSEYE-04-01.png
Raspberry Pi OS is the Bullseye branch, and Raspberry Pi OS (Legacy) is the Buster branch. More information you can refer to:

Note: The above information was updated on February 12, 2022. Due to the frequent updates of the Raspberry Pi image, when you see this information, the relevant information may be out of date. The actual performance of the image shall prevail. This is only for reference .

Notes

1.Update the system

sudo apt-get update
sudo apt-get full-upgrade

After updating the system, some files of the originally installed driver will be overwritten, in this case the driver needs to be reinstalled to display normally.

2. Replace the motherboard

If the driver originally installed on Raspberry Pi 4 Model B, the user replaces the motherboard, such as modifying it to Raspberry Pi 3 Model B+, which will cause the display to fail to display normally. Because Pi4 and Pi3 need to load different driver files.

In this case, the driver needs to be reinstalled on the new motherboard to display normally.