I’m using the ESP32S3-Korvo2-v3.1 board and have been testing the ADC and DAC functions with the ES8311 codec example code.
It supports two test modes: MP3 playback and echo mode.
I’ve modified several GPIO pins because the example code uses different GPIO assignments.
The board plays sound through the ES8311 and records sound with the ES7210.
I’ve configured them as shown below.
[Codebox]
Code: Untitled.c Select all
#define I2S_BCK_IO (GPIO_NUM_9)// (GPIO_NUM_4)
#define I2S_WS_IO (GPIO_NUM_45)//(GPIO_NUM_5)
#define I2S_DO_IO (GPIO_NUM_18)
#define I2S_DI_IO (GPIO_NUM_8) // (GPIO_NUM_19)
....
i2s_chan_config_t tx_chan_cfg = I2S_CHANNEL_DEFAULT_CONFIG(I2S_NUM_0, I2S_ROLE_MASTER);
i2s_std_config_t tx_std_cfg = {
.clk_cfg = I2S_STD_CLK_DEFAULT_CONFIG(16000),
.slot_cfg = I2S_STD_MSB_SLOT_DEFAULT_CONFIG(I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_STEREO),
.gpio_cfg = {
.mclk = I2S_MCK_IO,
.bclk = I2S_BCK_IO,
.ws = I2S_WS_IO,
.dout = GPIO_NUM_NC,
.din = I2S_DI_IO,
.invert_flags = {
.mclk_inv = false,
.bclk_inv = false,
.ws_inv = false,
},
},
};
i2s_chan_config_t rx_chan_cfg = I2S_CHANNEL_DEFAULT_CONFIG(I2S_NUM_0, I2S_ROLE_SLAVE);
ESP_ERROR_CHECK(i2s_new_channel(&tx_chan_cfg, &tx_handle, NULL));
ESP_ERROR_CHECK(i2s_channel_init_std_mode(tx_handle, &tx_std_cfg));
ESP_ERROR_CHECK(i2s_channel_enable(tx_handle));
i2s_std_config_t rx_std_cfg = {
.clk_cfg = I2S_STD_CLK_DEFAULT_CONFIG(16000),
.slot_cfg = I2S_STD_MSB_SLOT_DEFAULT_CONFIG(I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_STEREO),
.gpio_cfg = {
.mclk = I2S_MCK_IO,
.bclk = I2S_BCK_IO,
.ws = I2S_WS_IO,
.dout = GPIO_NUM_10,
.din = GPIO_NUM_NC,
.invert_flags = {
.mclk_inv = false,
.bclk_inv = false,
.ws_inv = false,
},
},
};
/* Initialize the channels */
ESP_ERROR_CHECK(i2s_new_channel(&rx_chan_cfg, NULL, &rx_handle));
ESP_ERROR_CHECK(i2s_channel_init_std_mode(rx_handle, &rx_std_cfg));
ESP_ERROR_CHECK(i2s_channel_enable(rx_handle));
[/Codebox]
I selected MP3 mode and played "canon.pcm," but I can’t hear any sound—only white noise comes from the speaker.
The code activates PA_CTRL for the speaker.
I also tested echo mode and logged the `mic_data` values, which are consistently all 0x00.
It appears the recording path isn’t functioning.
What do I miss?
The example code doesn't have how to initialize ES7211 even if it has es8311_codec_init().
Could you help me how to resolve thi issue?