LCD Display

This section describes how to use VisionFive 2 or VisionFive 2 Lite's SPI for LCD display. The 2.4inch LCD module is used in this demo program to show how pictures are displayed through an example program with Python.

Hardware Setup

Connect the 2.4inch LCD module to the 40-pin GPIO Header.

Figure 1. Connect the 2.4inch LCD to the 40-Pin Header
2.4inch LCD Module 40-Pin GPIO Header
Pin Number Pin Name
VCC 17 3.3V Power
GND 39 GND
DIN 19 GPIO52 (SPI MOSI)
CLK 23 GPIO48 (SPI SCLK)
CS 24 GPIO49 (SPI CE0)
DC 40 GPIO44
RST 11 GPIO42
BL 18 GPIO51

Run Demo Code

Perform the following steps on Debian of VisionFive 2 or VisionFive 2 Lite.

  1. Locate the directory where the test code, 2.4inch_LCD_demo, exists.

    1. Install the dependency.
      python3 -m pip install pillow
    2. Get the directory where VisionFive.gpio exists.

      python3 -m pip show VisionFive.gpio
      Note: The output depends on how the application is installed.
    3. Enter the VisionFive.gpio directory.

      cd <VisionFive.gpio directory>
    4. Enter the sample-code directory.

      cd ./VisionFive/sample-code/
    5. Enter the directory where the test code, 2.4inch_LCD_demo exists.
      cd ./lcddemo/example/
  2. Under the example directory, execute the following command to run the demo code.

    sudo python  2.4inch_LCD_demo
    Alternatively, you can also run the following command.
    sudo python3  2.4inch_LCD_demo
    On the 2.4inch LCD:
    • The following picture with the StarFive logo is displayed for 2 seconds.
    • The, the following two pictures are displayed in turn.
      Figure 2. Example Output
    Note: For details about the source code, see 2.4inch_LCD_demo Source Code.
  3. (Optional) Exit the Python3 Virtual Environment.

    deactivate