I2S-PCM format can not be set

mplanton
Posts: 4
Joined: Thu Jul 30, 2020 2:26 pm

I2S-PCM format can not be set

Postby mplanton » Fri Aug 14, 2020 12:12 pm

Hello,

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,                                              \
}
Oscilloscope measurments:

I2S_COMM_FORMAT_PCM_LONG:
Image

I2S_COMM_FORMAT_I2S:
scope_8.png
I2S_COMM_FORMAT_I2S
scope_8.png (66.93 KiB) Viewed 5052 times
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.
REC2_screen.png
REC2_screen.png (82.74 KiB) Viewed 5052 times
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.
Attachments
scope_0.png
I2S_COMM_FORMAT_PCM_LONG
scope_0.png (64.89 KiB) Viewed 5052 times

stuartiannaylor
Posts: 17
Joined: Wed Dec 02, 2020 6:02 pm

Re: I2S-PCM format can not be set

Postby stuartiannaylor » Wed Dec 02, 2020 6:19 pm

Total noob so can not help you but have posted a similar where .bits_per_sample = I2S_BITS_PER_SAMPLE_32BIT always seems to return 16bit samples which also have me confused.

This is my first time with a esp32, C and the arduino IDE so doubt I will be tracing why but my post hopefully when accepted is asking something similar as if the enumerations are not set and just default values are used?

stuartiannaylor
Posts: 17
Joined: Wed Dec 02, 2020 6:02 pm

Re: I2S-PCM format can not be set

Postby stuartiannaylor » Wed Dec 09, 2020 1:29 am

Ignore me as it was converted to 16 bit elsewhere

Who is online

Users browsing this forum: No registered users and 10 guests