Merge pull request #5396 from wled/bugfix_5391

avoid I2S resource conflict (aPLL) with ethernet - V4 builds only (fixes #5391)
This commit is contained in:
Frank Möhle
2026-02-27 17:30:23 +01:00
committed by GitHub
2 changed files with 7 additions and 4 deletions

View File

@@ -1206,7 +1206,7 @@ class AudioReactive : public Usermod {
break;
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3)
case 5:
DEBUGSR_PRINT(F("AR: I2S PDM Microphone - ")); DEBUGSR_PRINTLN(F(I2S_PDM_MIC_CHANNEL_TEXT));
DEBUGSR_PRINT(F("AR: Generic PDM Microphone - ")); DEBUGSR_PRINTLN(F(I2S_PDM_MIC_CHANNEL_TEXT));
audioSource = new I2SSource(SAMPLE_RATE, BLOCK_SIZE, 1.0f/4.0f);
useBandPassFilter = true; // this reduces the noise floor on SPM1423 from 5% Vpp (~380) down to 0.05% Vpp (~5)
delay(100);
@@ -1624,7 +1624,8 @@ class AudioReactive : public Usermod {
if (audioSource->getType() == AudioSource::Type_I2SAdc) {
infoArr.add(F("ADC analog"));
} else {
infoArr.add(F("I2S digital"));
if (dmType == 5) infoArr.add(F("PDM digital")); // dmType 5 => generic PDM microphone
else infoArr.add(F("I2S digital"));
}
// input level or "silence"
if (maxSample5sec > 1.0f) {
@@ -1911,7 +1912,7 @@ class AudioReactive : public Usermod {
uiScript.print(F("addOption(dd,'SPH0654',3);"));
uiScript.print(F("addOption(dd,'Generic I2S with Mclk',4);"));
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3)
uiScript.print(F("addOption(dd,'Generic I2S PDM',5);"));
uiScript.print(F("addOption(dd,'Generic PDM',5);"));
#endif
uiScript.print(F("addOption(dd,'ES8388',6);"));

View File

@@ -225,15 +225,17 @@ class I2SSource : public AudioSource {
_config.mode = i2s_mode_t(I2S_MODE_MASTER | I2S_MODE_RX | I2S_MODE_PDM); // Change mode to pdm if clock pin not provided. PDM is not supported on ESP32-S2. PDM RX not supported on ESP32-C3
_config.channel_format =I2S_PDM_MIC_CHANNEL; // seems that PDM mono mode always uses left channel.
_config.use_apll = true; // experimental - use aPLL clock source to improve sampling quality
_config.use_apll = false; // don't use aPLL clock source (fix for #5391)
#endif
}
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 2, 0)
if (mclkPin != I2S_PIN_NO_CHANGE) {
#if !defined(WLED_USE_ETHERNET) // fix for #5391 aPLL resource conflict - aPLL is needed for ethernet boards with internal RMII clock
_config.use_apll = true; // experimental - use aPLL clock source to improve sampling quality, and to avoid glitches.
// //_config.fixed_mclk = 512 * _sampleRate;
// //_config.fixed_mclk = 256 * _sampleRate;
#endif
}
#if !defined(SOC_I2S_SUPPORTS_APLL)