Page 1 of 1

Esp_codec_dev_open w/esp_codec_dev_sample_info_t fs change initial i2s setup?

Posted: Mon Mar 03, 2025 9:46 pm
by prothan
I am using Korvo 2 V3.1. My question is in with regards to the audio settings and how/where they are set. Please reference following example. My question is at bottom of thread.

https://github.com/espressif/esp-adf/bl ... st_board.c

Code: Untitled.c Select all

TEST_CASE("Playing while recording use TDM mode", "[esp_codec_dev]")

***Line 347***
ut_set_i2s_mode(I2S_COMM_MODE_STD, I2S_COMM_MODE_TDM);

***Line 127*** i2s input init with 4 tdm channels
i2s_tdm_slot_mask_t slot_mask = I2S_TDM_SLOT0 | I2S_TDM_SLOT1 | I2S_TDM_SLOT2 | I2S_TDM_SLOT3;
* i2s_tdm_config_t tdm_cfg = {
* .slot_cfg = I2S_TDM_PHILIPS_SLOT_DEFAULT_CONFIG(16, I2S_SLOT_MODE_STEREO, slot_mask),
* .clk_cfg = I2S_TDM_CLK_DEFAULT_CONFIG(16000),
.gpio_cfg = {
.mclk = TEST_BOARD_I2S_MCK_PIN,
.bclk = TEST_BOARD_I2S_BCK_PIN,
.ws = TEST_BOARD_I2S_DATA_WS_PIN,
.dout = TEST_BOARD_I2S_DATA_OUT_PIN,
.din = TEST_BOARD_I2S_DATA_IN_PIN,
},
};
tdm_cfg.slot_cfg.total_slot = 4;
...
Line187

***Line 412***
// Play 16bits 2 channel
esp_codec_dev_sample_info_t fs = {
.sample_rate = 48000,
.channel = 2,
.bits_per_sample = 16,
};
ret = esp_codec_dev_open(play_dev, &fs);
TEST_ESP_OK(ret);
// Record 16bits 4 channel select channel 0 and 3
fs.channel = 4;
fs.channel_mask = ESP_CODEC_DEV_MAKE_CHANNEL_MASK(0) | ESP_CODEC_DEV_MAKE_CHANNEL_MASK(3);
ret = esp_codec_dev_open(record_dev, &fs);
***Line 423***
Does code between 412-423 change the i2s audio setup at lines 127-187? Or does it only change the audio from codec to esp32s3?