Page 1 of 1

ESP32S3 (WROOM) I2S question

Posted: Wed Jan 10, 2024 5:55 pm
by PCRiscV
Hello,

I am new to the ESP32 family but not new to embedded software programming. I am trying to get the I2S bus to work with MEMS microphone.

I have configured the I2S as follow:
  1.    
  2. i2s_std_config_t std_cfg = {
  3.         .clk_cfg = I2S_STD_CLK_DEFAULT_CONFIG(48000),
  4.         .slot_cfg = I2S_STD_MSB_SLOT_DEFAULT_CONFIG(I2S_DATA_BIT_WIDTH_32BIT, I2S_SLOT_MODE_STEREO),
  5.         .gpio_cfg = {
  6.             .mclk = PIN_I2S_MCLK,
  7.             .bclk = PIN_I2S_BCLK,
  8.             .ws = PIN_I2S_WS,
  9.             .dout = I2S_GPIO_UNUSED,
  10.             .din = PIN_I2S_DIN,
  11.             .invert_flags = {
  12.                 .mclk_inv = false,
  13.                 .bclk_inv = false,
  14.                 .ws_inv = false,
  15.             },
  16.         },
  17.     };
During boot, I see the following messages:
I (300) mems: Starting the I2S bus
D (301) i2s_common: rx channel is registered on I2S0 successfully
D (301) i2s_common: MCLK is pinned to GPIO0 on I2S4
D (302) i2s_common: DMA malloc info: dma_desc_num = 6, dma_desc_buf_size = dma_frame_num * slot_num * data_bit_width = 1920
D (303) i2s_std: Clock division info: [sclk] 160000000 Hz [mdiv] 13 [mclk] 12288000 Hz [bdiv] 4 [bclk] 3072000 Hz
D (305) i2s_std: The rx channel on I2S0 has been initialized to STD mode successfully
D (306) i2s_common: i2s rx channel enabled
But when I look at the signal with the logic analyzer, I am seeing some bizarre things (see attachment #2). The WS signal is not good when low but is right when high.

Even the BCLK signal is not quite right. When the WS signal transition to high, the BCLK signal has a glitch (attachment #1)

Where should I look next?
Thanks.

Re: ESP32S3 (WROOM) I2S question

Posted: Thu Jan 11, 2024 2:04 am
by ESP_Sprite
That honestly looks like measurement errors. Is your LA ground connected properly and is the threshold set appropriately? Long unshielded wires running in parallel can also lead to results like this.

Re: ESP32S3 (WROOM) I2S question

Posted: Thu Jan 11, 2024 10:36 pm
by PCRiscV
You are right! My mistake. I fixed my wiring and everything looks good on the logic analyzer.
Sorry about that.

Re: ESP32S3 (WROOM) I2S question

Posted: Fri Jan 12, 2024 3:00 am
by ESP_Sprite
No worries, things like that are kinda hard to recognize when they happen on a LA. Glad to hear you're getting more sane measurements now!