Skip to main content
J Lee
Associate II
August 13, 2018
Question

Using PDM to PCM conversion library

  • August 13, 2018
  • 4 replies
  • 3194 views

I am using a STM32L1 MCU and I want to use the PDM to PCM conversion library, so I downloaded X-CUBE-MEMSMIC1, in the audio PDM lib folder I found libPDMFilter_CM3_Keil.lib.

In the release note I read this lib is for 16KHz PCM data sampling rate, So my questions are:

  1. Does "16KHz" mean 16KHz sampling rate from the already sampled PDM data? My final and overall audio sampling rate exceeds 16 KHz, I don't think here the 16 KHz equals to the final and overall sampling rate of audio data. For example, if I increase the PDM sampling rate, though the constant 16 KHz sampling rate when it comes to PDM to PCM conversion, the final and overall sampling rate will increase.
  2. Is there a guide on how to configure filtering paramters?

Thank you in advance

This topic has been closed for replies.

4 replies

ArturasV
Associate III
August 14, 2018

Hi J Lee, i am actually struggling with PDM->PCM library from ST fro the past few days. Can't get it to work. You can see my post here: https://community.st.com/s/question/0D50X00009cf4vsSAA/reading-pdm-data-from-mp34dt05a-with-stm32f407-i2s

I wrote document numbers in my post that has the information how to use that library. If you get it working corectly, please let my know.

Technical Moderator
August 14, 2018

Hello @Community member​ ,

Have a look to this user manual UM2372, it maybe helpful.

With Regards,

Imen.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
J Lee
J LeeAuthor
Associate II
August 15, 2018

@Imen DAHMEN​ 

Thank you very much for your help, actually I am using cube MX to configure the I2S interface and I am using STM32L152RE-NUCLEO board, it seems in the clk config section, there's no specifed i2S clk config module ( see the screeshot in attatchment), so in this case how can I configure the i2s clock? Can I consider APB1_Prepherial_CLK as the I2S clk since I2S use PB1x pins?

I tried to measure the PDM sampling rate by measuring elapsed time in keil in this case, I don't know if it's fesiable?

Thank you very much

Technical Moderator
October 29, 2018

Hello @Community member​ ,

Regarding the question about I2S clock, It's true that STM32L1 has not a dedicated audio PLL:

I2S peripheral receive the clock from AHB clock. The clock tree shown in the image is a good choice for this use case.

The clock is then generated by I2S and it depends on the I2S peripheral configuration: in general, to target 1 channel recording with a PDM sampling frequency equal to PDM_CLK (for example 1.28 MHz), a good choice for the I2S parameters is:

hAudioInI2s.Instance = SPI2

hAudioInI2s.Init.DataFormat = I2S_DATAFORMAT_16B;

hAudioInI2s.Init.AudioFreq = (PDM_CLK / 32);

hAudioInI2s.Init.CPOL = I2S_CPOL_HIGH;

hAudioInI2s.Init.MCLKOutput = I2S_MCLKOUTPUT_DISABLE;

hAudioInI2s.Init.Mode = I2S_MODE_MASTER_RX;

hAudioInI2s.Init.Standard = I2S_STANDARD_MSB;

Kind Regards,

Imen.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks