PDM Data to I2S on nrf5340

Hello,

I'm using an Adafruit PDM microphone on nrf5340 audio dk.

The code of the PDM Microphone part has been completed, and I can successfully receive the PDM Microphone data.

Next, I want to convert the data received from PDM Microphone into I2S audio data, but I can't find a sample for reference.

Is it feasible to convert PDM data to I2S audio data on nrf5340? Is there any relevant sample for reference?

Parents
  • Hi 

    You mean you want to forward your PDM microphone data directly to the I2S interface, without any additional processing?

    I don't think we have any samples showing how to do this unfortunately. 

    If you configure the I2S peripheral in 16-bit mono mode you should be able to forward the PDM data directly, without having to add any data conversion first. 

    Best regards
    Torbjørn

  • Thanks for your reply.

    To be precise, I want to convert PDM data to PCM format.

    I want to send PDM microphone data to I2S interface, so I think the PDM data received from the microphone must be converted into PCM data first.

    Is there any sample of converting PDM data to PCM format for reference?

    If you configure the I2S peripheral in 16-bit mono mode you should be able to forward the PDM data directly, without having to add any data conversion first. 

    I don't quite understand the meaning here, as long as I2S is set to 16-bit mono, can I directly transmit PDM data as I2S audio?

  • Hi 

    The PDM module automatically converts the PDM data to PCM for you, you don't have to do this yourself. 

    Please read through the module operation chapter from the product specification for more information about this. If you search for "PCM" you will find a couple of references to this in the documentation. 

    LandyWang said:
    I don't quite understand the meaning here, as long as I2S is set to 16-bit mono, can I directly transmit PDM data as I2S audio?

    This hasn't been explicitly tested so I can't guarantee it, but in theory the PDM data should be compatible with the I2S module as long as you make sure to configure the I2S interface to use 16-bit mono data. The PDM module provides 16-bit mono PCM samples, so if you can configure the I2S interface to use 16-bit mono PCM data you should be able to forward the data directly without any conversion. 

    Best regards
    Torbjørn

  • I am doing the same with the nrf5340 audio DK board, It has an onboard PDM mic which I am using to capture the audio, want to transfer the audio data to head out through the I2S interface.
    However, I am facing an issue regarding storing the PCM data and transferring it through I2s. I am new and don't know how to configure I2s, it will be very helpful if you please guide me. 

  • As mentioned in the answer, just set I2S to 16-bit mono,the PDM data can be compatible with the I2S module.
    Add it to prj.conf:
    CONFIG_AUDIO_SAMPLE_RATE_16000_HZ=y
    Then change the I2S channels to NRF_I2S_CHANNELS_LEFT.
    After I made these modifications, the stored pdm mic data can be processed in i2s audio format.

Reply Children
No Data
Related