Unable to upload Seeed Studio XIAO code

I am trying to switch to Visual Code Studio from Arduino because I want to use freeRTOS on my Seeed ESP32C3 Studio.
I carefully followed all the instructions I could find, did all the prerequisites and the simply program I wrote that does nothing but print “hello world” compiles, but platformIO refuses to upload it.
I tried through VCS and directly with this line.

./.platformio/penv/bin/platformio run -d ./Documents/PlatformIO/Projects/RTOSagain -t upload

But it keeps telling me “No device found on cu.usbmodem2101” despite the fact that the OS sees, as does my Arduino IDE, that does upload code.

My configuration file looks like this…

[env:seeed_xiao]
platform = atmelsam
board = seeed_xiao
framework = arduino
monitor_speed = 9600
upload_protocol = sam-ba

Any help much appreciated

This might help someone point me in the right direction.

-------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelsam/seeed_xiao.html
PLATFORM: Atmel SAM (8.3.0) > Seeeduino XIAO
HARDWARE: SAMD21G18A 48MHz, 32KB RAM, 256KB Flash
DEBUG: Current (atmel-ice) External (atmel-ice, blackmagic, jlink)
PACKAGES: 
 - framework-arduino-samd-seeed @ 1.8.5 
 - framework-cmsis @ 2.50400.181126 (5.4.0) 
 - framework-cmsis-atmel @ 1.2.2 
 - tool-bossac @ 1.10700.190624 (1.7.0) 
 - toolchain-gccarmnoneeabi @ 1.70201.0 (7.2.1)
LDF: Library Dependency Finder 
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 16 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Checking size .pio/build/seeed_xiao/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   7.3% (used 2408 bytes from 32768 bytes)
Flash: [          ]   4.8% (used 12596 bytes from 262144 bytes)
Configuring upload protocol...
AVAILABLE: atmel-ice, blackmagic, jlink, sam-ba
CURRENT: upload_protocol = sam-ba
Looking for upload port...
Auto-detected: /dev/cu.usbmodem2101
Forcing reset using 1200bps open/close on port /dev/cu.usbmodem2101
Waiting for the new upload port...
Uploading .pio/build/seeed_xiao/firmware.bin
No device found on cu.usbmodem2101
*** [upload] Error 1
================================================================ [FAILED] Took 10.50 seconds ================================================================
localuser@marc-macbook-pro ~ % ./.platformio/penv/bin/platformio run -d ./Documents/PlatformIO/Projects/RTOSagain -t upload --verbose
Warning! Ignore unknown configuration option `upload.using` in section [env:seeed_xiao]
Processing seeed_xiao (platform: atmelsam; board: seeed_xiao; framework: arduino; monitor_speed: 115200; upload_protocol: sam-ba; upload.using: bootloader)
-------------------------------------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: 
PLATFORM: Atmel SAM (8.3.0) > Seeeduino XIAO
HARDWARE: SAMD21G18A 48MHz, 32KB RAM, 256KB Flash
DEBUG: Current (atmel-ice) External (atmel-ice, blackmagic, jlink)
PACKAGES: 
 - framework-arduino-samd-seeed @ 1.8.5 
 - framework-cmsis @ 2.50400.181126 (5.4.0) 
 - framework-cmsis-atmel @ 1.2.2 
 - tool-bossac @ 1.10700.190624 (1.7.0) 
 - toolchain-gccarmnoneeabi @ 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 16 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
MethodWrapper(["checkprogsize"], [".pio/build/seeed_xiao/firmware.elf"])
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   7.3% (used 2408 bytes from 32768 bytes)
Flash: [          ]   4.8% (used 12596 bytes from 262144 bytes)
.pio/build/seeed_xiao/firmware.elf  :
section            size        addr
.text             12344        8192
.data               252   536870912
.bss               2156   536871164
.ARM.attributes      40           0
.comment            126           0
.debug_frame       1208           0
.stabstr            279           0
Total             16405
<lambda>(["upload"], [".pio/build/seeed_xiao/firmware.bin"])
AVAILABLE: atmel-ice, blackmagic, jlink, sam-ba
CURRENT: upload_protocol = sam-ba
BeforeUpload(["upload"], [".pio/build/seeed_xiao/firmware.bin"])
TimeoutError: Could not automatically find serial port for the `Seeeduino XIAO` board based on the declared HWIDs=['2886:802F', '2886:002F']
Auto-detected: /dev/cu.usbmodem2101
Forcing reset using 1200bps open/close on port /dev/cu.usbmodem2101
Waiting for the new upload port...
bossac --info --debug --port "cu.usbmodem2101" --write --verify --reset --erase -U true .pio/build/seeed_xiao/firmware.bin
No device found on cu.usbmodem2101
Set binary mode
Send auto-baud
Set binary mode
*** [upload] Error 1

