ADAU7002 I2S ESP32-S3
Posted: Sun Jan 22, 2023 10:25 pm
I'm trying to get valid audio data using an ESP32-S3 and the IM69D130 Microphone Audio Shield2Go Platform Evaluation Expansion Board (https://www.infineon.com/dgdl/Infineon- ... 3486ed0941). This board has two IM69D130 microphones and runs those both through an ADAU7002 device (https://www.analog.com/media/en/technic ... AU7002.pdf). On this particular dev board, it's configured to be I2S mode (CONFIG pin tied to VDD), and according to the datasheet, it should be 20 bits of PCM audio:
It's not clear to me whether this means the output over I2S will be 20-bit stereo, but that's my assumption. The waveform of the ADAU7002 in I2S mode is shown below:
There is no "I2S_DATA_BIT_WIDTH_20BIT", so I'm not sure how to configure I2S to properly acquire data. I am able to receive a stream of data, so I2S is at least functional and pinouts seem good, but it's not yet what I'd consider valid audio (I cannot make out any noise being made). I've configured the ESP32-S3 as follows:
I've also tried setting .data_bit_width to 20, as well as .ws_width, and it certainly compiles and runs, but I'm still not able to get good data. Just a note, I have set .bit_shift to TRUE as I am relatively certain that needs to be done. Has anyone had any experience with utilizing the ADAU7002 with an ESP32? Any tips on how to configure the I2S channel?
Right now I'm taking this data, in 2048 byte chunks, and placing them in a .wav file, pushed to an SD Card. Data capture seems to work great, and I'm pretty sure I have the wave file setup correctly. Now it's a matter of understanding how to configure the data acquisition such that it's aligned with the part, as I'm not sure that's correct.
It's not clear to me whether this means the output over I2S will be 20-bit stereo, but that's my assumption. The waveform of the ADAU7002 in I2S mode is shown below:
There is no "I2S_DATA_BIT_WIDTH_20BIT", so I'm not sure how to configure I2S to properly acquire data. I am able to receive a stream of data, so I2S is at least functional and pinouts seem good, but it's not yet what I'd consider valid audio (I cannot make out any noise being made). I've configured the ESP32-S3 as follows:
Code: Select all
i2s_chan_config_t rx_chan_cfg = I2S_CHANNEL_DEFAULT_CONFIG(I2S_NUM_AUTO, I2S_ROLE_MASTER);
ESP_ERROR_CHECK(i2s_new_channel(&rx_chan_cfg, NULL, &rx_chan));
i2s_std_clk_config_t clk_cfg = {
.clk_src = I2S_CLK_SRC_DEFAULT,
.sample_rate_hz = 16000,
.mclk_multiple = I2S_MCLK_MULTIPLE_512};
i2s_std_slot_config_t slot_cfg = {
.data_bit_width = I2S_DATA_BIT_WIDTH_24BIT,
.slot_bit_width = I2S_SLOT_BIT_WIDTH_AUTO,
.slot_mode = I2S_SLOT_MODE_STEREO,
.slot_mask = I2S_STD_SLOT_BOTH,
.ws_width = I2S_DATA_BIT_WIDTH_24BIT,
.ws_pol = false,
.bit_shift = true,
.left_align = false,
.big_endian = false,
.bit_order_lsb = false};
i2s_std_config_t rx_std_cfg = {
.clk_cfg = clk_cfg,
.slot_cfg = slot_cfg,
.gpio_cfg = {
.mclk = I2S_GPIO_UNUSED, // some codecs may require mclk signal, this example doesn't need it
.bclk = I2S_BCLK,
.ws = I2S_WS,
.dout = I2S_GPIO_UNUSED,
.din = I2S_DIN,
.invert_flags = {
.mclk_inv = false,
.bclk_inv = false,
.ws_inv = false,
},
},
};
rx_std_cfg.slot_cfg.slot_mask = I2S_STD_SLOT_BOTH;
ESP_ERROR_CHECK(i2s_channel_init_std_mode(rx_chan, &rx_std_cfg));
Right now I'm taking this data, in 2048 byte chunks, and placing them in a .wav file, pushed to an SD Card. Data capture seems to work great, and I'm pretty sure I have the wave file setup correctly. Now it's a matter of understanding how to configure the data acquisition such that it's aligned with the part, as I'm not sure that's correct.