I work on a project to capture stereo audio from a ICS52000 MEMS mic array with the ESP32 Dev-Kit-C via I2S.
I modified the pipeline_wav_sdcard_example from the adf-lib for capturing the I2S stream and store it on SD-card.
The ICS52000 requires a TDM format close to the PCM standard (with inverted bit clock) specified by the esp32 technical reference manual (under I2S).
So I set the I2S stream communication format to I2S_COMM_FORMAT_PCM_LONG, but the output looks exactly like I2S_COMM_FORMAT_I2S (see below).
So how can I properly configure the PCM_LONG format of the I2S stream?
esp-idf-version: ESP-IDF v4.1-rc (4.1 for adf compatibility)
I2S stream config:
Code: Select all
#define I2S_STREAM_CFG_ICS52000_STEREO() { \
.type = AUDIO_STREAM_WRITER, \
.i2s_config = { \
.mode = I2S_MODE_MASTER | I2S_MODE_RX, \
.sample_rate = 44100, \
.bits_per_sample = I2S_BITS_PER_SAMPLE_32BIT, \
.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT, \
.communication_format = I2S_COMM_FORMAT_PCM_LONG, \
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL2 | ESP_INTR_FLAG_IRAM, \
.dma_buf_count = 3, \
.dma_buf_len = 300, \
.use_apll = true, \
.tx_desc_auto_clear = true, \
.fixed_mclk = 0 \
}, \
.i2s_port = I2S_NUM_0, \
.use_alc = false, \
.volume = 1, \
.out_rb_size = I2S_STREAM_RINGBUFFER_SIZE, \
.task_stack = I2S_STREAM_TASK_STACK, \
.task_core = I2S_STREAM_TASK_CORE, \
.task_prio = I2S_STREAM_TASK_PRIO, \
.stack_in_ext = false, \
.multi_out_num = 0, \
.uninstall_drv = true, \
}
I2S_COMM_FORMAT_PCM_LONG:
I2S_COMM_FORMAT_I2S: yellow: SD
green: BCK
blue: WS
pink: WSO of mic 1 to mic 2
This leads to the effect, that every second sample of the second channel is
zero, since the second ICS52000 gets no WS signal evey second word frame.
I would appreaciate if someone could give me a hint how to properly set the PCM format or a pointer for further research on this topic.