How to flash XIAO-Seeed-ESP32-C6

I would like to run this chip via arduino framework and espidf framework in platformIO. In general if you know that one framework can somehow be used for
this please let me know so I can pursue it further.

Arduino try:
My platformio.ini:

[env:seeed_xiao]
platform = atmelsam
board = seeed_xiao
framework = arduino

The example code for a blinking LED build and almost flashes but when it tries to flash the bin it says:

Processing seeed_xiao (platform: atmelsam; board: seeed_xiao; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
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 -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 15 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.2% (used 10884 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: COM14
Forcing reset using 1200bps open/close on port COM14
Waiting for the new upload port...
Uploading .pio\build\seeed_xiao\firmware.bin
No device found on COM14
*** [upload] Error 1
================================================================================================ [FAILED] Took 10.05 seconds

Obviously my device is connected as I can see it in the device manager and I was able to flash it in the past via espressif IDE.
Right before the line: Uploading …firmware.bin, I can hear a sound from my computer. Almost like it would disconnect before it is trying to upload the bin. And afterwards it is shown in the device manager again.

espidf try:
My platform.ini:

[env:esp32-c6-devkitc-1]
platform = espressif32
board = esp32-c6-devkitc-1
framework = espidf
board_build.flash_size = 4MB

The example blinking code compiles and gets flashed but the led is not blinking and when I try to monitor it I’ll see a long cryptic text repeating itself. According to ChatGPT that can occure when there is a mismatch in build flash size. That is why I have tried including the line: board_build.flash_size = 4MB but also without. It is worth mentioning that I couldn’t find the board(XIAO-Seeed-ESP32-C6) or simular for the espressif32 platform with espidf framework. That’s why I have tried the esp32-c6-devkitc-1 since it contains the same c6 chip as my board.

If you know any working configuration for the XIAO-Seeed-ESP32-C6 please let me know. If anyone can help me fix those issues I would be really Thankful. Thank you in advance for reading the message.

The situation is a bit complicated…

The ESP32-C6 requires at least ESP-IDF version 5.1. This is no problem with PlatformIO and is supported since espressif32 version 6.4.0. Pure ESP-IDF projects should therefore work without problems from espressif32 @ 6.4.0.

However, the latest Espressif32 Arduino version available (officially for PlatformIO) is 2.0.17 which is based on ESP-IDF 4.4.7 and therefore cannot use the C6.

You need Espressif Arduino 3.0.x or 3.1.x which is based on ESP-IDF 5.1.4 or 5.3.0 respectively. See platform-espressif32 versions · GitHub

You can use the alternative platform pioarduino/platform-espressif32. This offers you the latest Espressif32 Arduino core (currently version 3.0.7).

This allows you to write Arduino and ESP-IDF as well as Arduino as ESP-IDF Component projects.

Luckily there is a board manifest for the XIAO-Seeed-ESP32-C6

Unfortunately this is not yet included in the current release.
So you have to download this file and put it into a "boards" folder located in your projects folder like so:

.
├── .pio
├── .vscode
├── boards
│   └── seeed_xiao_esp32c6.json
├── include
├── lib
├── src
│   └── main.cpp
├── test
├── .gitignore
└── platformio.ini

Using the following platformio.ini should then work for you:

[env:seeed_xiao_esp32c6]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
board = seeed_xiao_esp32c6
framework = arduino

Update: After following sivar’s comment, deleting the .platformio folder under C:\Useres\myName and restarting VSCode, pioarduino was able to configure everything correctly and I can run my XIAO-Seeed-ESP32-C6 now with arduino framework including espressif functions - thank you so much <3.