Can no longer upload or monitor - Xiao ESP32-C3

I upgraded platformio tonight and the expressif sdk, now I can no longer upload to my board unless it’s in boot mode. When I does upload, I can’t monitor it automatically as I did before. Even manually opening a serial monitor does not work properly.

Computer: Mac Studio M2 Ultra
Board: Xiao ESP32-C3
Platform IO: PlatformIO Core, version 6.1.16a1
PLATFORM: Espressif 32 (6.7.0) > Seeed Studio XIAO ESP32C3

[env:seeed_xiao_esp32c3]
platform = espressif32
board = seeed_xiao_esp32c3
framework = arduino
build_type = debug
monitor_speed = 115200
monitor_rts = 0
monitor_dtr = 0
monitor_filters = esp32_exception_decoder
build_flags = -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1
lib_deps =
symlink://../Core

Once in boot mode, I get this output upon clicking “upload and monitor”:

Executing task in folder Client: platformio run --target upload --target monitor --environment seeed_xiao_esp32c3 --upload-port /dev/cu.usbmodem61301 --monitor-port /dev/cu.usbmodem61301
Processing seeed_xiao_esp32c3 (platform: espressif32; board: seeed_xiao_esp32c3; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/seeed_xiao_esp32c3.html
PLATFORM: Espressif 32 (6.7.0) > Seeed Studio XIAO ESP32C3
HARDWARE: ESP32C3 160MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-builtin, 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:
- framework-arduinoespressif32 @ 3.20016.0 (2.0.16)
- tool-esptoolpy @ 1.40501.0 (4.5.1)
- tool-mkfatfs @ 2.0.1
- tool-mklittlefs @ 1.203.210628 (2.3)
- tool-mkspiffs @ 2.230.0 (2.30)
- toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 46 compatible libraries
Scanning dependencies...
Dependency Graph
|-- AquariusCore @ 1.0.0
|-- ArduinoLog @ 1.1.1
|-- ArduinoJson @ 6.21.5
|-- AsyncMqttClient @ 0.9.0
|-- Adafruit MCP23017 Arduino Library @ 2.3.2
|-- Adafruit NeoPixel @ 1.12.2
|-- Adafruit SSD1306 @ 2.5.10
|-- SimpleStack @ 1.0.0
|-- ESP32 ESP32S2 AnalogWrite @ 5.0.2
Building in debug mode
Retrieving maximum program size .pio/build/seeed_xiao_esp32c3/firmware.elf
Checking size .pio/build/seeed_xiao_esp32c3/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [= ] 14.8% (used 48612 bytes from 327680 bytes)
Flash: [======= ] 71.6% (used 938250 bytes from 1310720 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.usbmodem61301
Uploading .pio/build/seeed_xiao_esp32c3/firmware.bin
esptool.py v4.5.1
Serial port /dev/cu.usbmodem61301
Connecting...
Chip is ESP32-C3 (revision v0.4)
Features: WiFi, BLE
Crystal is 40MHz
MAC: 64:e8:33:13:b4:b4
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
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 0x00101fff...
Compressed 13248 bytes to 9562...
Writing at 0x00000000... (100 %)
Wrote 13248 bytes (9562 compressed) at 0x00000000 in 0.2 seconds (effective 505.8 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 146...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.0 seconds (effective 556.3 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 719.4 kbit/s)...
Hash of data verified.
Compressed 989440 bytes to 548999...
Writing at 0x00010000... (2 %)
Writing at 0x0001dc11... (5 %)
Writing at 0x000281e2... (8 %)
Writing at 0x0003476f... (11 %)
Writing at 0x00040116... (14 %)
Writing at 0x00047fc9... (17 %)
Writing at 0x000525ab... (20 %)
Writing at 0x0005b90b... (23 %)
Writing at 0x00061cf6... (26 %)
Writing at 0x00067d7d... (29 %)
Writing at 0x0006e25a... (32 %)
Writing at 0x0007412a... (35 %)
Writing at 0x00079f72... (38 %)
Writing at 0x00080124... (41 %)
Writing at 0x00086618... (44 %)
Writing at 0x0008c9c2... (47 %)
Writing at 0x00092be4... (50 %)
Writing at 0x00098813... (52 %)
Writing at 0x0009dff1... (55 %)
Writing at 0x000a3d1d... (58 %)
Writing at 0x000a9a72... (61 %)
Writing at 0x000afd92... (64 %)
Writing at 0x000b5ae9... (67 %)
Writing at 0x000bb57d... (70 %)
Writing at 0x000c173d... (73 %)
Writing at 0x000c764e... (76 %)
Writing at 0x000cd988... (79 %)
Writing at 0x000d576e... (82 %)
Writing at 0x000dcbf0... (85 %)
Writing at 0x000e3b3c... (88 %)
Writing at 0x000ebb35... (91 %)
Writing at 0x000f21de... (94 %)
Writing at 0x000f7e5a... (97 %)
Writing at 0x000fe260... (100 %)
Wrote 989440 bytes (548999 compressed) at 0x00010000 in 7.4 seconds (effective 1068.9 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
--- forcing DTR inactive
--- forcing RTS inactive
--- Terminal on /dev/cu.usbmodem61301 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0x4 (DOWNLOAD(USB/UART0/1))
Saved PC:0x400462e2
waiting for download

From here it hangs until I hit reset, then I get this:

Disconnected (read failed: [Errno 6] Device not configured)
Reconnecting to /dev/cu.usbmodem61301 --- forcing DTR inactive
--- forcing RTS inactive
.--- forcing DTR inactive
--- forcing RTS inactive
         Connected!
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x400462e2
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5810,len:0x438
load:0x403cc710,len:0x90c
load:0x403ce710,len:0x2624
entry 0x403cc710
Disconnected (read failed: [Errno 6] Device not configured)
Reconnecting to /dev/cu.usbmodem61301 --- forcing DTR inactive
--- forcing RTS inactive
         Connected!
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x4202a8fa
  #0  0x4202a8fa in cpu_ll_waiti at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/hal/esp32c3/include/hal/cpu_ll.h:223
      (inlined by) esp_pm_impl_waiti at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_pm/pm_impl.c:853

SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5810,len:0x438
load:0x403cc710,len:0x90c
load:0x403ce710,len:0x2624
entry 0x403cc710
Disconnected (read failed: [Errno 6] Device not configured)
Reconnecting to /dev/cu.usbmodem61301 --- forcing DTR inactive
--- forcing RTS inactive
         Connected!
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x4202a8fa
  #0  0x4202a8fa in cpu_ll_waiti at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/hal/esp32c3/include/hal/cpu_ll.h:223
      (inlined by) esp_pm_impl_waiti at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_pm/pm_impl.c:853

I keeps going over and over until I CTRL-C the terminal, then the board boots normally but I don’t see anything from serial port in the terminal like I used to. I have to manually open the serial monitor but I miss all the boot messages.

Literally everything was fine last night and now I can’t even upload without jumping through hoops. I switched boards and it operates the same way.

I downloaded the Arduino IDE and it can’t upload either, but does monitor the serial port properly.

Seems like a toolchain problem but I’m at a loss.

Any suggestions?

This seems to be caused due to a bug in Arduino 2.x.x and is fixed in Arduino 2.0.17 (which is not available on PlatformIO yet). See feat(hwcdc): Fixes HWCDC fw uploading by SuGlider · Pull Request #9660 · espressif/arduino-esp32 · GitHub

As a workaround for myself (until 2.0.17 is available) I copy & pasted the content from the fixed HWCDC.cpp to the HWCDC.cpp in my framework folder C:\Users\<username>\.platformio\packages\framework-arduinoespressif32\cores\esp32\HWCDC.cpp

Thanks – I will give that a try. In the meantime, I rolled back to 6.4 which provides Arudino 2.0.11, which does not seem to have that problem. I will check 6.5 as well.

== BREAK ==

Any clue when 2.0.17 will be included in PIO?

1 Like

Since this is breaking for you, please push issue

1 Like

Thank you!

I have been struggling developing on this board the last few weeks since it takes forever to reset the device into bootloader mode every time and then having to restart again to get the serial monitor working.

After copying that file all is back to normal and I can upload and monitor in a single instance. I wasn’t sure how long these little buttons were going to last lol.