PDM Mic data to Speaker not Working

Hi,

I am working on a project involving a PDM microphone and an I2S speaker.

Hardware:

  • PDM microphone: MP34DT01-M

  • MCU: nRF54L15

  • Speaker amplifier: I2S input

  • PDM microphone is connected to the nRF54L15 PDM interface.

  • Speaker amplifier is connected to the nRF54L15 I2S TX interface.

I am able to successfully read audio data from the PDM microphone using the Zephyr dmic_read() API. The data returned by dmic_read() is in PCM format.

However, I am facing an issue when trying to play this PCM data through the I2S speaker.

What I have tested

  1. I configured the PDM microphone and can successfully capture data using dmic_read().

  2. I wrote the PCM data returned by dmic_read() to an external flash file.

  3. I played the recorded RAW PCM file separately, but I hear only noise.

  4. I also tried sending the PCM data directly from the PDM microphone to the I2S TX interface.

  5. In both cases, the speaker produces only noise instead of the expected microphone audio.

The I2S interface is configured with the required:

  • BCLK / SCK

  • LRCLK / FCLK

  • SDOUT / DATA

What I need help with

Could you please review my source code and help identify the problem?

In particular, I would like to verify:

  • Whether the PCM data produced by dmic_read() is actually valid audio.

  • Whether the PDM microphone configuration is correct.

  • Whether the PCM sample format, sample rate, bit depth, and channel configuration are correct.

  • Whether the I2S TX configuration matches the PCM data format.

  • Whether there is an issue with signed/unsigned PCM data, sample width, channel format, or byte ordering.

  • Whether the I2S clock configuration is correct for the speaker amplifier.

  • Whether the DMA/buffer configuration could be causing corrupted audio.

  • Why the RAW PCM file contains noise even when played separately.

  • Why the direct PDM-microphone-to-I2S path also produces only noise.

I have provided my PDM microphone driver, I2S speaker driver, device-tree overlay, prj.conf, and the captured RAW PCM file in attachment .8475.Mic_POC.zip

Please analyze the complete code and identify the exact issue, if possible, and provide the required code/configuration changes to get clean microphone audio through the speaker.

Parents
  • What I²S codec is your output? Most of them require configuration on a secondary interface like TWI before they bother turning any output on.

  • There was a typo in my previous response.

    We are using an I²S-based audio amplifier, PN: MAX98357, not an audio codec.

    The MAX98357 does not require any I²C/TWI configuration to enable the amplifier output. It receives the audio data directly through the I²S interface.

    So there is no secondary control interface or codec initialization involved.

    Also, for your information, we are using P1.03 as the amplifier LRCLK/WS signal.

    On the nRF54L15 DK, we configured this routing by:

    • Mounting R33
    • Mounting R34
    • Leaving R21 and R22 DNP (Do Not Populate)

    So, could you please review the issue we are facing and guide us on how to resolve it?

Reply
  • There was a typo in my previous response.

    We are using an I²S-based audio amplifier, PN: MAX98357, not an audio codec.

    The MAX98357 does not require any I²C/TWI configuration to enable the amplifier output. It receives the audio data directly through the I²S interface.

    So there is no secondary control interface or codec initialization involved.

    Also, for your information, we are using P1.03 as the amplifier LRCLK/WS signal.

    On the nRF54L15 DK, we configured this routing by:

    • Mounting R33
    • Mounting R34
    • Leaving R21 and R22 DNP (Do Not Populate)

    So, could you please review the issue we are facing and guide us on how to resolve it?

Children
No Data
Related