Closed AutomationD closed 4 years ago
It might just be a typo in the code listing but the bck and ws signals show that they are attached to the same pin 0. Can you check that?
Hey, Mike, I've set it to 0, as there is simply no doc on which pin is this specific mic is attached, seems like there are only two pins documented (SCL/SDA), and two other pins are gnd and vcc: Datasheet
I just took a look at the SPM1423 microphone datasheet. It has a PDM interface and unfortunately will not work with the I2S micropython module which only supports microphones having the audio I2S interface of bck, ws, sdin.
This limitation is in the I2S micropython module implementation and not in the ESP32. The ESP32 I2S hardware peripheral supports PDM hardware . Take a look at section 12.4.7 I2S PDM in https://www.espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf.
The good news is that it is possible to modify the C code in machine_i2s.c to work with this microphone. The M5stack C code can be used as an example on how to do this.
Also, here is some information from Adafruit that discusses the different types of digital microphones: https://cdn-learn.adafruit.com/downloads/pdf/adafruit-pdm-microphone-breakout.pdf
Sigh I will have to look into that, then. My C is pretty basic, but I guess that would be a great chance to learn how to implement Arduino-based solutions as micropython modules :)
Btw, I tried adding I2S_PIN_NO_CHANGE into the pin config in machine_i2s.c, but it didn't seem enough
Thanks for checking, Mike!
UPD: Seems like this has been already implemented here or am I mistaken?
That's a good find, but I don't know if it will help to get the PDM feature supported on the ESP32. The CircuitPython PDM implementation is designed to run on the STM devices that are supported by CircuitPython. Unfortunately, Adafruit doesn't support any Espressif devices in CircuitPython.
My suggestion is to implement a new machine PDM class in MicroPython, using machine I2S and the M5stack C code as examples. Other PDM examples using the ESP-IDF might be found in the ESP32 forum or maybe an Arduino forum. To keep consistency with other machine classes, the C file name would likely be called machine_pdm.c.
Here is how I would approach this:
It might be worthwhile to post on the MicroPython ESP32 forum to see if anyone has started to work on this feature.
This issue is not related to the I2S interface, so closing
@AutomationD : did you wind up finding or developing something that connects to the M5StickC's microphone? I am hoping to do some work with it soon, as well, and am still struggling to find anywhere that it's used in python.
@valkyriesavage I broke my M5StickC :-D But yeah, it would be nice...
First of all, great kudos for such work, Mike!
I'm trying to make my m5stick-c, which is based on ESP32-PICO, and I'm getting no signal
I've merged your changes to the main branch of micropython and built it. Module inclusion, class instantiation works fine, but the wav file has only a header, and the signal is all zeroes.
I would appreciate if you or anyone could give me a hint where to look and troubleshoot. Thanks again!
Here's the latest iteration of the snippet (not that m5stick-c documentation doesn't provide any info on bck, and examples refer to
I2S_PIN_NO_CHANGE
M5Stick-C specific Arduino Example One M5Stick-C specific Arduino Example Two