Using the PlatformIO and the Arduino framework with the ESP32-S2-DevKitM-1

The platform.txt is not read by PlatformIO, no use in copying it.

What exactly do you want to achieve? The 2.0.0 core with an S2 board? There are still multiple issues for these kind of boards and integration is being worked on by staff (Support for the latest Arduino v2.0 · Issue #619 · platformio/platform-espressif32 · GitHub) and is not yet done. Best to not do custom hacks.

For ESP32 boards (not C3 or S2), see Use different version of Arduino framework on espressif platform - #6 by maxgerhardt if you really want to try it.

1 Like

Oh good to know, thank you.

What exactly do you want to achieve?

I have a ESP32 (TinyPico – not S2) project that uses Arduino but needs some sdkconfig changes that don’t seem to be available in IDF 3.3. Thanks for the link. I tried briefly and it’s not picking up my local xtensa toolchain for some reason. But sounds like here be dragons right?

In general if people need to make sdkconfig changes for their project I imagine they switch to using esp-idf directly right? Doesn’t seem like that’s very supported by esp32-arduino & platformio.

I corrected the info about the to-be-used system value in the package.json for Linux.

For 2.0.0 definitely not because it’s not integrated right now. PlatformIO does have an example though to rebuild Arduino-ESP32 with a different ESP-IDF configuration (platform-espressif32/examples/espidf-arduino-blink at develop · platformio/platform-espressif32 · GitHub), that’s using a branch (which was deleted in the original repository but saved by another user) that uses ESP-IDF v4.0.

Though if you are able to stand-alone recompile the libraries for a standard core version (e.g. 2.0.0) and you can get a standard 2.0.0 core version to work using the link above, your method of overwriting the precompiled libraries should work.

1 Like

You nailed it – that was my problem. Thank you. I get the same result as you now.

Very interesting, so with this example, since the platformio.ini specifies framework = arduino, espidf It will rebuild framework-arduinoespressif32 using the included sdkconfig.defaults file as overrides? And it all just magically works?

But nobody has this working yet right? Your post is the closest anyone’s gotten?

If it works, yes. It is basically an ESP-IDF project that has the Arduino-ESP32 added to it via a component. Doing so is not a magic trick only PlatformIO can do, it’s intended usage per regular ESP-IDF docs. In fact you should be able to use regular native ESP-IDF tooling to also achieve your “Use custom ESP-IDF config with Arduino-ESP32 2.0.0” goal.

If have not yet attempted to recompile libraries used in, e.g., the current master branch of Arduino-ESP32 or the 2.0.0 branch. My last experiences with GitHub - espressif/esp32-arduino-lib-builder were traumatizing enough – unclear configuration (regarding the exact ESP-IDF version that is expected by a certain Arduino-ESP32 branch), bugs during execution, etc. Maybe things are better now though.

1 Like

Ok here’s what worked for me (with irrelevant bits removed). The build_flags thing tripped me up a bit. I guess the espidf-arduino-blink example can get away without them because it’s stupid simple?

[env]
platform = espressif32@3.3.2 # ESP-IDF 4.3.1
framework =
	arduino
	espidf
platform_packages =
	framework-arduinoespressif32 @ https://github.com/marcovannoord/arduino-esp32.git#idf-release/v4.0
board = esp32dev
# These need to mirror the ones used by PlatformIO when building for Arduino
# https://github.com/marcovannoord/arduino-esp32/blob/idf-release/v4.0/tools/platformio-build.py#L101
build_flags =
	-D ESP32
	-D ESP_PLATFORM
	-D MBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\"
	-D ARDUINO=10805
	-D ARDUINO_ARCH_ESP32

I also tried some other SHAs of arduino-esp32 from the last few months since that release/v4.0 branch is from Sep 30, 2020 but I wasn’t able to find one that would work with the latest PlatformIO ESP-IDF (4.3.1). I guess we just wait until ESP-IDF 4.4 is marked stable and the PlatformIO espressif32 library gets updated and then we can use arduino-esp32 v2.0.0? @maxgerhardt does that all line up with your understanding of things?

Thank you. You are my hero. I got my Wemos S2 Mini to compile and load. Were you able to use the S2 built it USB? /dev/ttyAMC0 disappears after flashing my app. I know the app is running because the wifi AP shows up. The problem is I print the AP’s ip address out on Serial1. Also, Serial2 isn’t defined.

1 Like

I found a few references that say the USB Serial doesn’t work in the Arduino framework so I gave up. I found an Adafruit FTDI Friendly USB to serial converter in my junk drawer and configured the UART pins with Serial1.begin method. I’m all good to go and am a happy man. Serial2 isn’t defined because my board only has two UARTs 0 and 1. Thanks again!

v4.4 is stable now. Care to add DevKit boards and Arduino framework for S2 chips?

1 Like
1 Like