PlatformIO + pioarduino + M5StickC Plus2: Cannot compile due to I2S v2 API incompatibility
I’m using an M5StickC Plus2 and the M5Stack SPK2 Hat (I2S speaker). In the Arduino IDE, everything works perfectly using ESP32-audioI2S with Arduino core 3.x. Now I’m trying to use PlatformIO with pioarduino (ESP32 core 3.x fork) to get the same audio playback working.
❌ Problem Compilation fails due to:
error: 'i2s_chan_handle_t' does not name a type This comes from code that uses the new I2S v2 API (i2s_std_config_t, i2s_chan_handle_t, etc.).
This seems related to PlatformIO’s use of its own build system and lack of ESP-IDF header propagation or mismatched SDKs.
⚙️ My Setup PlatformIO platformio.ini: platform = https://github.com/pioarduino/platform-espressif32.git board = m5stick-c framework = arduino monitor_speed = 115200 lib_deps = https://github.com/m5stack/M5Unified.git#8b25496 https://github.com/m5stack/M5GFX.git#develop arduino-libraries/Arduino_BMI270_BMM150 paulstoffregen/Mahony adafruit/Adafruit Unified Sensor adafruit/Adafruit BusIO adafruit/Adafruit BMP280 Library arduino-libraries/WiFi schreibfaul1/ESP32-audioI2S m5stack/M5Unified 🔍 What I've Tried Works in Arduino IDE with Arduino core 3.0.0
Fails in PlatformIO (even with pioarduino)
Tried modifying library includes to manually pull in ESP-IDF 5 headers — no success Tried every other audio library I could find but all fail, both on espressif32 and pioarduino 💡 Feature Request Could you provide:
Either a backwards-compatible version using the I2S v1 API (e.g., i2s_config_t)
Or guidance for PlatformIO+pioarduino users to get this compiling?
Thank you for the great library and all your work!
I suspect the Arduino version is < V3 because: error: 'i2s_chan_handle_t' does not name a type
Try this template, https://github.com/schreibfaul1/ESP32_Arduino_ESPIDF
"Following your ESP32_Arduino_ESPIDF template recommendation, I'm getting multiple ESP-IDF configuration issues:
FreeRTOS tick rate mismatch: esp32-arduino requires CONFIG_FREERTOS_HZ=1000 (currently 100) Git repository errors: Multiple fatal: not a git repository messages Bluetooth config warning: BTDM_CTRL_CONTROLLER_DEBUG_MODE_1 has a "visible if" option, which is not supported Missing project commits: ESP Insights Project commit: HEAD-HASH-NOTFOUND
How should these be configured in your template for proper Arduino+ESP-IDF integration?"
fatal: not a git repository (or any of the parent directories): .git fatal: not a git repository (or any of the parent directories): .git ESP Insights Project commit: HEAD-HASH-NOTFOUND ESP RainMaker Project commit: HEAD-HASH-NOTFOUND CMake Error at C:/Users/peter/.platformio/packages/framework-arduinoespressif32/CMakeLists.txt:377 (message): esp32-arduino requires CONFIG_FREERTOS_HZ=1000 (currently 100)
Here is my ini
[env:m5stick-c] platform = https://github.com/pioarduino/platform-espressif32.git board = m5stick-c framework = arduino, espidf monitor_speed = 115200 build_flags = -D CORE_DEBUG_LEVEL=3 -D CONFIG_ARDUHAL_LOG_COLORS=1 -D ARDUINO_RUNNING_CORE=1 -D ARDUINO_EVENT_RUNNING_CORE=1 -D AUDIOTASK_CORE=0 -D BOARD_HAS_PSRAM=1 -D CONFIG_FREERTOS_HZ=1000 -Wall -Wextra -I$PROJECT_PACKAGES_DIR/framework-arduinoespressif32/variants/m5stack_stickc_plus2 lib_deps = https://github.com/m5stack/M5Unified.git https://github.com/m5stack/M5GFX.git arduino-libraries/Arduino_BMI270_BMM150 paulstoffregen/Mahony adafruit/Adafruit Unified Sensor adafruit/Adafruit BusIO arduino-libraries/WiFi https://github.com/schreibfaul1/ESP32-audioI2S.git
We added -D CONFIG_FREERTOS_HZ=1000
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.