Skip to content

PDM Microphone samples are not recognized at the input, Amplitude sits at 0 #4583

@markusdd

Description

@markusdd

What happened?

I have (new) boards sitting here with a TDK T3902 PDM MEMS Microphone and I am trying to get this to work.
ESP is an ESP32S3-N16R8.
I have tried WLED 0.15 as well my own build from latest/greatest master branch.

Issue I am observing: In PDM mode I am using GPIO4 as Clock out and GPIO5 as data in.
With an oscilloscope I can see the clock leaving the ESP and the data returning (yellow clock, blue data):

Image

This gives me pretty high confidence that the hardware is fine.
Also, to exclude channel left/right woes, I reworked one board to have a left channel output and the other right channel output. The datasheet of the mic is here: https://www.lcsc.com/datasheet/lcsc_datasheet_2411220511_TDK-InvenSense-MMICT390200012_C3171752.pdf
To me, this looks like a very 'run of the mill' PDM mic with hardly any specialties, the protocol is super simple. Rising edge right channel, falling edge left channel, that's it.

My pin config is as follows:

Image

I also tried using WS as clk, same picture. I get proper output/input on the scope, but my console does this: (I have compiled with -D MIC_LOGGER -D SR_DEBUG):

Image

Absolutely dead. I also tried forcing the data pin high from 3.3V, as this should result in a pegged high maximum volume. Also nothing.

When I configure it as a normal I2S Microphone, I do see this:

Image

Level and Real sit around 30k constantly and volume is fluctuating. But there is zero 'real' reaction to music or clapping, which is logical, because this isn't a PCM signal but a PDM signal on the input, so essentially these numbers are random garbage, they will never be interpreted correctly in non-PDM mode.

I've tried everything I could think of, but I do not understand why there is zero reading of PDM data although it is there.

I tried skimming the C-Code of the audioreactive mod and there are numerous comments in the code regading PDM that I cannot make sense of, like this:

Image

I do not assume we have an actual clock issue because it comes out.
I rather suspect these 2 (I have not touched any of the code, everything like it is on master except the debug defines):

Image

So for some reason the data is not being sampled. I am at a loss for why.

Any guidance?

To Reproduce Bug

See above, but I guess you'd need such a mic or at least a PDM mic combined with an ESP32S3

Expected Behavior

PDM data is being sampled and audioreactive works.

Install Method

Self-Compiled

What version of WLED?

0.15 and 0.16alpha@master

Which microcontroller/board are you seeing the problem on?

ESP32-S3

Relevant log/trace output

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugstaleThis issue will be closed soon because of prolonged inactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions