After understanding that “esphome run” tries to first write the firmware at a too high baudrate, I added the following lines to the yaml:
esphome:
name: esptest
friendly_name: "ESP32 Test"
platformio_options:
upload_speed: 115200
Still, it writes the firmware twice:
Found multiple options for uploading, please choose one:
[1] /dev/ttyACM0 (ESP32-S2)
[2] /dev/ttyUSB0 (Quectel EM05-G)
[3] Over The Air (esptest.local)
(number): 1
esptool.py v4.7.0
Serial port /dev/ttyACM0
Connecting....
Chip is ESP32-S2FNR2 (revision v1.0)
Features: WiFi, Embedded Flash 4MB, Embedded PSRAM 2MB, ADC and temperature sensor calibration in BLK2 of efuse V2
Crystal is 40MHz
MAC: cc:8d:a2:xx:xx:xx
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash will be erased from 0x00010000 to 0x000bdfff...
Flash will be erased from 0x00001000 to 0x00006fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x00009000 to 0x0000afff...
Compressed 711696 bytes to 472997...
Wrote 711696 bytes (472997 compressed) at 0x00010000 in 5.1 seconds (effective 1107.9 kbit/s)...
Hash of data verified.
Compressed 21248 bytes to 13417...
Wrote 21248 bytes (13417 compressed) at 0x00001000 in 0.3 seconds (effective 647.2 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 134...
Wrote 3072 bytes (134 compressed) at 0x00008000 in 0.0 seconds (effective 656.8 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 31...
Wrote 8192 bytes (31 compressed) at 0x00009000 in 0.1 seconds (effective 889.9 kbit/s)...
Hash of data verified.
Leaving...
WARNING: ESP32-S2FNR2 (revision v1.0) chip was placed into download mode using GPIO0.
esptool.py can not exit the download mode over USB. To run the app, reset the chip manually.
To suppress this note, set --after option to 'no_reset'.
INFO Upload with baud rate 115200 failed. Trying again with baud rate 115200.
esptool.py v4.7.0
Serial port /dev/ttyACM0
Connecting...
Chip is ESP32-S2FNR2 (revision v1.0)
Features: WiFi, Embedded Flash 4MB, Embedded PSRAM 2MB, ADC and temperature sensor calibration in BLK2 of efuse V2
Crystal is 40MHz
MAC: cc:8d:a2:80:02:ce
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash will be erased from 0x00010000 to 0x000bdfff...
Flash will be erased from 0x00001000 to 0x00006fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x00009000 to 0x0000afff...
Compressed 711696 bytes to 472997...
Wrote 711696 bytes (472997 compressed) at 0x00010000 in 5.1 seconds (effective 1112.8 kbit/s)...
Hash of data verified.
Compressed 21248 bytes to 13417...
Wrote 21248 bytes (13417 compressed) at 0x00001000 in 0.3 seconds (effective 648.3 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 134...
Wrote 3072 bytes (134 compressed) at 0x00008000 in 0.0 seconds (effective 657.1 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 31...
Wrote 8192 bytes (31 compressed) at 0x00009000 in 0.1 seconds (effective 904.2 kbit/s)...
Hash of data verified.
Leaving...
WARNING: ESP32-S2FNR2 (revision v1.0) chip was placed into download mode using GPIO0.
esptool.py can not exit the download mode over USB. To run the app, reset the chip manually.
To suppress this note, set --after option to 'no_reset'.
Why does it say
INFO Upload with baud rate 115200 failed. Trying again with baud rate 115200.
?
Writing it only once would
a) save time
b) enhance lifetime of the flash memory.
How can I achieve this?