5.8 ESP32 Remote Download Tutorial
1.The timeout value for the esptool.py provided by ESP is too small. Remote program downloads often fail due to network latency or fluctuations, making it unsuitable for network access. Therefore, the timeout for esptool.py has been modified.
2.PowerDebugger has been upgraded and optimized for ESP remote downloads.
1. Python Download & Installation
1.1 Download link
Download link: Download Python | Python.org
1.2 Check Python version
After installation, open win+r, type cmd, and enter Python --version
to check the Python version.
2. Esptool Installation | Clone
2.1 PIP install
open win+r, type PowerShell.
$ pip install esptool
$ esptool --version
2.2 Git clone source code
open Git Bash.
git clone https://github.com/espressif/esptool.git
Esptool online documentation:Esptool.py Documentation - ESP32 - — esptool.py latest documentation
Esptool git link: GitHub - espressif/esptool: Espressif SoC serial bootloader utility
3. Adjust esptool.py Timeout
For remote firmware downloads, due to uncertain network conditions, the esptool.py serial timeout needs to be manually adjusted, modified, and saved.
- Linux:
/home/<user>/.config/esptool/
- macOS
/Users/<user>/.config/esptool/
- Windows:
c:\Users\<user>\AppData\Local\esptool\
Windows:
@echo off
set CONFIG_DIR=%USERPROFILE%\AppData\Local\esptool
set CONFIG_FILE=%CONFIG_DIR%\esptool.cfg
if not exist "%CONFIG_DIR%" (
mkdir "%CONFIG_DIR%"
echo Created directory: %CONFIG_DIR%
)
(
echo [esptool]
echo timeout=180
echo sync_timeout=10
echo md5_timeout_per_mb=80
echo erase_region_timeout_per_mb=80
echo erase_write_timeout_per_mb=80
echo mem_end_rom_timeout=10
echo serial_write_timeout=10
echo connect_attempts=10
echo write_block_attempts=10
) > "%CONFIG_FILE%"
echo Esptool configuration file created at: %CONFIG_FILE%
pause
Save to esptool_config.bat and double-click to execute.
Configuration file:Configuration File - ESP32 - — esptool.py latest documentation
4. Wiring
5. PowerDebugger Installation & Settings
5.1 Install PowerDebugger(ESP32 remote)
5.2 It is recommended to use the public network (P2P) mode
5.3 Firmware version
For ESP32 remote downloads, the transmitter and receiver firmware need to be upgraded to the customized V1.0.27 version.
There are two ways for the client to switch to the release version:
Download the official version and reinstall.
Manually delete c:\Users\AppData\Local\PowerDebugger\pdconfig.ini and upgrade.ini, restart and automatically switch back to the official version.
Method to switch firmware to official version:
Open the [About] page of the client, quickly and continuously click [Firmware version:] on the transmitter and receiver 8 times respectively, that is, the firmware upgrade dialog box is prompted, and click [OK] to update the firmware.
6. Debug & Remote Download
6.1 PowerShell executes Esptool
open win+r, type PowerShell.
$ esptool --chip esp32s3 --port COM10 --baud 921600 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 80m --flash_size 2MB 0x0 F:/hello_world/build/bootloader/bootloader.bin 0x10000 F:/hello_world/build/hello_world.bin 0x8000 F:/hello_world/build/partition_table/partition-table.bin
6.2 VSCode runs and debug Esptool
Vscode clocks in the directory where esptool.py is located, runs and debugs the added configuration.
{
"version": "0.2.0",
"configurations": [
{
"name": "Python Degbug: esp32tool",
"type": "debugpy",
"request": "launch",
"program": "esptool.py",
"console": "integratedTerminal",
"args": [
"--chip", "esp32s3",
"--port", "COM10", // PowerDebugger sender serial port number
"--baud", "921600",
"--before=default_reset",
"--after=hard_reset",
"write_flash",
"--flash_mode",
"dio",
"--flash_freq", "80m",
"--flash_size", "2MB",
"0x0",
"F:/hello_world/build/bootloader/bootloader.bin",
"0x10000",
"F:/hello_world/build/hello_world.bin",
"0x8000",
"F:/hello_world/build/partition_table/partition-table.bin"
]
}
]
}