Nope. You’ve selected the Seeeduino XIAO with an Atmel SAMD21 chip. You have a totally different XIAO. The one with the ESP32C3. You need this one

https://docs.platformio.org/en/latest/boards/espressif32/seeed_xiao_esp32c3.html

with a platformio.ini of just

[env:seeed_xiao_esp32c3]
platform = espressif32
board = seeed_xiao_esp32c3
framework = arduino
monitor_speed = 9600
1 Like

Thanks Max,

I changed it, but I fear the only progress I made is I now get an error 2.

localuser@marc-macbook-pro freeRTOS_1 % pio run --target upload -d /Users/localuser/Documents/PlatformIO/Projects/freeRTOS_1 --verbose
Processing seeed_xiao_esp32c3 (platform: espressif32; board: seeed_xiao_esp32c3; framework: arduino; monitor_speed: 9600)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/seeed_xiao_esp32c3.html
PLATFORM: Espressif 32 (6.8.1) > 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.20017.0 (2.0.17) 
 - 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 33 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
<lambda>(["checkprogsize"], [".pio/build/seeed_xiao_esp32c3/firmware.elf"])
MethodWrapper(["checkprogsize"], [".pio/build/seeed_xiao_esp32c3/firmware.elf"])
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.1% (used 13476 bytes from 327680 bytes)
Flash: [==        ]  16.7% (used 218942 bytes from 1310720 bytes)
.pio/build/seeed_xiao_esp32c3/firmware.elf  :
section                   size         addr
.rtc.text                   16   1342177280
.rtc.force_fast              0   1342177296
.rtc_noinit                 16   1342177296
.rtc.force_slow              0   1342177312
.iram0.text              40982   1077411840
.dram0.dummy             41472   1070071808
.dram0.data               7252   1070113280
.noinit                      0   1070120532
.dram0.bss                6224   1070120544
.flash.text             133164   1107296288
.flash_rodata_dummy     196608   1006632992
.flash.appdesc             256   1006829600
.flash.rodata            37544   1006829856
.eh_frame                 9536   1006867400
.flash.rodata_noload         0   1006876936
.iram0.text_end            490   1077452822
.iram0.data                  0   1077453312
.iram0.bss                   0   1077453312
.dram0.heap_start            0   1070126768
.debug_info            2576126            0
.debug_abbrev           242930            0
.debug_aranges           23424            0
.debug_ranges            67768            0
.debug_line            1021132            0
.debug_str              291799            0
.comment                    93            0
.riscv.attributes           55            0
.debug_loc              485947            0
.debug_frame             66960            0
Total                  5249794
<lambda>(["upload"], [".pio/build/seeed_xiao_esp32c3/firmware.bin"])
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
BeforeUpload(["upload"], [".pio/build/seeed_xiao_esp32c3/firmware.bin"])
Auto-detected: /dev/cu.usbmodem2101
"/Users/localuser/.platformio/penv/bin/python" "/Users/localuser/.platformio/packages/tool-esptoolpy/esptool.py" --chip esp32c3 --port "/dev/cu.usbmodem2101" --baud 460800 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x0000 /Users/localuser/Documents/PlatformIO/Projects/freeRTOS_1/.pio/build/seeed_xiao_esp32c3/bootloader.bin 0x8000 /Users/localuser/Documents/PlatformIO/Projects/freeRTOS_1/.pio/build/seeed_xiao_esp32c3/partitions.bin 0xe000 /Users/localuser/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin 0x10000 .pio/build/seeed_xiao_esp32c3/firmware.bin
esptool.py v4.5.1
Serial port /dev/cu.usbmodem2101

A fatal error occurred: Could not open /dev/cu.usbmodem2101, the port doesn't exist
*** [upload] Error 2
=================================================================== [FAILED] Took 0.67 seconds ===================================================================
localuser@marc-macbook-pro freeRTOS_1 % ls /dev/cu*
/dev/cu.Bluetooth-Incoming-Port	/dev/cu.JBLTUNEFLEX		/dev/cu.usbmodem2101
localuser@marc-macbook-pro freeRTOS_1 %

No, wait… It is an ESP32S3 not a C3; I changed it and it is now works!!! Thanks for your help!!