Current location - Quotes Website - Collection of slogans - PIO series 2 creates a serial connection with ESP32.
PIO series 2 creates a serial connection with ESP32.
This chapter describes how to establish a serial connection between ESP32 and PC.

Connect ESP32 development board to PC with USB cable. If the device driver is not automatically installed, please confirm the model of USB-to-serial chip (or external serial adapter) on ESP32 development board, search for the driver on the Internet and install it.

The following is the link of Lexin ESP32 development board driver:

The above drivers are for reference only. When you connect the above ESP32 development board with a PC, the corresponding driver should have been packaged in the operating system and automatically installed.

Check the list of COM ports in Windows Device Manager. Disconnect the ESP32 from the PC, then reconnect it to see which port disappears from the list, and then display it again.

The following are ESP32 DevKitC and ESP32 WROVER KIT serial ports:

USB serial converter of ESP32-DevKitC in device manager

Two USB-WROVER-KIT serial ports in Windows Device Manager

As shown in the figure below, the driver of ESP32 DevKitC has not been installed automatically, and it still needs to be installed manually.

The driver was manually installed successfully.

To view the serial port device name of ESP32 development board (or external serial port adapter), run the following command twice. Unplug the development board or adapter for the first time and run the command after inserting the development board or adapter for the second time. The port that appears after running this command for the second time is the corresponding serial port of ESP32:

Linux operating system

& ltpre style = " box-sizing:border-box; Font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberating Mono", "Courier New", Courier, Monospace font-size:12px; Blank: pre margin: 0px padding:12px; Display: block; Overflow: automatic; Line height: normal; " & gtls /dev/tty*

& lt/pre & gt;

Marcos

& ltpre style = " box-sizing:border-box; Font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberating Mono", "Courier New", Courier, Monospace font-size:12px; Blank: pre margin: 0px padding:12px; Display: block; Overflow: automatic; Line height: normal; " & gtls /dev/cu。 *

& lt/pre & gt;

The currently logged-in user can read and write the serial port through USB. In most Linux distributions, this is done by adding users to the dial-out group using the following command:

& ltpre style = " box-sizing:border-box; Font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberating Mono", "Courier New", Courier, Monospace font-size:12px; Blank: pre margin: 0px padding:12px; Display: block; Overflow: automatic; Line height: normal; " & gtsudo usermod -a -G dial out $USER.

& lt/pre & gt;

Log in again to ensure that read and write permissions for the serial port are enabled.

Now verify that the serial connection is available. You can use the serial terminal program to do this. In this example, we will use PuTTY SSH Client, which has versions of platforms such as Windows and Linux. You can also use other serial programs and set the following communication parameters.

Run the terminal and set the serial port: baud rate = 1 15200, data bit = 8, stop bit = 1, parity = n The following are some screenshot examples of setting the serial port and transmission parameters under Windows and Linux (such as115200-8) Pay attention to select the serial port confirmed in the above steps for setting.

Set up serial port transmission in PuTTY.

Set up serial port transmission in PuTTY on Linux.

Open the serial port of the terminal and check whether there is a print log. The content of the log depends on the application loaded into ESP32. The following figure shows a log example of ESP32.

& ltpre style = " box-sizing:border-box; Font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberating Mono", "Courier New", Courier, Monospace font-size:12px; Blank: pre margin: 0px padding:12px; Display: block; Overflow: automatic; Line height: normal; " & gtets Jun 8 20 16 00:22:57

Rst:0x5 (deep sleep reset), boot: 0x13 (SPI _ fast _ flash _ boot)

ets Jun 8 20 16 00:22:57

rst:0x7 (TG0WDT_SYS_RESET),BOOT:0x 13(SPI _ FAST _ FLASH _ BOOT)

configsip: 0,SPIWP:0x00

clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00

Mode: DIO, clock partition: 2

Load: 0x3fff0008, length: 8

Loading: 0x3fff00 10/0, length: 3464.

Load: 0x40078000, Length: 7828

Load: 0x40080000, length: 252

Entry 0x40080034

I (44) Boot: ESP-IDF V2.0-RC1-401-gf9fba35 second-stage boot loader.

I (45) startup: compilation time 18:48: 10.

...

& lt/pre & gt;

In addition to the above methods of confirming serial port connection, the serial port Monitor of PIO for VSCode can also check whether the equipment is connected normally, and click the monitor button to call the serial port monitor.