ESP32-C6-Zero does not work on PlatformIO

Hi, I try to use PIO under VS-Code and first I try my board on Arduino IDE. The Board ESP32-C6-Zero I’m using is not on the board list (in Arduino) then I use ESP32-C6 Dev Module, and I success to run RGB Blink prog.
Now I use VS-Code and PIO, I’m not able to find equivalent to ESP32-C6 Dev Module under PIO, I’ve found esp32-c6-devkitc-1 and esp32-c6-devkitm-1 but not working with my board. I try tu use this setup on inifile :

[env:esp32-c6-devkitc-1]
platform = espressif32
board = esp32-c6-devkitc-1
framework = arduino
board_upload.flash_size = 4MB
board_build.partitions = default.csv
build_flags =
-DARDUINO_USB_CDC_ON_BOOT=1
-DBOARD_HAS_PSRAM

and the compilation fail !

Exécution de la tâche : C:\Users\vince\.platformio\penv\Scripts\platformio.exe run 

Processing esp32-c6-devkitc-1 (platform: espressif32; board: esp32-c6-devkitc-1; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32-c6-devkitc-1.html
PLATFORM: Espressif 32 (6.10.0) > Espressif ESP32-C6-DevKitC-1
HARDWARE: ESP32C6 160MHz, 320KB RAM, 8MB 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.241212+sha.dcc1105b
Error: This board doesn't support arduino framework!
 - tool-esptoolpy @ 1.40501.0 (4.5.1)
 - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
=============================================== [FAILED] Took 1.13 seconds ====

Any idea ?

ESP32-C6 requires Espressif Arduino 3.x
Check GitHub - pioarduino/platform-espressif32: Espressif 32: pioarduino community platform compatible with PlatformIO

Ok thanks Boris, it seems too much complicated to me to use this!
How can I use directly the ESPIDF Framework under PIO?
BTW, how to create my one ESP32-C6-Zero json board file ? Is there somewhere a document explain how to create one?

But it is just changing a single line in your platformio.ini:

from:

platform = espressif32

to:

platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
framework = espidf

Misunderstanding! It is much more than just creating a board manifest!
Arduino 2.x is based on ESP-IDF 4.x which does not support ESP32-C6.
So if you want to use Arduino you have to use Arduino 3.x which is based on ESP-IDF-5.x

Misunderstanding! Yes, of course … At the beginning I have 3 types of boards for a small project, an Arduino ESP32, the ESP32-C3-Zero and ESP32-C6-Zero. To blink the onboard LED with Arduino IDE it’s easy, but for my project, I need to use the BLE and Midi, I dismissed Arduino ESP32 too big for this project (I need only few I/O) and try to use C3 or C6 and it seems Arduino IDE is not ideal for that. Following some recommendations by people I’ve decide to move on VS-Code & PIO. But it looks C3 and C6 are not really supported by PIO or you need to use “similar” boards … My observation is I’m not able to got a blink the on board LED with … or so much complicated for me. :confused:

ESP32-C3 is supported in Arduino 2.x.

For BLE I recommend to use the NimBle-Arduino library as it requires less flash and ram.

Blinking an LED should be no problem at all?

I highly recommend pioarduino as you will get the latest Espressif Arduino version (currently 3.1.2)

I have the ESP32-C3-Zero myself and it works perfectly with

board = esp32-c3-devkitm-1
build_flags = 
  -DARDUINO_USB_CDC_ON_BOOT=1
  -DARDUINO_USB_MODE=1

The ESP32-C6 should also work with eps32-c6-devkitc-1, but as mentioned before, this requires pioarduino/platform-espressif32

platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
board = eps32-c6-devkitc-1
build_flags = 
  -DARDUINO_USB_CDC_ON_BOOT=1

The build flags are necessary because these boards only have the built-in native USB port of the chip. And the C3 only supports USB_MODE=1

Hi Boris, you’re right, first with ESP32-C3 by adding the following on the ini file :

[env:esp32-c3-devkitm-1]
platform = espressif32
board = esp32-c3-devkitm-1
framework = arduino
build_flags = 
	-DARDUINO_USB_CDC_ON_BOOT=1
	-DARDUINO_USB_MODE=1
lib_deps = fastled/FastLED@^3.9.13

Now compile + Upload work ! Thanks. I’ll try using ESP32-C6 with pioarduino …

1 Like

So I try to do the same witn C6, not same strory!
The platformio.ini file :

[env:esp32-c6-devkitc-1]
board_build.flash_size = 4MB  ; or 32Mbit
platform = espressif32 ; better than github ?
; platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
board = esp32-c6-devkitc-1
framework = arduino
build_flags = 
  -DARDUINO_USB_CDC_ON_BOOT=1
lib_deps =
    fastled/FastLED@*  ; For latest```

And this code :

#include <FastLED.h>

#define NUM_LEDS 1
#define DATA_PIN 8

// Define the array of leds
CRGB leds[NUM_LEDS];

void setup() 
  { 
    FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);  // GRB ordering is typical
  }    

void loop() 
  { 
    // Turn the LED on, then pause
    leds[0] = CRGB::Red;
    FastLED.show();
    delay(500);
    // Now turn the LED off, then pause
    leds[0] = CRGB::Black;
    FastLED.show();
    delay(500);
  }

Not work! Have you an example ?

As mentioned before, the ESP32-C6 requires at least Arduino 3.x!

So you have to use

platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip

When compiling, take a look at the PLATFORM output:

PLATFORM: Espressif 32 (53.3.12)

About your code: Is it just about blinking the onboard RGB LED or is it about driving a whole RGB stripe?

If it is just about one single RGB led you don’t need FastLED library for that.
Simply use the built-in function rgbLedWrite or rgbLedWriteOrdered

platformio.ini

[env:esp32-c6-devkitm-1]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.12/platform-espressif32.zip 
board = esp32-c6-devkitm-1
framework = arduino

main.cpp

#include <Arduino.h>

const int RGB_LED = 8;

void setup() {
}

void loop() {
    rgbLedWrite(RGB_LED, 255,0,0);
    delay(500);
    rgbLedWrite(RGB_LED, 0,0,0);
    delay(500);
}

Thanks Boris, I try to adapt the working example from Arduino IDE to VS-Code/PIO without succes for C6.For your information rgbLedWrite requiere FastLED library and not work.

I have to disagree. rgbLedWrite() is a built-in function of the Arduino 3.x core and does not require an external library. So something else must be wrong.

I get this message on TERMINAL :

C:/Users/vince/.platformio/packages/toolchain-riscv32-esp@13.2.0+20240530/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld.exe: .pio/build/esp32-c6-devkitm-1/libFrameworkArduino.a(main.cpp.o): in function `loopTask(void*)':
C:/Users/vince/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:55:(.text._Z8loopTaskPv+0x22): undefined reference to `setup()'
C:/Users/vince/.platformio/packages/toolchain-riscv32-esp@13.2.0+20240530/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld.exe: C:/Users/vince/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:64:(.text._Z8loopTaskPv+0x4a): undefined reference to `loop()'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\esp32-c6-devkitm-1\firmware.elf] Error 1
=============================== [FAILED] Took 13.36 seconds ========

Your code is missing #include <Arduino.h>. But I don’t think that this is the cause.

Do you have multiple projects open in a single VS Code workspace?

I tried your code (using FastLED library) and this also works without issues.

No I’ve only one, I think !

No you have two:
image

Please open just the project you want to use. Otherwise this might cause trouble.

The current error is that you are redefining RGB_BRIGHNTESS which is not allowed.
Remove that #define RGB_BRIGHTNESS !

Try the excact code i gave you before: ESP32-C6-Zero does not work on PlatformIO - #10 by sivar2311

Your VS Code window should look like this:

Open a single project:
Click on “File / Open Folder”
Then navigate to your project folder:


Then click “OK”

I found the main ISSUE!

You have main.c but you have to use main.cpp !!!
And this is not an Arduino project, but looks like an ESP-IDF project !?

You’re right ! I change from .c to cpp and now it works! Many thanks :+1::wink:

Your projects have some esp-idf leftovers you should remove

./cMakeLlists.txt
./sdkconfig.esp32-c6…
./src/CMakeLists.txt

You’ll find a clean Arduino “c6 rgb blink” project here GitHub - sivar2311/c6_rgb_blink

Ok thanks Boris for your help! Do I need really the pioarduino add on ? my next investigation are to use the BLE and Midi (I was not able to work on it with Arduino IDE) …