I2S Pin Setup Causing Network/DNS Issues on ESP32-S3
Posted: Thu Feb 20, 2025 9:46 am
Hi all,
I’m working on an audio streaming project using an ESP32-S3 and have encountered an odd issue. When I configure the I2S pins using the ESP-IDF API, subsequent network operations (like DNS resolution) fail.
Issue Description:
• After calling i2s_set_pin(), DNS lookups such as WiFi.hostByName("google.com", ip) return errors (e.g., DNS Failed, IP Address: 0.0.0.0).
• If I perform DNS queries before calling i2s_set_pin(), everything works as expected.
Relevant Code Snippet:
Full I2S Setup Function:
PlatformIO Configuration (platformio.ini):
Summary:
The problem appears to be that once i2s_set_pin() is called, the network stack stops resolving DNS queries properly, or having network issues alltogether. I’m curious if anyone has encountered a similar conflict or has insights into why configuring the I2S pins might affect network functionality on the ESP32-S3.
Any help or suggestions would be greatly appreciated. Thanks in advance!
P.S : I have tried the same code on ESP32 (non S3) and it seems to work fine
I’m working on an audio streaming project using an ESP32-S3 and have encountered an odd issue. When I configure the I2S pins using the ESP-IDF API, subsequent network operations (like DNS resolution) fail.
Issue Description:
• After calling i2s_set_pin(), DNS lookups such as WiFi.hostByName("google.com", ip) return errors (e.g., DNS Failed, IP Address: 0.0.0.0).
• If I perform DNS queries before calling i2s_set_pin(), everything works as expected.
Relevant Code Snippet:
Code: Select all
// Installing I2S driver and setting pins
esp_err_t err = i2s_driver_install(I2S_PORT, &i2s_config, 0, NULL);
if (err != ESP_OK) {
Serial.printf("Failed installing driver: %d\n", err);
while (true);
}
err = i2s_set_pin(I2S_PORT, &pin_config);
if (err != ESP_OK) {
Serial.printf("Failed setting pin: %d\n", err);
while (true);
}Code: Select all
void setup_i2s() {
i2s_config_t i2s_config = {
.mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_RX | I2S_MODE_TX),
.sample_rate = SAMPLE_RATE,
.bits_per_sample = I2S_BITS_PER_SAMPLE_16BIT,
.channel_format = I2S_CHANNEL_FMT_ONLY_LEFT,
.communication_format = I2S_COMM_FORMAT_STAND_I2S,
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
.dma_buf_count = 4,
.dma_buf_len = BUFFER_SIZE,
.use_apll = false,
.tx_desc_auto_clear = true,
.fixed_mclk = 0
};
i2s_pin_config_t pin_config = {
.bck_io_num = I2S_BCK,
.ws_io_num = I2S_LRC,
.data_out_num = I2S_DOUT,
.data_in_num = MIC_I2S_DIN
};
// Install the I2S driver.
esp_err_t err = i2s_driver_install(I2S_PORT, &i2s_config, 0, NULL);
if (err != ESP_OK) {
Serial.printf("Failed installing driver: %d\n", err);
while (true);
}
// Set the I2S pins.
err = i2s_set_pin(I2S_PORT, &pin_config);
if (err != ESP_OK) {
Serial.printf("Failed setting pin: %d\n", err);
while (true);
}
Serial.println("I2S driver installed.");
}Code: Select all
[env:esp32S3dev]
platform = platformio/espressif32@^6.1.0
board = esp32-s3-devkitm-1
board_build.extra_flags =
-DI2S_BCK=39
-DI2S_LRC=38
-DMIC_I2S_DIN=35
-DI2S_DOUT=36
-DDISPLAY_ON=true
-DI2C_SDA=47
-DI2C_SCL=48
-DTALK_PIN=18The problem appears to be that once i2s_set_pin() is called, the network stack stops resolving DNS queries properly, or having network issues alltogether. I’m curious if anyone has encountered a similar conflict or has insights into why configuring the I2S pins might affect network functionality on the ESP32-S3.
Any help or suggestions would be greatly appreciated. Thanks in advance!
P.S : I have tried the same code on ESP32 (non S3) and it seems to work fine