Skip to main content

ESP-IDF

This chapter contains the following sections. Please read as needed:

ESP-IDF Getting Started

New to ESP32 ESP-IDF development and looking to get started quickly? We have prepared a general Getting Started Tutorial for you.

Please Note: This tutorial uses the ESP32-S3-Zero as a teaching example, and all hardware code is based on its pinout. Before you start, it is recommended that you check the pinout of your development board to ensure the pin configuration is correct.

Setting Up the Development Environment

info

For the ESP32-S3-Touch-LCD-3.5B development board, ESP-IDF V5.5.0 or above is required.

note

The following guide uses Windows as an example, demonstrating development using VS Code + the ESP-IDF extension. macOS and Linux users should refer to the official documentation.

Version Selection

The screenshots in this section use ESP-IDF V5.5.2 as an example. When installing, please select the ESP-IDF version that matches your board's example.

Install the ESP-IDF Development Environment

  1. Download the installation manager from the ESP-IDF Installation Manager page. This is Espressif's latest cross-platform installer. The following steps demonstrate how to use its offline installation feature.

    Click the Offline Installer tab on the page, then select Windows as the operating system and the ESP-IDF version you need (the version shown in the screenshot is for reference only — choose the version that fits your actual needs).

    Download EIM and offline package

    After confirming your selection, click the download button. The browser will automatically download two files: the ESP-IDF Offline Package (.zst) and the ESP-IDF Installer (.exe).

    Download EIM and offline package 2

    Please wait for both files to finish downloading.

  2. Once the download is complete, double-click to run the ESP-IDF Installer (eim-gui-windows-x64.exe).

    The installer will automatically detect if the offline package exists in the same directory. Click Install from archive.

    Auto-detect offline package

    Next, select the installation path. We recommend using the default path. If you need to customize it, ensure the path does not contain Chinese characters or spaces. Click Start installation to proceed.

    Select installation path
  3. When you see the following screen, the ESP-IDF installation is successful.

    Installation successful
  4. We recommend installing the drivers as well. Click Finish installation, then select Install driver.

    Install drivers via ESP-IDF Installation Manager

Install Visual Studio Code and the ESP-IDF Extension

  1. Download and install Visual Studio Code.

  2. During installation, it is recommended to check Add "Open with Code" action to Windows Explorer file context menu to facilitate opening project folders quickly.

  3. In VS Code, click the Extensions icon Extensions Icon in the Activity Bar on the side (or use the shortcut Ctrl + Shift + X) to open the Extensions view.

  4. Enter ESP-IDF in the search box, locate the ESP-IDF extension, and click Install.

    Search and install ESP-IDF extension in VS Code

  5. For ESP-IDF extension versions ≥ 2.0, the extension will automatically detect and recognize the ESP-IDF environment installed in the previous steps, requiring no manual configuration.

Example

The ESP-IDF examples are located in the ESP-IDF directory of the example package.

ExampleBasic Program DescriptionDependency Library
01_factoryComprehensive test program-
02_qmi8658_examplePrint IMU data-
03_pcf85063_examplePrint data from the RTC-
04_axp2101_examplePrint data from the power management IC-
05_lvgl_exampleRun the official LVGL Demo UI-
06_lvgl_imageDisplay an image using LVGL-
07_lvgl_image_sdDisplay an image from the TF card using LVGL-

01_factory

Example Description

  • This is a comprehensive example for the ESP32-S3-Touch-LCD-3.5B, and is also the factory‑default flashed example.

Hardware Connection

  • Connect the board to the computer.

Operation Result

  • Touch test: slide your finger on the screen to see the trajectory. Press "X" to exit the touch test.

  • Swipe left/right to switch between screens.

02_qmi8658_example

Example Description

  • This example demonstrates driving the QMI8658 on the ESP32-S3-Touch-LCD-3.5B to read and print accelerometer, gyroscope, and IMU temperature data.

Hardware Connection

  • Connect the board to the computer.

Code Analysis

  • Initialize and start the test program

    i2c_master_bus_handle_t i2c_bus_handle = bsp_i2c_init();
    bsp_qmi8658_init(i2c_bus_handle);
    bsp_qmi8658_test();

Operation Result

  • The screen shows no output

  • Open the serial monitor

03_pcf85063_example

Example Description

  • This example demonstrates driving the PCF85063 on the ESP32-S3-Touch-LCD-3.5B to set the time/date and read the time.

Hardware Connection

  • Connect the board to the computer.

Code Analysis

  • Initialize and start the test program

    i2c_master_bus_handle_t i2c_bus_handle = bsp_i2c_init();
    bsp_pcf85063_init(i2c_bus_handle);
    bsp_pcf85063_test();

Operation Result

  • The screen shows no output
  • Open the serial monitor

04_axp2101_example

Example Description

  • This example demonstrates using XPowers to drive the AXP2101 and printing data via the serial port.

Hardware Connection

  • Connect the board to the computer.

Code Analysis

  • Initialize

    i2c_master_bus_handle_t i2c_bus_handle = bsp_i2c_init();
    bsp_axp2101_init(i2c_bus_handle);

Operation Result

  • The screen shows no output

  • Open the serial monitor

05_lvgl_example

Example Description

  • This example demonstrates running the LVGL example program on the ESP32-S3-Touch-LCD-3.5B.

Hardware Connection

  • Connect the board to the computer.

Code Analysis

  • Select the LVGL example to run.

    // lv_demo_benchmark();
    // lv_demo_music();
    lv_demo_widgets();

Operation Result

  • Touch operation is supported.

06_lvgl_image

Example Description

  • This example demonstrates displaying an image with LVGL on the ESP32-S3-Touch-LCD-3.5B.

Hardware Connection

  • Connect the board to the computer.

Preparation

  • Open LVGL image converter website.

  • Import the image images/image_1.jpg and convert it; this will generate an image_1.c file.

  • Copy image_1.c to the main folder.

  • Add image_1.c to the CMakeLists.txt in the main folder

    idf_component_register(SRCS "main.cpp" "image_1.c"INCLUDE_DIRS ".")

Code Analysis

  • In main.c, add the following code to declare the image.

    LV_IMG_DECLARE(image_1);
  • Specify the image to be displayed.

    lv_img_set_src(img, &image_1);

Operation Result

07_lvgl_image_sd

Example Description

  • This example demonstrates displaying images from the TF card using LVGL on the ESP32-S3-Touch-LCD-3.5B, supporting formats such as jpg, bmp, png, bin, etc.

Hardware Connection

  • Connect the board to the computer.
  • Insert the TF card into the card slot.

Preparation

  • Insert the TF card into the computer.
  • Copy the images folder of this project to the root directory of the TF card.
  • Insert the TF card into ESP32-S3-Touch-LCD-3.5B

Operation Result

  • Touch operation is supported.