ESP32 Connecting

I have noticed that if I am uploading a sketch to an ESP32-T-Display-S3 with "Erase all flash before sketch upload" Enabled it takes longer to upload, which I expected, but it's not very verbose about what is happening. The upload process pauses at "Connecting..", waits 20-30 seconds, and then proceeds with uploading. If I Disable the flash erase, it connects right away and uploads. I don't think the problem is the connection, even though the output screen leads you to believe so. I think the output window should says something like "Erasing Flash..." when this is happening. As it stands, it acts like there is a long delay in connecting with the ESP.

esptool.py v4.5.1
Serial port COM17
Connecting...

I agree.

Do you believe anyone on this forum can change this for you?

kind of looks like it does..

also times it and reports how long it took..
esptool source..
line 1082 is the erase flash, i think anyways..
maybe the ide just doesn't display it??

good luck.. ~q

Hi @Benjamin269. Please try this experiment:

  1. Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
    The "Preferences" dialog will open.
  2. Check the box next to Show verbose output during: ☐ upload.
  3. Click the "OK" button.
    The "Preferences" dialog will close.
  4. Select the appropriate board for your ESP32-T-Display-S3 from the Arduino IDE menus.
  5. Select Tools > Erase All Flash Before Sketch Upload > Enabled from the Arduino IDE menus.
  6. Attempt an upload, as you did before.
  7. Wait for the upload to finish.
  8. Examine the contents of the black "Output" panel at the bottom of the Arduino IDE window. You will see the esptool command Arduino IDE invoked to perform the upload. Click and drag the mouse pointer over it to select the entire text of command
  9. Press the Ctrl+C keyboard shortcut (Command+C for macOS users).
    This will copy the selected text to the clipboard.
  10. Open a shell terminal (e.g., PowerShell, ZSH).
  11. Paste the copied command to the terminal prompt.
  12. Press the Enter key.

The upload process should now proceed. Does the fault still occur when you run it directly?

My first impression was that this was the behavior of esptool. However, I have some doubts after performing the experiment.

I see some text like this in the output:

Erasing flash (this may take a while)...
Chip erase completed successfully in 2.1s

I noticed that when I upload in Arduino IDE, they are both printed simultaneously. Conversely, when I run the esptool command from the terminal, it seems like the "Connecting..." phase is shorter, and then there is a short delay between the printing of the "Erasing flash (this may take a while)..." line and the printing of the "Chip erase completed successfully in 2.1s" line. This makes me think that maybe esptool is printing the output stepwise, but for some reason the way Arduino IDE prints it is different; caching up a bunch of the output before printing it all at once.

For some reason the duration erase operation is very short for me (maybe because I have a different partition configuration or something???) so the problem isn't noticeable at all for me (2 s extra at the "Connecting..." phase is insignificant).

1 Like

Yes, I was able to run the command from Windows command line (cmd.exe) and it does show more:

esptool.py v4.5.1
Serial port COM17
Connecting...
Chip is ESP32-S3 (revision v0.1)
Features: WiFi, BLE
Crystal is 40MHz
MAC: 68:b6:b3:21:90:74
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Erasing flash (this may take a while)...

and then it pauses for about 40 seconds and continues with:

Chip erase completed successfully in 39.9s

My partition scheme is 16MB Flash (3MB APP/9.9MB FATFS)