Serial disconnection when uploading to ESP-S3 device

Board: ESP32-S3-DevKitC-1-N16R8V (16 MB QD, 8MB PSRAM)
System: MacOS Ventura
PIO: PlatformIO Core, version 6.1.10b1

When building and uploading my project to the board with pio cli, the Writing phase progesses and stops at around 65-75%, with an error coming from pySerial:
A serial exception error occurred: Could not configure port: (6, 'Device not configured')

This process has worked and stopped working without notice.
I tested several USB/USB cables.
I tested other exact same boards in case of individual board failure
I rebooted to reinit the serial subsystem
I’m using the “left” UART port of the device.

Any advice could help a bit !
More details below:

Command:
platformio run -t upload --environment s3

  • Detailed output:
Processing s3 (board: esp32-s3-devkitc-1-n16r8v; framework: arduino; platform: espressif32  @6.3.0)
[...]
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32-s3-devkitc-1-n16r8v.html
PLATFORM: Espressif 32 (6.3.0) > Espressif ESP32-S3-DevKitC-1-N16R8V (16 MB QD, 8MB PSRAM)
HARDWARE: ESP32S3 240MHz, 320KB RAM, 16MB Flash
DEBUG: Current (esp-builtin) On-board (esp-builtin) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
[...]
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 57 compatible libraries
Scanning dependencies...
Dependency Graph
[...]
Building in debug mode
>>> Current CLI targets ['upload']
>>> Current Build targets ['upload']
Retrieving maximum program size .pio/build/s3/firmware.elf
Checking size .pio/build/s3/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [==        ]  19.5% (used 63876 bytes from 327680 bytes)
Flash: [========= ]  88.8% (used 1636305 bytes from 1843200 bytes)
Configuring upload protocol...
AVAILABLE: cmsis-dap, esp-bridge, esp-builtin, esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port...
Using manually specified: /dev/cu.usbmodem1101
Uploading .pio/build/s3/firmware.bin
esptool.py v4.5.1
Serial port /dev/cu.usbmodem1101
Connecting...
Chip is ESP32-S3 (revision v0.1)
Features: WiFi, BLE
Crystal is 40MHz
MAC: f4:12:fa:fd:1b:1c
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00003fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x0019ffff...
Compressed 14000 bytes to 9713...
Writing at 0x00000000... (100 %)
Wrote 14000 bytes (9713 compressed) at 0x00000000 in 0.3 seconds (effective 410.2 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 127...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (127 compressed) at 0x00008000 in 0.1 seconds (effective 372.5 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 574.8 kbit/s)...
Hash of data verified.
Compressed 1636688 bytes to 965298...
Writing at 0x00010000... (1 %)
Writing at 0x0001b447... (3 %)
[...]
Writing at 0x0011c221... (67 %)
Writing at 0x00121ba8... (69 %)

A serial exception error occurred: Could not configure port: (6, 'Device not configured')
Note: This error originates from pySerial. It is likely not a problem with esptool, but with the hardware connection or drivers.
For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html
*** [upload] Error 1
  • Partitions table:
# Name,   Type, SubType, Offset,  Size, Flags           # 4MB = 0x400000       24kB = 0x6000
nvs,      data, nvs,     0x9000,  20k,               
otadata,  data, ota,     ,        8k,
app0,     app,  ota_0,   ,        1800k,
app1,     app,  ota_1,   ,        1800k,
spiffs,   data, spiffs,  ,        1800k,

platformio.ini extracts:

[env:esp32]
	board = esp32dev
	framework = arduino
	board_build.partitions = shared/partitions.csv

[env:s3]
  monitor_filters = esp32_exception_decoder
  extends = env:esp32
  build_type = debug
  board = esp32-s3-devkitc-1-n16r8v
  board_build.partitions = shared/partitions-s3.csv
  monitor_port = /dev/cu.usbmodem1101
  upload_port = /dev/cu.usbmodem1101
  upload_speed = 921600
  • Board definition esp32-s3-devkitc-1-n16r8v.json
{
    "build": {
      "arduino":{
        "ldscript": "esp32s3_out.ld",
        "partitions": "default_16MB.csv",
        "memory_type": "qio_opi"
      },
      "core": "esp32",
      "extra_flags": [
        "-DARDUINO_ESP32S3_DEV",
        "-DBOARD_HAS_PSRAM",
        "-DARDUINO_USB_MODE=1",
        "-DARDUINO_USB_CDC_ON_BOOT=1"
      ],
      "f_cpu": "240000000L",
      "f_flash": "80000000L",
      "psram_type": "opi",
      "flash_mode": "dio",
      "boot": "opi",
      "hwids": [
        [
          "0x303A",
          "0x1001"
        ]
      ],
      "mcu": "esp32s3",
      "variant": "esp32s3"
    },
    "connectivity": [
      "wifi",
      "bluetooth"
    ],
    "debug": {
      "default_tool": "esp-builtin",
      "onboard_tools": [
        "esp-builtin"
      ],
      "openocd_target": "esp32s3.cfg"
    },
    "frameworks": [
      "arduino",
      "espidf"
    ],
    "name": "Espressif ESP32-S3-DevKitC-1-N16R8V (16 MB QD, 8MB PSRAM)",
    "upload": {
      "flash_size": "16MB",
      "maximum_ram_size": 327680,
      "maximum_size": 16777216,
      "require_upload_port": true,
      "speed": 921600
    },
    "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitc-1.html",
    "vendor": "Espressif"
  }

Does this happen in the Arduino IDE too? If yes or not, with which settings?

I have the same problem. ESP32-S3-DevKitC-1-N16R8
The device disappears and no longer connects to the Mac, only rebooting the computer helps.
There is no such problem on Arduino IDE, the problem is with PlatformIO only.

Both of these are exactly the symptoms on MacOS when using the ESP32-S3 DevKitC (Clones only) that use the WCH 9102(?) chipset. It’s maddening because it mostly works, such as for console duty, but when you lean on it with a lot of data, such as during a firmware upload, the wheels fall off in exactly the way you describe.

The solution is to install the drivers from GitHub - WCHSoftGroup/ch34xser_macos: MacOS USB driver for USB to serial chip ch340, ch341, ch342, ch343, ch344, ch9101, ch9102, ch9103, etc

Remember that when this is done, you HAVE to use /dev/cu.wchusbserial-1011 (the number on the end is either the physical bus topology or the serial number - darned if I know which will show up at any time)

The other serial port, the virtual one that uses that native MacOS CDC/ACM driver, will always present as /dev/cu.usbserial-1011 or whatever.

I’ve used these drivers on Mac and Intel systems and they’ve always worked fine for me.

Thanks a lot Robert for sharing your experience, and providing the alternative drivers.
I’ll have a look at this option tomorrow and get back to you to confirm if my experience is better.

Have a good day!

I was facing the same issue: upload would fail after around 70%.
I have narrowed it down to the version of the esptool, included in platformio.

$ python $HOME/.platformio/packages/tool-esptoolpy/esptool.py version 
esptool.py v4.5.1
4.5.1

vs another esptool, e.g. from esp-idf standalone distribution:

$ python $HOME/.espressif/python_env/idf5.4_py3.13_env/bin/esptool.py version
esptool.py v4.8.1
4.8.1

The upload succeeds with esptool 4.8.1. The workaround that worked for me - in platformio.ini

platform_packages = 
  tool-esptoolpy@https://github.com/Jason2866/esptool/releases/download/v4.8.7/esptool.zip

Most probably the combination of not using the WCH drivers and old esptool.py. I can flash 100% reliable with 1500000 when using the WCH driver and an actual esptool.py build from me. Which just adds the needed intelhex code directly in esptool.py. There is no other change to the actual official esptool.py. Platformio borked there newer release of esptool.py by not adding intelhex (either by modifying esptool.py or adding this dependency to Platformio Core)