espressif / arduino-esp32

Arduino core for the ESP32

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

i2s mems reads 34601

lucyknada opened this issue · comments

commented

Board

esp32-s3 [sense] (seed, xiao)

Device Description

device itself: https://www.seeedstudio.com/XIAO-ESP32S3-Sense-p-5639.html

device schematic: https://files.seeedstudio.com/wiki/SeeedStudio-XIAO-ESP32S3/res/XIAO_ESP32S3_SCH_v1.1.pdf

expansion board (with mems mic) schematic: https://files.seeedstudio.com/wiki/SeeedStudio-XIAO-ESP32S3/res/XIAO_ESP32S3_ExpBoard_v1.0_SCH.pdf

Hardware Configuration

expansion board mems microphone via: pin 42 ws, pin 41 pdm-clock, pin 7 sck

Version

latest master (checkout manually)

IDE Name

arduino ide and platformio

Operating System

macOS

Description

I tried to port the v2 example here: https://wiki.seeedstudio.com/xiao_esp32s3_sense_mic/#detection-of-sound-loudness to v3, it does not matter if I set BCLK to -1 or 7 (SCK) as it always reports 34601 on i2s.read()

Sketch

#include <ESP_I2S.h>
I2SClass I2S;

void setup() {
  Serial.begin(19200);
  
  // int setAllPins(int sckPin, int fsPin, int sdPin, int outSdPin, int inSdPin)
  // I2S.setAllPins(-1, 42, 41, -1, -1);

  // void setPins(int8_t bclk, int8_t ws, int8_t dout, int8_t din=-1, int8_t mclk=-1)
  I2S.setPins(7, 42, -1, 41, -1); //SCK, WS, SDOUT, SDIN, MCLK
  I2S.begin(I2S_MODE_PDM_RX, 16000, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_MONO);
}

void loop() {
  delay(1000);
  int sample = I2S.read();
  if (sample && sample != -1 && sample != 1) {
    Serial.println(sample);
  }
}

Debug Message

34601
34601
34601
34601

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
commented

Found other docs that had setPinsPdmRx but that still just reports 34601

#include <ESP_I2S.h>
I2SClass I2S;

void setup() {
  Serial.begin(19200);
  I2S.setPinsPdmRx(42, 41);
  I2S.begin(I2S_MODE_PDM_RX, 16000, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_MONO);
}

void loop() {
  delay(1000);
  int sample = I2S.read();
  if (sample && sample != -1 && sample != 1) {
    Serial.println(sample);
  }
}
commented

Full flash wipe seems to have fixed it and made the second example posted above work.