ESP32-C3 IDF example?

After hours of unsuccessful tries, back to the basics:

I’m looking for examples for the ESP32-C3. The examples provided within the PIO explorer are only for ESP32, throwing the expected error A fatal error occurred: This chip is ESP32-C3 not ESP32. Wrong --chip argument? with the most basic example like esp-idf-blink while flashing. Trying out the examples from the original repo results in libraries not being found. This i figured out was due to missing config inside of sdkconfig.defaults which i found out can be edited with menuconfig. Still, if i get to compile these examples after much fiddling around, the ESP32-C3 immediately crashes and reboots. Uploading the exact same code with the eclipse IDE and the ESP-IDF installed works just fine. I still would like to transition to PIO.

Crash/boot log from serial terminal:

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x10 (RTCWDT_RTC_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:QIO, clock div:1
load:0x3fcd6100,len:0x17f4
ets_loader.c 78

platformio.ini:

[env:esp32-c3-devkitm-1]
platform = espressif32
board = esp32-c3-devkitm-1
framework = espidf

monitor_speed = 115200

Again in short: please provide me with a minimal working example for the ESP32-C3 with the ESP-IDF under PIO.

The default board = .. setting may be a standard ESP32, but that’s nothing that’s unchangable. What’s your platformio.ini?

Using examples from the master branch of ESP-IDF will surely get you these kinds of errors, since the latest platform-espressif32 version gives you ESP-IDF 4.4.3, not the develop or some 5.x version. It’s thus only appropriate to use the examples from the same version, 4.4.3 at the moment.

Added platformio.ini and the serial log to the original post. So you are saying that PIO is “ahead” of the IDF since it mentions versions above 4?

Looks okay. Can you use the exact same sample code as in https://github.com/platformio/platform-espressif32/tree/develop/examples/espidf-blink/src with an added

build_flags = -D CONFIG_BLINK_GPIO=2

(or wherever the built-in LED of the board is)?

You can also delete all *sdkconfig* files in the root of the project and rerun pio run -t menuconfig in the CLI to regenerate the defaults.

I took your advice regarding the versions and edited my platformio.ini's platform variable to an older version with platform = espressif32@4.4.0 and now it works, thank you for your help as always! I did not test your latest answer as it works with the mentioned editing of the version.

I am using pio again after a long break and finding previous work is broken. For example, ESP32-C3 was rebooting because of SHA-256. After a search, I set platform as did jake-esd-protected1. Now the C3 is working again.