Skip to content

The First Lesson: Installation and Configuration of IDF-IDE and Printing "Hello World" via Serial Port

1. Product Introduction


1.1 product overview

The CrowPanel-ESP32 Advance HMI Display product is divided into 6 sizes, namely 7.0 inches, 5.0 inches, 4.3 inches, 3.5 inches, 2.8 inches, and 2.4 inches.Its main control chip uses ESP32-S3 as the core of the man-machine interface.

The resolution of the 7.0-inch display screen is 800 * 480, the screen driver chip is SC7277, and the touch driver chip is GT911;

5.0-inch display screen resolution of 800 * 480, screen driver chip ST7262, touch driver chip GT911;

4.3-inch display screen resolution of 800 * 480, screen driver chip ST7265, touch driver chip GT911;

3.5-inch display screen resolution of 320 * 480, screen driver chip ILI9488, touch driver chip GT911;

2.8-inch display screen resolution of 240 * 320, screen driver chip ST7789, touch driver chip FT6336U;

2.4-inch display screen with a resolution of 240 * 320, screen driver chip ST7789, and touch driver chip FT6336U.

wps1

Which combines powerful processing capabilities, diverse peripheral interfaces, and excellent low-power performance. Its integrated 2.4GHz Wi Fi and Bluetooth 5 (LE), combined with the module's built-in RF antenna, ensure the stability of wireless connection, especially suitable for HMI application scenarios with high requirements for wireless connection.

wps2

1.2 Hardware feature

After understanding the optimization of the product, let's take a closer look at the hardware changes.

For 4.3-inch, 5.0-inch, and 7.0-inch screens, they only have one USB interface that can be used for code burning, etc.

For 2.4-inch, 2.8-inch, and 3.5-inch, there are two USB ports here. When using the USB port for code burning, you need to first hold down the BOOT button, then press the RESET button, and then release them together to burn the code; The UART0 interface allows for direct code burning without the need to press any buttons.

wps3

Attention: For the three sizes of 2.4 inches, 2.8 inches, and 3.5 inches, USB OTG function is also available.

The USB OTG function of ESP32-S3 supports switching between host and device roles, allowing for the connection of peripherals such as keyboards, mice, USB drives, or as USB peripherals (such as virtual serial ports, HID devices) to communicate with the host. It is suitable for scenarios such as data transmission, peripheral control, debugging interfaces, custom USB devices, etc. It has high flexibility and simplifies IoT and embedded development.

For 3.5-inch, 4.3-inch, 5.0-inch, and 7.0-inch products, RTC circuits have been added to ensure the continuity and accuracy of system time in the event of a power outage, providing a reliable time reference for data recording and event monitoring.

wps4

Secondly, this wireless module can be used for communication and data transmission. It supports 802.11 a/b/g/n wireless communication standards, WiFi in the 2.4GHz frequency band, as well as low-power Bluetooth and Bluetooth 5.0, and also supports Zigbee NBIOT、LoRa、UWB、NF2401.

wps5

There are also some other interfaces and peripherals available for everyone to use. For example, the I2C interface can be used for sensor devices suitable for using I2C communication; UART0 interface, suitable for sensor devices that use serial communication; SD card slot, capable of meeting local storage requirements; Speaker interface, capable of connecting external speakers for playing songs, etc; Battery interface, which can be used for external battery power supply.

2. Download Visual Studio Code


Open the official website link:

https://code.visualstudio.com

Click to download.

wps6

Accept the license agreement and go next.

img

Accept the default location or click 'Browse...' to change the installation location.

wps8

Accept the resting default option and click 'Next >'...

Click install and waiting for the installation ...

wps9

Click 'Finish' to exit the installation and (by default) launch Visual Studio Code

wps10

3. Install the extension


Open Visual Studio Code and open Extension Manager

wps11

Click on the [Extensions] extension icon.

Select the C/C++ extension plugin and click [Install].

img

Search for keywords such as espressif, esp-idf, esp32, esp32s2, etc. in the Extensions.

Click [Install] for the esp-idf extension.

img

Open the command palette.

Click [View].

Select [Command Palette].

img

Or press the F1 shortcut key to open the command palette and enter in the command palette: ESP-IDF: Select where to save configuration settings.

img

Wait until the following progress bar is completed.

img

Then enter "ESP-IDF: Configure ESP-IDF extension" in the command palette, and click to select "ESP-IDF: Configure ESP-IDF extension".

img

After entering, select [EXPRESS].

img

Note: Select version v5.2.5.

In the following interface,click [Install] to start the installation.

img

Then, just wait patiently for the installation to be completed.

img

When you see this interface, it means the installation has been completed correctly.

img

4. Create a new IDF project.


click”New project”.

img

Fill in the project name, select the save location and the chip model.

Click "Choose Template".

img

Select an official Espressif example and choose the “hello_world” template.

img

Click”Create project using template hello_world”

img

Generate the newly created IDF project.

  1. The build folder is the build directory, used to store files generated during the compilation process.

  2. CMakeLists.txt is the CMake build file for the main application.

  3. hello_world_main.c is the source file of the main application.

  4. CMakeLists.txt is the top - level CMake build file, used to configure the entire project.

  5. sdkconfig is the project configuration file, which saves the configuration of idf.py menuconfig.

The significance of the header files included in the main program:

  1. stdio.h: The function of stdio.h is basically the same as its function in a standard C program. However, there are some specific considerations and extensions, especially in the embedded development environment related to the ESP32 series of chips.

  2. The function of the inttypes.h header file is similar to its function in standard C programming. It is mainly used to provide a series of macros, which can help developers write code that is independent of the size of integer types.

  3. The sdkconfig.h file is a very important configuration header file. It is generated by the project's configuration system, based on the choices made by the user during the project configuration process.

  4. The esp_chip_info.h header file provides some macro definitions and functions, which are used to obtain detailed information about the ESP chip, such as the chip model, functional features, and hardware configuration.

  5. The esp_flash.h header file provides functions and macro definitions related to the flash memory operations on the ESP chip.

  6. esp_system.h is a header file in the ESP-IDF (Espressif IoT Development Framework). It contains functions and macro definitions related to the system-level functions of Espressif chips such as ESP32, ESP32-S, and ESP8266.

  7. freertos/freertos.h is a general header file that includes the core functions of FreeRTOS.

  8. freertos/task.h is a header file specifically used for task management.

img

Select the corresponding serial port.

img

Select the chip type.

img

img

Configure the development board options.

img

Set the flash parameters.

img

Set the PSRAM parameters.

img

Click [Save].

img

Click to compile the project.

img

Wait for the compilation to complete.

img

Click "Flash".

img

Open the serial port and view the printed information.

img

img