Google Chat: zj734465502@gmail.com
+86-0755-88291180
sales01@spotpear.com
dragon_manager@163.com
services01@spotpear.com
manager01@spotpear.com
WhatsApp:13246739196
ESP32-S3-Touch-LCD-4 is a low-cost, high-performance MCU board designed by Waveshare. It supports 2.4GHz WiFi and BLE 5, integrates high-capacity Flash and PSRAM, and has a 4-inch capacitive touch LCD screen on board to smoothly run GUI interface programs such as LVGL. Combine a variety of peripheral interfaces (e.g., CAN, I2C, RS485, etc.) to quickly develop applications such as HMIs for ESP32-S3. With a wide range of functions and interfaces, it can meet power consumption requirements in Internet of Things (IoT), mobile devices, smart home and other applications.
1. ESP32-S3N16R8 module 2. SW6106 battery charge and discharge chip 3. TJA1051T/3/1J 4. SP3485 chip 5. PCF85063 6. TCA9554PWR 7. XL1509-ADJE1 power chip 8. 3.5mm 10pin terminal socket 9. RTC battery header |
11. Micro SD card slot 12. PH2.0 Lithium battery interface 13. Buzzer 14. CAN and RS485 terminal resistor switch 15. Power indicator 16. BOOT button 17. RESET button 18. PWRKEY power on/off button |
ESP32-S3-WROOM-x | LCD | USB | SD | UART | CAN | RTC | OTS |
GPIO0 | CANRX | ||||||
GPIO1 | LCD_SDA | MOSI | |||||
GPIO2 | LCD_SCL | SCK | |||||
GPIO3 | R2 | ||||||
GPIO4 | MISO | ||||||
GPIO5 | B1 | ||||||
GPIO6 | CANTX | ||||||
GPIO7 | TP_SCL | RTC_SCL | SCL | ||||
GPIO8 | R3 | Expander_SDA | |||||
GPIO9 | G5 | Expander_SCL | |||||
GPIO10 | G4 | ||||||
GPIO11 | G3 | ||||||
GPIO12 | G2 | ||||||
GPIO13 | G1 | ||||||
GPIO14 | G0 | ||||||
GPIO15 | TP_SDA | RTC_SDA | SDA | ||||
GPIO16 | TP_INT | ||||||
GPIO17 | R5 | ||||||
GPIO18 | R4 | ||||||
GPIO19 | USB_DN | ||||||
GPIO20 | USB_DP | ||||||
GPIO21 | B5 | ||||||
GPIO38 | HSYNC | ||||||
GPIO39 | VSYNC | ||||||
GPIO40 | DE | ||||||
GPIO41 | LCD_PCLK | ||||||
GPIO42 | LCD_CS | ||||||
GPIO43 | RS485_RX | ||||||
GPIO44 | RS485_TX | ||||||
GPIO45 | B2 | ||||||
GPIO46 | R1 | ||||||
GPIO47 | B4 | ||||||
GPIO48 | B3 | ||||||
TCA9554PWR | - | - | - | - | - | - | - |
EXIO0 | TP_RST | ||||||
EXIO1 | BL_EN | ||||||
EXIO2 | LCD_RST | ||||||
EXIO3 | SD_CS | ||||||
EXIO4 | BLC | ||||||
EXIO5 | BEE_EN | ||||||
EXIO6 | RTC_INT | ||||||
EXIO7 | DO1 |
CONFIG_FREERTOS_HZ=1000 CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_ESPTOOLPY_FLASHMODE_QIO=y CONFIG_ESPTOOLPY_FLASHFREQ_120M=y [Need to be consistent with PSRAM] CONFIG_SPIRAM_MODE_OCT=y CONFIG_IDF_EXPERIMENTAL_FEATURES=y and CONFIG_SPIRAM_SPEED_120M=y [Need to be consistent with FLASH] CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y CONFIG_SPIRAM_RODATA=y CONFIG_ESP32S3_DATA_CACHE_LINE_64B=y CONFIG_COMPILER_OPTIMIZATION_PERF=y #The following LVGL configuration items are helpful for frame rate improvement (LVGL v8.3): #define LV_MEM_CUSTOM 1 or CONFIG_LV_MEM_CUSTOM=y #define LV_MEMCPY_MEMSET_STD 1 or CONFIG_LV_MEMCPY_MEMSET_STD=y #define LV_ATTRIBUTE_FAST_MEM IRAM_ATTR or CONFIG_LV_ATTRIBUTE_FAST_MEM=y
ESP32-S3-Touch-LCD-4 currently provides two development tools and frameworks, Arduino IDE and ESP-IDF, providing flexible development options, you can choose the right development tool according to your project needs and personal habits.
![]() | Arduino IDEArduino IDE is an open source electronic prototyping platform, convenient and flexible, easy to get started. After a simple learning, you can start to develop quickly. At the same time, Arduino has a large global user community, providing an abundance of open source code, project examples and tutorials, as well as rich library resources, encapsulating complex functions, allowing developers to quickly implement various functions. |
![]() | ESP-IDFESP-IDF, or full name Espressif IDE, is a professional development framework introduced by Espressif Technology for the ESP series chips. It is developed using the C language, including a compiler, debugger, and flashing tools, etc., and can be developed via the command lines or through an integrated development environment (such as Visual Studio Code with the Espressif IDF plugin). The plugin offers features such as code navigation, project management, and debugging. |
Each of these two development approaches has its own advantages, and developers can choose according to their needs and skill levels. Arduino are suitable for beginners and non-professionals because they are easy to learn and quick to get started. ESP-IDF is a better choice for developers with a professional background or high performance requirements, as it provides more advanced development tools and greater control capabilities for the development of complex projects.
This chapter introduces setting up the Arduino environment, including the Arduino IDE, management of ESP32 boards, installation of related libraries, program compilation and downloading, as well as testing demos. It aims to help users master the development board and facilitate secondary development.
Board name | Board installation requirements | Version number requirements |
---|---|---|
ESP32-S3-Touch-LCD-4 | "Install Offline" / "Install Online" | 3.0.7 |
Library Name | Description | Version | Library Installation Requirements |
---|---|---|---|
ESP32_Display_Panel | ST7701, GT911 driver library | v0.1.8 | "Install Online" or "Install Offline" |
ESP32_IO_Expander | TCA9554 IO expansion chip driver library | v0.0.4 | "Install Offline" (return value of IOExpander_Library changed) |
lvgl | LVGL graphical library | v8.4.0 | "Install Online" requires copying the demos folder to src after installation. "Install Offline" is recommended |
lv_conf.h | LVGL configuration file | —— | "Install Offline" |
File
-> New Sketch
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println("Hello, World!");
delay(2000);
}
File
-> Save As...
. In the pop-up menu, select the path to save the project, and enter a project name, such as Hello_World, click Save
①. Click to select the dropdown menu option Select Other Board and Port;
②. Search for the required development board model esp32s3 dev module and select;
③. Select COM Port;
④. Save the selection.
①. Compile the program; ②. Compile and download the program; ③. Download successful.
Demo | Basic Description | Dependency Library |
---|---|---|
01_PanelTest | Test the RGB screen | GFX_Library_for_Arduino |
02_LVGL_Porting | Test the RGB touch screen | GFX_Library_for_Arduino, Arduino DriveBus |
03_Rotation | Test RS-485 seat | GFX_Library_for_Arduino |
04_RS485_Test | Test RS-485 seat | GFX_Library_for_Arduino |
05_TWAIreceive | Test CAN seat | GFX_Library_for_Arduino |
06_TWAItransmit | Test CAN seat | SensorLib, GFX_Library_for_Arduino |
07_SD_Test | Test TF card slot | LVGL |
PSRAM
enabled, and some versions are set to OPI PSRAMHardware connection
Code analysis
setup()
:ESP_Panel
object and initialize the panel;loop()
:Result demonstration
Hardware connection
Code analysis
setup()
:ESP_Panel
object and initialize the panel, start the panel device, if the anti-tearing function is enabled, set the RGB bus parameters according to the LVGL configurationResult demonstration
Hardware connection
Code analysis
setup()
:rotateDisplay()
:This function is used to rotate the display interface. It receives a pointer of type lv_disp_t
and a rotation angle parameter
lv_disp_set_rotation
function to set the rotation angle of the LVGL displaylv_label_set_text_fmt
function to update the label text that displays the rotation angle to show the current rotation angleonRightBtnClickCallback()
:LV_DISP_ROT_270
, then set the rotation angle to LV_DISP_ROT_NONE
(no rotation); otherwise, increase the rotation angle by one unitrotateDisplay
function to actually perform the display rotation operationonLeftBtnClickCallback()
:LV_DISP_ROT_NONE
, then set the rotation angle to LV_DISP_ROT_270
(no rotation); otherwise, decrease the rotation angle by one unitrotateDisplay
function to actually perform the display rotation operationResult demonstration
Hardware connection
Code analysis
setup()
:Serial2.begin(115200, SERIAL_8N1, 43, 44);
: Initialize UART2, set the baud rate to 115200, set the data format to 8-bit data, no parity bit, 1 stop bit, and specify GPIO43 (RXD) and GPIO44 (TXD) as the transmit and receive pinsloop()
:Serial2.available()
, read data using Serial2.read()
, and when certain conditions are met, send the data from the buffer using Serial2.println(buffer)
to realize the reception and transmission of UART2 dataResult demonstration
Hardware connection
Code analysis
Result demonstration
Hardware connection
Code analysis
Result demonstration
Hardware connection
Code analysis
SDMMC_CLK
, SDMMC_CMD
, SDMMC_DATA
). If initialization fails, the program will enter an infinite loop, ensuring that no further operations are executed without successfully mounting the TF cardlistDir
function, list the files and directories under the root directory of the TF card, providing users with an intuitive understanding of the content stored on the TF card, making it convenient for subsequent file operations and managementResult demonstration
This chapter introduces setting up the ESP-IDF environment setup, including the installation of Visual Studio and the Espressif IDF plugin, program compilation, downloading, and testing of example programs, to assist users in mastering the development board and facilitating secondary development.
①Select the corresponding demo
②Its readme will state what chip the demo applies to (how to use the demo and the file structure are described below, omitted here)
③Click to create the demo
①.ESP-IDF Development Environment Version Manager, when our project requires differentiation of development environment versions, it can be managed by installing different versions of ESP-IDF. When the project uses a specific version, it can be switched to by utilizing it
②.Device flashing COM port, select to flash the compiled program into the chip
③.Select set-target chip model, select the corresponding chip model, for example, ESP32-P4-NANO needs to choose esp32p4 as the target chip
④.menuconfig, click it to Modify sdkconfig configuration file Project configuration details
⑤.fullclean button, when the project compilation error or other operations pollute the compiled content, you can clean up all the compiled content by clicking it
⑥.Build project, when a project satisfies the build, click this button to compile
⑦.Current download mode, the default is UART
⑧.flash button, when a project build is completed, select the COM port of the corresponding development board, and click this button to flash the compiled firmware to the chip
⑨.monitor enable flashing port monitoring, when a project passes through Build --> Flash, click this button to view the log of output from flashing port and debugging port, so as to observe whether the application works normally
⑩.Debug
⑪.Build Flash Monitor one-click button, which is used to continuously execute Build --> Flash --> Monitor, often referred to as "little flame"
CMakeLists.txt
.CMake
first reads the content of the top-level CMakeLists.txt
in the project directory to read the build rules and identify the content to be compiled. When the required components and demos are imported into the CMakeLists.txt
, the compilation tool CMake
will import each content that needs to be compiled according to the index. The compilation process is as follows:Demo | Basic Description |
---|---|
01_RS485_Test | Test RS-485 seat |
02_SD_Test | Test TF card slot |
03_RTC_Test | Test RTC clock and RTC interrupt |
04_TWAIreceive | Test CAN seat |
05_TWAItransmit | Test CAN seat |
06_LVGL_Proting | Test RGB touch screen |
Hardware connection
Code analysis
echo_task()
:Result demonstration
Hardware connection
Code analysis
waveshare_sd_card_init()
:This function is mainly used to initialize the TF card. First initialize I2C, pull down the CS pin of the TF card through I2C control chip. Next, configure the TF card mounting options, including whether to format when mounting fails, the maximum number of files, and the allocation unit size, etc. After that, initialize the SPI bus and mount the TF card file system using the configured SPI bus and mount options. If mounting is successful, return ESP_OK, indicating that the TF card initialization is complete.
waveshare_sd_card_test()
:This function is used to test the functionality of the TF card. First print the information of the initialized TF card. Then create a file, write data into it, rename the file, and read the content of the renamed file. Next, format the file system and check if the file has been deleted after formatting. Finally, create a new file and read its content, unmount the TF card and free up SPI bus resources when the test is complete.
Result demonstration
Hardware connection
Code analysis
app_main()
:Result demonstration
Hardware connection
Code analysis
waveshare_twai_receive()
:Result demonstration
Hardware connection
Code analysis
waveshare_twai_transmit()
:Result demonstration
Hardware connection
Code analysis
app_main()
: lv_demo_stress
, lv_demo_benchmark
, lv_demo_music
, lv_demo_widgets
, or example_lvgl_demo_ui
etc.Result demonstration
...\ESP32-S3-Touch-LCD-4-Demo\Firmware\bin
You can subscribe to the repository, just open an issue, explain your requirements clearly, engineers will be the first time to evaluate the requirements, if there is any progress and update the repository, and you can also joke about the product, share your experience, and put forward your ideas. ESP32-display-support
There is screen printing under the line of the screen, no screen printing is V1.0 version, screen printing is the corresponding version
1.When using wide voltage power supply, I2C devices cannot be identified, caused by the low SW6106 I2C. It is recommended to connect to the lithium battery for use. If the lithium battery cannot be connected, the SW6106 i2c line can be cut off.
1.SW6106 has light load detection. The solution is that I2C initializes to write 0x0A value to the 0x38 register of the 0x3C device every time it is powered on, or cycles for 1s to delay writing 0x01 to the 0x03 register of the 0x3C device to control the light load shutdown.
1. At the beginning of our design, considering the battery function (SW6106 scheme) and power-on function (Mos), we reserved an ideal diode to ensure that the power is drawn from the USB port to supply power to the circuit board when it is powered on. In some cases, such as using the computer's USB, Type-C and other physical ports that support the fast charging protocol for power supply, the voltage may be boosted and the TVS will burn out and short circuit, which is a normal protection circuit phenomenon, and the situation at this time is smoke, the screen is not bright, and the PWR light is flickering. In this case, it is necessary to remove the TVS and MOS tubes as shown in the figure below, please feel free to deal with them, the circuit has been verified to withstand the maximum fast charge voltage of 20V, so it is a more reasonable way to remove them.
2. After removing the TVS and MOS tubes, the development board will not light up when powered on, and you need to click BAT_PWR to power on, of course, you can also double-click the BAT_PWR to shut down in the boot state.
1. When the serial port is occupied, the programming will fail, turn off the serial port monitor and re-flash
2. When the ESP32 program crashes, the flashing will fail, at this time, you need to completely power off the development module, press and hold BOOT and then power on to enter the strong download mode and then flash. It will not automatically exit the download mode after flashing, so you need to power off and restart again
Windows:
(1) View through Device Manager: Press the Windows + R keys to open the Run dialog box; Type devmgmt.msc and press enter to open Device Manager; Expand the Ports (COM and LPT) section, which lists all COM ports and their current status.
(2) Use the command prompt to view: Open the Command Prompt (CMD); Enter the mode command, which will display status information for all COM ports.
(3) Check the hardware connection: If you have connected an external device to the COM port, usually the device will occupy a port number, and you can determine which port is used by looking at the connected hardware.
Linux:
(1) Use the dmesg command to view: Open Terminal.
(2) Use the ls command to view: Enter ls /dev/ttyS* or ls /dev/ttyUSB* to list all serial devices.
(3) Use the setserial command to view: Enter setserial -g /dev/ttyS* to view the configuration information of all serial devices.
The LCD screen display chip used in this product is ST7701 and the touch chip is GT911, we recommend referring directly to the example examples of Arduino or ESP-IDF
Monday-Friday (9:30-6:30) Saturday (9:30-5:30)
Email: services01@spotpear.com