Problems with esptool 4.4 and ESP32 S3

Using pio CLI, I cannot upload my firmware in a ESP32S3 board. It get stuck. I see that the esptool used in pio is 4.4, while the latest version is 4.7;

If I use directly esptool 4.7, I have no problems. How can I change the esptool used in pio to 4.7 ?

Here is the output using pio it was interrupted when stucked.

CURRENT: upload_protocol = esptool
Looking for upload port...
Using manually specified: /dev/cu.usbmodem113401
Forcing reset using 1200bps open/close on port /dev/cu.usbmodem113401
Waiting for the new upload port...
Uploading .pio/build/lolin_s3/firmware.bin
esptool.py v4.4
Serial port /dev/cu.usbmodem113401
^CConnecting...
Chip is ESP32-S3 (revision v0.1)
Features: WiFi, BLE
Crystal is 40MHz
MAC: f4:12:fa:cb:e3:d4
Traceback (most recent call last):
  File "/Volumes/USERS/jxl/.platformio/packages/tool-esptoolpy/esptool.py", line 34, in <module>
    esptool._main()
  File "/Volumes/USERS/jxl/.platformio/packages/tool-esptoolpy/esptool/__init__.py", line 1026, in _main
Uploading stub...
Running stub...
    main()
  File "/Volumes/USERS/jxl/.platformio/packages/tool-esptoolpy/esptool/__init__.py", line 704, in main
    esp = esp.run_stub()
          ^^^^^^^^^^^^^^
  File "/Volumes/USERS/jxl/.platformio/packages/tool-esptoolpy/esptool/loader.py", line 938, in run_stub
    p = self.read()
        ^^^^^^^^^^^
  File "/Volumes/USERS/jxl/.platformio/packages/tool-esptoolpy/esptool/loader.py", line 308, in read
    return next(self._slip_reader)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/USERS/jxl/.platformio/packages/tool-esptoolpy/esptool/loader.py", line 1471, in slip_reader
    read_bytes = port.read(1 if waiting == 0 else waiting)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/serial/serialposix.py", line 565, in read
    ready, _, _ = select.select([self.fd, self.pipe_abort_read_r], [], [], timeout.time_left())
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyboardInterrupt
*** [upload] Build interrupted.
AbortedByUser: Aborted by user

Here is the output using esptool 4.7

esptool.py --port /dev/cu.usbmodem113401 write_flash 0 .pio/build/lolin_s3/firmware.bin
esptool.py v4.7.0
Serial port /dev/cu.usbmodem113401
Connecting...
Detecting chip type... ESP32-S3
Chip is ESP32-S3 (QFN56) (revision v0.1)
Features: WiFi, BLE, Embedded PSRAM 8MB (AP_3v3)
Crystal is 40MHz
MAC: f4:12:fa:cb:e3:d4
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash will be erased from 0x00000000 to 0x0003cfff...
Compressed 247472 bytes to 138287...
Wrote 247472 bytes (138287 compressed) at 0x00000000 in 2.6 seconds (effective 759.9 kbit/s)...
Hash of data verified.

No, it’s 4.5.1 in the latest Espressif32 platform release. Try and use CLIpio pkg update -g -p espressif32 to update that and retry.

If that still does not fix the problem, you can make PlatformIO use 4.7.0 by using the same version that the Jason2866 fork uses:

platform_packages =
   tool-esptoolpy@https://github.com/tasmota/esptool/releases/download/v4.7.0/esptool-4.7.0.zip

I have tried to install 4.7, but it seems that it is not available for macos M1
Tool Manager: Installing platformio/tool-esptoolpy @ 1.40700.0
UnknownPackageError: Could not find the package with ‘platformio/tool-esptoolpy @ 1.40700.0’ requirements for your system ‘darwin_arm64’

But I solved the problem with 4.5 by adding in platformio.ini
platform_packages = tool-esptoolpy@1.40500.0

So version 4.5 is sufficient and seems to be the latest available for macos m1

Uploading .pio/build/lolin_s3/firmware.bin
esptool.py v4.5

The 4.7.0 is generally not available in the registry right now, no matter the OS, see https://registry.platformio.org/tools/platformio/tool-esptoolpy/versions.

That should be the default with the latest espressif32 platform per above. But if you need it on an older platform, yes that’s valid.

Thanks a lot for this info. Indeed, it is surprising, as both with the Homebrew install and pip install of platformio (I tested both), it was the 4.4 version of esptoool that was installed.
With the upgrade instruction,
espressif32 5.3 was also upgraded to 6.5.
Everything looks fine now.