I bought an ESP32-S3 today, and I plan to try MicroPython programming on it (attached information website ).
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:
- Install the CH343 driver on the computer;
- Refresh the firmware.
1. Download and install the driver
Enter the above information URL, the first folder contains the CH343 driver installation package.
Select the appropriate driver and install it, then connect the board to the computer.
Then you can find that the board is recognized normally in the [Device Manager] of the [Control Panel].
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')
.
Then download the flash burning tool.
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].
Then in the software interface, select the firmware path to be burned, the address to be burned, the COM port and the baud rate.
There are two needs hereNoticepoint of:
- The flash needs to be erased before burning new firmware;
- 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.
Then click [START] to reprogram the firmware on the board.
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
After downloading, open the software. Click [Tools] - [Options].
Enter 【Interpreter】, choose to use ESP32's mp as the interpreter, and select the corresponding COM port for the port below.
Back to the main interface of the software, you can see the data sent by the board by resetting the board.
Type help() to see some information about mp programming.
Connect to WiFi.
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.
4. Use VScode for MicroPython development
VScode download and install [RT-Thread MicroPython] plug-in.
1. Create a MicroPython project
Click the [+] button in the lower left corner.
Select【Create a new MicroPython project】.
Select [Create a blank MicroPython project].
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.
Select the corresponding port and connect (I have connected the ESP32 to the COM10 port).
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.py
and MyWeather.py
files).
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.
Right-click the file in the project and click [Download the file/floder to the device].
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.
Or right-click the file in the project and click [Run the MicroPython File Directly on the Device].