Some questions about using stm32f411 discovery with i2s audio and pdm2pcm library
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:
- 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?
- 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.
- 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