Thank you for your reply! No I can not create the espidf with the ArduinoIDE. I use ArduinoIDE 2.3.2 on Ubuntu with the latest release of the core. PlatformIO I installed this week, so latest version.
With framework = arduino
everything works as expected.
I investigated further, I think the problem arises in HardwareSerial.h
.In the manifest file lolin_s2_mini.json
it sets #defines like this:
"core": "esp32",
"extra_flags": [
"-DARDUINO_LOLIN_S2_MINI",
"-DBOARD_HAS_PSRAM",
"-DARDUINO_USB_CDC_ON_BOOT=1",
"-DARDUINO_USB_MODE=0"
],
That causes Serial
not to be #define
’d.
At the beginning of HardwareSerial.h
the file USBCDC.h
is included. This does define Serial
if CONFIG_TINYUSB_CDC_ENABLED
is defined. So I tried to use menuconfig
to enable TinyUSB. This fails because an include file is not found.
Next I added:
lib_deps =
adafruit/Adafruit TinyUSB Library@^3.1.3
lib_ignore = USBHost
This fails as follows:
In file included from .pio/libdeps/lolin_s2_mini/Adafruit TinyUSB Library/src/tusb_option.h:240,
from .pio/libdeps/lolin_s2_mini/Adafruit TinyUSB Library/src/Adafruit_TinyUSB.h:33,
from src/main.cpp:3:
.pio/libdeps/lolin_s2_mini/Adafruit TinyUSB Library/src/tusb_config.h:47:14: fatal error: ../../arduino_tinyusb/include/tusb_config.h: No such file or directory
#include "../../arduino_tinyusb/include/tusb_config.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
When I look at the file tusb_config.h
, at the location where the include fails, it reads:
#elif defined(ARDUINO_ARCH_ESP32)
// Note: when compiling core Arduino IDEs will include tusb_config.h in the BSP
// sdk/include/arduino_tinyusb/include. While compiling .c file in this library this
// file will be used instead. For consistency: include the one in BSP here as well
#include "sdkconfig.h"
#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
#include "../../arduino_tinyusb/include/tusb_config.h"
#else
#include "arduino/ports/esp32/tusb_config_esp32.h"
#endif
What I undestand is that the library refers to a file present in the Arduino ESP32 core, by “going to directories up”, this line from the above snippet: #include "../../arduino_tinyusb/include/tusb_config.h"
. However, in PlatformIO espidf this file is at a different location.
Now I am sort of stuck. My preliminary conclusions so far are:
- The lolin_s2_mini board uses a different kind of serial monitor, no UART but a USB connection
- In the ESP32 Arduino core support for this kind of connection is compiled correctly
- In the PlatformIO espidf several
#define
s seem to be needed to set, but it is not clear for me which ones
- My best guess is that
TinyUSB
is needed for this board but either an include path is incorrect in that library for PlatformIO or I do not know how to import the library correctly
Any suggestion is welcome!