cancel
Showing results for 
Search instead for 
Did you mean: 

Some questions about using stm32f411 discovery with i2s audio and pdm2pcm library

J Lee
Associate III

Hi, I am using stm32f411 discovery board with i2s mems microphone, I am using hal library and pdm2pcm librray, I have referred to audio record and play back examples, application notes, and I still have the following questions:

  1. It seems that the user can't set pdm sampling rate, this rate is set by i2s hal api based on the pcm rate previously set by the user. I used timer to measure finding that this rate seems to be always 64, so decimation factor always to be 64?
  2. I set the pcm sampling rate to 48 KHz, mic_gain 24 dB, in the quiet environment, the pcm output's max value seems to be 50(as shown in the pic below), I think this is too much for my application, I think there maybe some thing wrong in my settings caused this problem.
  3. Below are all my setting, can you plz tell me where I was wrong?

 hi2s2.Init.Standard = I2S_STANDARD_LSB;

 hi2s2.Init.DataFormat = I2S_DATAFORMAT_16B;

 hi2s2.Init.AudioFreq = 2*(I2S_AUDIOFREQ_48K);

 PDM_FilterHandler.bit_order = PDM_FILTER_BIT_ORDER_LSB;

 PDM_FilterHandler.endianness = PDM_FILTER_ENDIANNESS_LE;

 PDM_FilterHandler.high_pass_tap =2122358088;

 PDM_FilterHandler.out_ptr_channels = 1;

 PDM_FilterHandler.in_ptr_channels = 1;

 PDM_FilterConfig.output_samples_number = 16;

 PDM_FilterConfig.mic_gain = 24;

 PDM_FilterConfig.decimation_factor = PDM_FILTER_DEC_FACTOR_64;

​ PDM_BUFF_SIZE  128

PCM_OUT_SIZE  16

0 REPLIES 0