4.3 KiB
| Supported Targets | ESP32-P4 |
|---|
| Supported LCD Controller | EK79007 |
|---|
| Supported Touch Controller | GT911 |
|---|
MIPI-DSI Avoid Tearing Example
esp_lcd provides several panel drivers out-of box, e.g. ST7789, SSD1306, NT35510. However, there're a lot of other panels on the market, it's beyond esp_lcd component's responsibility to include them all.
esp_lcd allows user to add their own panel drivers in the project scope (i.e. panel driver can live outside of esp-idf), so that the upper layer code like LVGL porting code can be reused without any modifications, as long as user-implemented panel driver follows the interface defined in the esp_lcd component.
This example demonstrates how to avoid tearing when using LVGL with MIPI-DSI interface screens in an esp-idf project. The example will use the LVGL library to draw a stylish music player.
The LVGL-related parameter configurations, such as LVGL's registered resolution, LVGL task-related parameters, and tearing prevention methods, can be configured in lvgl_port_v9.h.
This example uses the esp_timer to generate the ticks needed by LVGL and uses a dedicated task to run the lv_timer_handler(). Since the LVGL APIs are not thread-safe, this example uses a mutex which be invoked before the call of lv_timer_handler() and released after it. The same mutex needs to be used in other tasks and threads around every LVGL (lv_...) related function call and code. For more porting guides, please refer to LVGL porting doc.
How to use the example
ESP-IDF Required
Hardware Required
- An ESP32-P4-Function-EV-Board.
- A 7-inch 1024 x 600 LCD screen powered by the EK79007 IC, accompanied by a 32-pin FPC connection adapter board (LCD Specifications).
- A USB-C cable for power supply and programming.
- Please refer to the following steps for the connection:
-
Step 1. According to the table below, connect the pins on the back of the screen adapter board to the corresponding pins on the development board.
Screen Adapter Board ESP32-P4-Function-EV-Board 5V (any one) 5V (any one) GND (any one) GND (any one) PWM GPIO26 LCD_RST GPIO27 -
Step 2. Connect the FPC of LCD through the
MIPI_DSIinterface. -
Step 3. Use a USB-C cable to connect the
USB-UARTport to a PC (Used for power supply and viewing serial output). -
Step 4. Turn on the power switch of the board.
-
Configure the Project
Run idf.py menuconfig and navigate to Example Configuration menu.
Build and Flash
Run idf.py set-target esp32p4 to select the target chip.
Run idf.py -p PORT build flash monitor to build, flash and monitor the project. A fancy animation will show up on the LCD as expected.
The first time you run idf.py for the example will cost extra time as the build system needs to address the component dependencies and downloads the missing components from registry into managed_components folder.
(To exit the serial monitor, type Ctrl-].)
See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.
Troubleshooting
For any technical queries, please open an issue on GitHub. We will get back to you soon.