M5Stack upload write timeout


I come here because I’m currently facing an upload problem with PIO.

I made a demo project on a M5stack core kit (ESP32) using VScode and PIO.
It works fine on a Win10 and a OSX machine: compile, upload, serial debugging.

On my work PC, I can’t make the same project to work on uploading using PIO.
It compiles OK but it fails at the beginning of the upload, see the following output trace.
On this machine, the same project compiles and uploads OK using the Arduino IDE so there should not be be anything wrong with the device nor the silabs USB-UART driver I guess. The debug terminal is also working fine on PIO (I closed it before upload).

I tried to run VScode with admin rights but same result.

Could someone tell me what I can do to make a successful download? Do you need some more information (which kind?) to help me?

Auto-detected: COM8
Uploading .pio\build\m5stack-core-esp32\firmware.bin
esptool.py v2.6
Serial port COM8
Traceback (most recent call last):
  File "C:\Users\xx\.platformio\packages\tool-esptoolpy\esptool.py", line 2959, in <module>
  File "C:\Users\xx\.platformio\packages\tool-esptoolpy\esptool.py", line 2952, in _main
  File "C:\Users\xx\.platformio\packages\tool-esptoolpy\esptool.py", line 2653, in main
  File "C:\Users\xx\.platformio\packages\tool-esptoolpy\esptool.py", line 460, in connect
    last_error = self._connect_attempt(mode=mode, esp32r0_delay=False)
  File "C:\Users\xx\.platformio\packages\tool-esptoolpy\esptool.py", line 440, in _connect_attempt
  File "C:\Users\xx\.platformio\packages\tool-esptoolpy\esptool.py", line 379, in sync
  File "C:\Users\xx\.platformio\packages\tool-esptoolpy\esptool.py", line 322, in command
  File "C:\Users\xx\.platformio\packages\tool-esptoolpy\esptool.py", line 285, in write
  File "c:\users\xx\.platformio\penv\lib\site-packages\serial\serialwin32.py", line 323, in write
    raise writeTimeoutError
serial.serialutil.SerialTimeoutException: Write timeout
*** [upload] Error 1

What upload_speed is being used in the platformio.ini? Have you tried 115200?

yes I’ve tried with this parameter and without: no success.
Note: this speed is required after connection so that the PC can request another speed as the default one for the download.

The correct COM port is automatically detected.
I tried an older M5stack and 2 newer M5stack variants with hardware fix about reset: same issue. I also tried the capacitor on the reset pin (different values from 100nF to 10uF) without success.
I can’t understand why on this PC, the esptool of the same version works inside the Arduino IDE not in PlatformIO.

The exact ame projet PIO project can be downloaded flawlessly on 2 others PC. There might be something wrong between this PC and PIO but I can’t figure out what.

Try upload_speed = 1500000 … or update your espressif32 platform, and use the default speed (i.e. remove custom setting), as it was updated two days ago. It seems this is one of those funny boards that 460800 doesn’t work for. :cry: