ESP32-S3 >>> MicroPython Programming

  I bought an ESP32-S3 today, and I plan to try MicroPython programming on it (attached information website ).

insert image description here
  First of all, in order to program mp on ESP32, it needs to re-burn its firmware. This requires our computer to install the CH343 driver, then find the firmware suitable for ESP32-S3, and use the flash download tool to download it to the board. To sum up, there are two steps:

  1. Install the CH343 driver on the computer;
  2. Refresh the firmware.

1. Download and install the driver

Enter the above information URL, the first folder contains the CH343 driver installation package.

insert image description here
insert image description here
Select the appropriate driver and install it, then connect the board to the computer.

insert image description here

Then you can find that the board is recognized normally in the [Device Manager] of the [Control Panel].

insert image description here

2. Brush the firmware

You can choose to download the firmware from the official website. If the firmware in the Releases version does not have the desired MicroPython module, you can download the firmware of the Nightly builds version (for example, my Nightly builds version has more urequests modules than the Releases version).

To query the available MicroPython modules, you can use commands to query after the firmware is burned help('modules').

insert image description here

Then download the flash burning tool.

insert image description here
After downloading the flash burning tool, open it, select [ESP32-S3] for chipType, select [develop] for workMode, and select which type-C port on the board we are using for loadMode, as shown in the figure below, I choose [ uart].

insert image description here
insert image description here
Then in the software interface, select the firmware path to be burned, the address to be burned, the COM port and the baud rate.

insert image description here
There are two needs hereNoticepoint of:

  1. The flash needs to be erased before burning new firmware;
  2. Regardless of erasing or burning new firmware, the board needs to be in standby mode (hold down the BOOT key and press the RST key once to enter the standby download mode).

According to the above instructions, after the board enters the standby state, click [ERASE] to erase the flash.

insert image description here

insert image description here
Then click [START] to reprogram the firmware on the board.

insert image description here

insert image description here
At this point, the download of the mp firmware of the board is completed. Next test the mp programming. Download the Thonny IDE.

3. Test

insert image description here
After downloading, open the software. Click [Tools] - [Options].

insert image description here
Enter 【Interpreter】, choose to use ESP32's mp as the interpreter, and select the corresponding COM port for the port below.

insert image description here
Back to the main interface of the software, you can see the data sent by the board by resetting the board.

insert image description here
Type help() to see some information about mp programming.

insert image description here
Connect to WiFi.

insert image description here
It can be seen that the mp of the board can be used normally (attached the MicroPython quick use tutorial for ESP32 ).

Use the command help('modules')to query available modules.

insert image description here

4. Use VScode for MicroPython development

VScode download and install [RT-Thread MicroPython] plug-in.

insert image description here

1. Create a MicroPython project

Click the [+] button in the lower left corner.

insert image description here

Select【Create a new MicroPython project】.

insert image description here
Select [Create a blank MicroPython project].

insert image description here
Next, after specifying the project name and saving path, a MicroPython project can be created (the MicroPython project must be created before the plug-in can be used for ESP32 development).

2. Connect the ESP32

Click the connect button in the lower left corner.

insert image description here

Select the corresponding port and connect (I have connected the ESP32 to the COM10 port).

insert image description here

3. Upload project files

If there are multiple files in our folder .py, we need to upload the files to the board, through

import os
os.listdir()

You can view the files in the board (I have uploaded MyNetwork.pyand MyWeather.pyfiles).

insert image description here
There are two ways to upload, which are project synchronization (upload all files in the project at the same time) or single file upload. If the project is synchronized, click the synchronization button in the lower left corner.

insert image description here

Right-click the file in the project and click [Download the file/floder to the device].

insert image description here
Attach delete file or folder command.

# 删除文件
os.remove("file_to_del")
# 删除文件夹
os.rmdir("dir_to_del")

If you want to upload files in batches, you can use ampy
the installationampy

pip install adafruit-ampy

upload files

ampy --port COM3 put test.txt

Delete Files

ampy --port COM3 rm test.txt

4. Run the file

Click the debug button in the lower left corner.

insert image description here

Or right-click the file in the project and click [Run the MicroPython File Directly on the Device].

insert image description here

Guess you like

Origin blog.csdn.net/weixin_40973138/article/details/128509293