Skip to content

ESP32-P4 Setup

The 8-DSI-TOUCH-A connects to ESP32-P4 via MIPI DSI 2-lane interface. This guide covers driver installation, backlight control, and basic configuration.

  • ESP-IDF v5.0 or newer installed
  • ESP32-P4 development board (e.g., ESP32-P4-NANO)
  • MIPI DSI cable (included with display)

The display driver is available from the ESP Component Registry.

Terminal window
idf.py add-dependency "waveshare/esp_lcd_jd9365_8"

This adds the JD9365 LCD controller driver to your project’s dependencies.

If you prefer manual installation:

  1. Clone the component repository
  2. Copy to your project’s components/ directory
  3. Run idf.py reconfigure
#include "esp_lcd_jd9365.h"
#include "driver/i2c.h"
// Initialize the MIPI DSI bus
esp_lcd_dsi_bus_config_t bus_config = {
.bus_id = 0,
.num_data_lanes = 2, // 2-lane MIPI
.phy_clk_src = LCD_CLK_SRC_DEFAULT,
.lane_bit_rate_mbps = 500,
};
esp_lcd_new_dsi_bus(&bus_config, &dsi_bus);

The BSP simplifies initialization:

#include "bsp/esp32_p4_nano.h"
void app_main(void)
{
// Initialize display with default settings
bsp_display_start();
// Get LVGL display handle
lv_disp_t *disp = bsp_display_get();
}

The display backlight is controlled via I2C. The backlight controller is at address 0x45, with brightness register 0x86.

#include "driver/i2c.h"
#define BACKLIGHT_I2C_ADDR 0x45
#define BACKLIGHT_REG 0x86
void set_backlight(uint8_t brightness)
{
uint8_t data[2] = {BACKLIGHT_REG, brightness};
i2c_master_write_to_device(I2C_NUM_0, BACKLIGHT_I2C_ADDR,
data, sizeof(data),
pdMS_TO_TICKS(100));
}
// Usage
set_backlight(0xFF); // Maximum brightness
set_backlight(0x80); // 50% brightness
set_backlight(0x00); // Off

With the ESP32-P4-NANO BSP:

#include "bsp/esp32_p4_nano.h"
void configure_backlight(void)
{
// Initialize backlight subsystem
bsp_display_brightness_init();
// Turn on at full brightness
bsp_display_backlight_on();
// Set specific level (0-100)
bsp_display_brightness_set(75);
// Turn off
bsp_display_backlight_off();
}

The GT9271 touch controller connects via I2C. The BSP handles touch initialization automatically.

#include "esp_lcd_touch_gt911.h"
esp_lcd_touch_config_t touch_config = {
.x_max = 800,
.y_max = 1280,
.rst_gpio_num = GPIO_NUM_NC,
.int_gpio_num = TOUCH_INT_GPIO,
.levels = {
.reset = 0,
.interrupt = 0,
},
.flags = {
.swap_xy = 0,
.mirror_x = 0,
.mirror_y = 0,
},
};
esp_lcd_touch_new_i2c_gt911(touch_io_handle, &touch_config, &touch_handle);
esp_lcd_touch_handle_t touch_handle;
uint16_t x[10], y[10];
uint8_t touch_cnt = 0;
esp_lcd_touch_read_data(touch_handle);
esp_lcd_touch_get_coordinates(touch_handle, x, y, NULL, &touch_cnt, 10);
for (int i = 0; i < touch_cnt; i++) {
printf("Touch %d: (%d, %d)\n", i, x[i], y[i]);
}

Most ESP32-P4 projects use LVGL for graphics. The BSP integrates LVGL automatically.

#include "lvgl.h"
#include "bsp/esp32_p4_nano.h"
void app_main(void)
{
bsp_display_start();
// Create a simple label
lv_obj_t *label = lv_label_create(lv_scr_act());
lv_label_set_text(label, "8-DSI-TOUCH-A\nESP32-P4");
lv_obj_center(label);
}
ParameterValue
InterfaceMIPI DSI 2-lane
Resolution800 × 1280
Refresh RateUp to 60Hz
Color Depth24-bit RGB
Touch Points10 simultaneous
  • Verify num_data_lanes = 2 in bus config
  • Check MIPI cable seating
  • Confirm 5V power to display
  • Verify I2C bus is initialized before backlight calls
  • Check I2C address (0x45) and pull-up resistors
  • Try direct I2C write to confirm communication

Adjust touch configuration flags:

.flags = {
.swap_xy = 1, // Swap X/Y if rotated 90°
.mirror_x = 1, // Mirror if touch is horizontally flipped
.mirror_y = 1, // Mirror if touch is vertically flipped
},