I don’t quite follow what you mean, but I presume Max does
Well that definitely looks like the sketch is running and it has found 12 surrounding WiFi networks, but funnily enough you don’t see the sketch output. For some strange reason the core’s debug output goes to the right serial bot not
The board you have does not have a USB-Serial converter chip right? It connects USB straight to the ESP32-S2?
Neither adding nor removing
-DARDUINO_SERIAL_PORT=1 makes a difference?
OH lol! Removing
-DARDUINO_SERIAL_PORT=1 from the config did actually work. (I thought I was waiting for your response on whether or not trying this was useful after the first test you suggested)
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time --- More details at http://bit.ly/pio-monitor-filters --- Miniterm on COM5 115200,8,N,1 --- --- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H --- ESP-ROM:esp32s2-rc4-20191025 Build:Oct 25 2019 rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT) SPIWP:0xee mode:DIO, clock div:2 load:0x3ffe6100,len:0x424 load:0x4004c000,len:0x844 load:0x40050000,len:0x2460 entry 0x4004c180 [ 857][V][WiFiGeneric.cpp:273] _arduino_event_cb(): STA Started [ 859][D][WiFiGeneric.cpp:795] _eventCallback(): Arduino Event: 2 - STA_START �[ 3814][V][WiFiGeneric.cpp:307] _arduino_event_cb(): SCAN Done: ID: 128, Status: 0, Results: 11 [ 3815][D][WiFiGeneric.cpp:795] _eventCallback(): Arduino Event: 1 - SCAN_DONE scan done 11 networks found 1: [REDACTED] (-47)* 2: [REDACTED] (-55)* 3: [REDACTED] (-55)* 4: [REDACTED] (-62)* 5: [REDACTED] (-88)* 6: [REDACTED] (-88)* 7: [REDACTED] (-88)* 8: [REDACTED] (-88)* 9: [REDACTED] (-90)* 10: [REDACTED] (-91)* 11: [REDACTED] (-92)*
I’m going to try another sketch now to make sure this isn’t a fluke
[env:MagTag] platform = espressif32 platform_packages = toolchain-xtensa32s2 framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#2.0.0-alpha1 framework = arduino board = esp32dev board_build.mcu = esp32s2 board_build.partitions = huge_app.csv build_unflags = -DARDUINO_ESP32_DEV -DARDUINO_VARIANT="esp32" build_flags = -DARDUINO_MAGTAG29_ESP32S2 ; -DARDUINO_SERIAL_PORT=1 -DARDUINO_VARIANT="adafruit_magtag29_esp32s2" ; -DBOARD_HAS_PSRAM -DCORE_DEBUG_LEVEL=5 monitor_speed = 115200
Although I would still be very interested in seeing a more official way to get support for this board. Is there any way we could get this merged soon?
The above is relying on
2.0.0-alpha1, and PlatformIO only supports proper release versions. Once 2.0.0 gets actually released the PlatformIO people will add the proper board definitions, framework files and other missing bits and pieces (like here or here) for proper support and it’ll work out of the box. Until then it’s all beta-stuff and custom. See my thoughts in Board Definition for Adafruit MagTag - #5 by maxgerhardt.
Understood, thank you for the clarification. (and help!)
As far as I can tell, the espressif / arduino-esp32 repo has been changed, so that this workaround no longer works.
Does anyone know how to set it up correctly now?
The config should still work for
2.0.0-alpha1, but since
master has advanced and they changed the toolchain, you need to replicate it too. This was discussed recently in Broken ESP32-C3 config/build after moving to arduino-esp32 v2.0.0-rc1 - #2 by maxgerhardt (equivalently for
toolchain-xtensa32s2 for a ESP32-S2 that is, not the riscv toolchain for a ESPC3).
Is there any documentation about what ‘missing bits’ need to get added in? Previously I was able to use
release/v3.3 of the
esp32-arduino-lib-builder and just do this to copy in recompiled IDF things:
cp -r out/tools/* ~/.platformio/packages/framework-arduinoespressif32/tools cp -r out/platform.txt ~/.platformio/packages/framework-arduinoespressif32/platform.txt
But it looks like the directory structure has changed and all my attempts to copy in files in different spots don’t seem to work.
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.
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.
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
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.
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 = firstname.lastname@example.org # 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.
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?