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 Development Environment

info

For the ESP32-S3-GEEK development board, ESP-IDF version V5.4.1 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 example programs are located in the ESP-IDF directory of the example package.

01_Wireless_USB_flash_drive

  • This example turns the ESP32-S3-GEEK into a USB disk with wireless access. With a TF card, it becomes a high‑capacity wireless storage device. At the same time, you can connect to the ESP32-S3-GEEK's hotspot and perform file uploads/downloads via an HTTP file server, greatly improving user convenience. Suitable for learning the USB MSC function of the ESP32. The device can act as a mass storage device connected to a USB host, supports different storage methods, and uses callbacks to handle various events, testing stability and reliability.
  • Press the Boot button to reboot and exit the program.

Hardware Connection

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

Code Analysis

  • init_fat(): Initializes the FAT file system and mounts either the internal flash or an external TF card according to the configuration.

    • If using internal flash, specific functions are called depending on the ESP-IDF version.
    • If using an external TF card, appropriate initialization and mounting are performed based on the interface type (SPI or SDIO).
  • app_main(): The main function that coordinates initialization of different parts of the program, including file storage, Wi‑Fi (if configured), and USB MSC.

    • Calls init_fat to initialize file storage.
    • Initializes tinyUSB and installs the driver.

Code Flashing

  • Choose whether to display the Flash or TF card capacity. To select TF card capacity, pick the last option.
  • Ensure the TF card is inserted.
  • Select the board model (esp32s3) and the port.
  • Download via UART.
  • Flash the program.

Operation Effect

  • After a successful flash, replug the ESP‑S3‑GEEK development board. The computer will recognize a new USB drive.

  • Open the USB drive; you can browse the files on the TF card and perform file operations (add, delete, modify, query).

  • Turn on the computer's Wi‑Fi and connect to the ESP32-S3-GEEK's AP using the password Waveshare.

  • After successful connection, open a browser and go to IP: 192.168.4.1.

  • Once logged in, you can wirelessly upload and download files.