Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I2S driver i2s_std_clk_config_t macro compilation error #10975

Open
1 task done
earlephilhower opened this issue Feb 16, 2025 · 2 comments
Open
1 task done

I2S driver i2s_std_clk_config_t macro compilation error #10975

earlephilhower opened this issue Feb 16, 2025 · 2 comments
Labels
Status: Awaiting triage Issue is waiting for triage

Comments

@earlephilhower
Copy link
Contributor

earlephilhower commented Feb 16, 2025

Board

ESP32C6 Dev Module

Device Description

Plain generic ESP32-C6 board with no peripherals attached

Hardware Configuration

N/A

Version

v3.1.2

IDE Name

Arduino IDE

Operating System

Linux Ubuntu 22.04

Flash frequency

n/a

PSRAM enabled

no

Upload speed

n/a

Description

Setting default clocking on I2S using the IDF macros fails with a compilation error (initializer out of order in the IDF header itself). 3.1.1 release builds OK, only 3.1.2 with a newer IDF shows the issue.

I'm not sure if this needs to be tracked here or the IDF repo as the issue relates to an IDF header/macro with compile errors. I have opened espressif/esp-idf#15405 with similar details since this is an IDF header and not something the Arduino-ESP32 guys made.

Sketch

`
#include <driver/i2s_std.h>
void setup() {
int freq = 44100;
i2s_std_clk_config_t clk_cfg = I2S_STD_CLK_DEFAULT_CONFIG((uint32_t)freq);
}
void loop() {
}
`

Debug Message

`
/home/earle/.arduino15/packages/esp32/tools/esp-rv32/2405/bin/riscv32-esp-elf-g++ -MMD -c @/home/earle/.arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.3-489d7a2b-v1/esp32c6/flags/cpp_flags -Wall -Wextra -Og -g3 -Werror=return-type -DF_CPU=160000000L -DARDUINO=10607 -DARDUINO_ESP32C6_DEV -DARDUINO_ARCH_ESP32 "-DARDUINO_BOARD=\"ESP32C6_DEV\"" "-DARDUINO_VARIANT=\"esp32c6\"" -DARDUINO_PARTITION_default "-DARDUINO_HOST_OS=\"linux\"" "-DARDUINO_FQBN=\"esp32:esp32:esp32c6:UploadSpeed=921600,CDCOnBoot=default,CPUFreq=160,FlashFreq=80,FlashMode=qio,FlashSize=4M,PartitionScheme=default,DebugLevel=none,EraseFlash=none,JTAGAdapter=default,ZigbeeMode=default\"" -DESP32=ESP32 -DCORE_DEBUG_LEVEL=0 -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=0 @/home/earle/.arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.3-489d7a2b-v1/esp32c6/flags/defines -I/tmp/.arduinoIDE-unsaved2025116-3435406-1cqshei.eked/sketch_feb16b -iprefix /home/earle/.arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.3-489d7a2b-v1/esp32c6/include/ @/home/earle/.arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.3-489d7a2b-v1/esp32c6/flags/includes -I/home/earle/.arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.3-489d7a2b-v1/esp32c6/qio_qspi/include -I/home/earle/.arduino15/packages/esp32/hardware/esp32/3.1.2/cores/esp32 -I/home/earle/.arduino15/packages/esp32/hardware/esp32/3.1.2/variants/esp32c6 @/tmp/arduino/sketches/A089F771BEEC5FF8CFA7EE808BB83FDC/build_opt.h @/tmp/arduino/sketches/A089F771BEEC5FF8CFA7EE808BB83FDC/file_opts /tmp/arduino/sketches/A089F771BEEC5FF8CFA7EE808BB83FDC/sketch/sketch_feb16b.ino.cpp -o /tmp/arduino/sketches/A089F771BEEC5FF8CFA7EE808BB83FDC/sketch/sketch_feb16b.ino.cpp.o
In file included from /tmp/.arduinoIDE-unsaved2025116-3435406-1cqshei.eked/sketch_feb16b/sketch_feb16b.ino:1:
/tmp/.arduinoIDE-unsaved2025116-3435406-1cqshei.eked/sketch_feb16b/sketch_feb16b.ino: In function 'void setup()':
/home/earle/.arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.3-489d7a2b-v1/esp32c6/include/esp_driver_i2s/include/driver/i2s_std.h:220:1: error: designator order for field 'i2s_std_clk_config_t::ext_clk_freq_hz' does not match declaration order in 'i2s_std_clk_config_t'
  220 | }
      | ^
/tmp/.arduinoIDE-unsaved2025116-3435406-1cqshei.eked/sketch_feb16b/sketch_feb16b.ino:4:32: note: in expansion of macro 'I2S_STD_CLK_DEFAULT_CONFIG'
    4 | i2s_std_clk_config_t clk_cfg = I2S_STD_CLK_DEFAULT_CONFIG((uint32_t)freq);
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/.arduinoIDE-unsaved2025116-3435406-1cqshei.eked/sketch_feb16b/sketch_feb16b.ino:4:22: warning: unused variable 'clk_cfg' [-Wunused-variable]
    4 | i2s_std_clk_config_t clk_cfg = I2S_STD_CLK_DEFAULT_CONFIG((uint32_t)freq);
      |                      ^~~~~~~

exit status 1
`

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@earlephilhower earlephilhower added the Status: Awaiting triage Issue is waiting for triage label Feb 16, 2025
@Jason2866
Copy link
Collaborator

For Arduino it should be fixed with this https://github.com/espressif/arduino-esp32/pull/10963/files
Since this change i don't see an compile fail when building the Arduino libs with the Arduino Lib Builder.

@earlephilhower
Copy link
Contributor Author

Thanks, that's a workaround that should work for anyone using the I2S class.

Unfortunately I need to use DMA IRQ callbacks for BackgroundAudio so am using the bare IDF calls which are distributed in the Arduino code. ESP8266Audio also uses the raw IDF calls (I think when it was originally written there might not have been a stable ESP32 I2S class).

The upstream IDF should get the order correct in the first place, IMHO. I will, however, steal your workaround in the meantime! 👍

earlephilhower added a commit to earlephilhower/BackgroundAudio that referenced this issue Feb 17, 2025
Arduino-ESP32 3.1.2 includes an IDF which has an error in the I2S default
clock initialization macro.  Replace the macro with the workaround identified
by @Jason2866 in espressif/arduino-esp32#10975
earlephilhower added a commit to earlephilhower/BackgroundAudio that referenced this issue Feb 17, 2025
Arduino-ESP32 3.1.2 includes an IDF which has an error in the I2S default
clock initialization macro.  Replace the macro with the workaround identified
by @Jason2866 in espressif/arduino-esp32#10975
earlephilhower added a commit to earlephilhower/BackgroundAudio that referenced this issue Feb 17, 2025
Arduino-ESP32 3.1.2 includes an IDF which has an error in the I2S default
clock initialization macro.  Replace the macro with the workaround identified
by @Jason2866 in espressif/arduino-esp32#10975
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Awaiting triage Issue is waiting for triage
Projects
None yet
Development

No branches or pull requests

2 participants