2022-05-13 06:51 AM
Hello,
I'm using the IMP34DT05 available with the STEVAL-MIC003V1 kit to record audio the nucleo-f401re. I'm using the PDM2PCM library to convert the PDM stream to PCM data. The audio is recorded at 8kHz.
I have tried reproducing 1kHz tone on the microphone. Unfortunately, after recording and listening to the .wav file on the computer it appears to be really noisy.
Do you know how can I solve this issue?
I have tried increasing the sampling frequency to 16kHz without success.
I upload the recorded .wav, by looking at the FFT the 1kHz peak is present. However, if you listen to the audio, playing it in audacity it is really bad. The signal-to-noise ratio seems to be really poor.
Any suggestion is welcome.
Thanks.
Solved! Go to Solution.
2022-05-16 11:00 PM
Dear @Sebastien DENOUAL ,
thanks for your reply. I have solved the issue by only changing the bit order in the PDM library from 1 to 0.
What does it mean this order in the pdm2pcm library? Processing starts from the LSB of every byte?
thanks
2022-05-13 08:05 AM
Hi @frnt ,
To be honest, difficult to analyze issue just by listening .wav file but for sure this is not expected behavior.
Anyway, few points that can be investigated :
About SW reference, in case you don't already use it. You may check X-CUBE-MEMSMIC1 sw package available on st.com. There is code example for microphone acquisition on NUCLEO-F01RE.
Regards,
Sebastien.
2022-05-13 08:20 AM
Dear @Sebastien DENOUAL ,
the clock frequency to the microphone is 1.024 MHz measured also with the oscilloscope.
The microphone is connected with 10cm dupont cable to the NUCLEO-F401RE to I2S pins. Do you think the cables are the issue? Data are sent out digitally in PDM...
The PDM2PCM library is configured as:
PDM1_filter_handler.bit_order = PDM_FILTER_BIT_ORDER_MSB;
PDM1_filter_handler.endianness = PDM_FILTER_ENDIANNESS_BE;
PDM1_filter_handler.high_pass_tap = 2104533974;
PDM1_filter_handler.in_ptr_channels = 1;
PDM1_filter_handler.out_ptr_channels = 1;
PDM_Filter_Init(&PDM1_filter_handler);
PDM1_filter_config.decimation_factor = PDM_FILTER_DEC_FACTOR_64;
PDM1_filter_config.output_samples_number = 16;
PDM1_filter_config.mic_gain = 12;
PDM_Filter_setConfig(&PDM1_filter_handler, &PDM1_filter_config);
The I2S:
Thanks again for your help.
2022-05-13 08:36 AM
Hi @frnt ,
10Cm length is OK for cable.
Now, this 1,024MHz is outside IMP34DT05 requirements and may explain behavior. As mentioned in previous post, this mic_clock must be higher than 1,2Mhz and below 3,25MHz
=> Here, you need to increase this clock frequency. It could explain behavior your notice.
See extract from DS :
Regards,
Sebastien.
2022-05-16 11:00 PM
Dear @Sebastien DENOUAL ,
thanks for your reply. I have solved the issue by only changing the bit order in the PDM library from 1 to 0.
What does it mean this order in the pdm2pcm library? Processing starts from the LSB of every byte?
thanks
2022-05-17 01:10 AM
Hi @frnt ,
Thanks for feedback.
Yes : you are right. This endianness settings is used to specify if byte inversion is needed.
More details in PDM2PCM library User Manual : UM2372.
Let me also highlight one more time that clock value you are using is out of IMP34DT05 specifications from datasheet. Behavior can not be guarantee ( it may probably works with most of samples but some will not be functional at this 1,024Mhz clock frequency.)
Regards,
Sebastien.
2022-05-24 09:33 AM
Dear @Sebastien DENOUAL ,
yes I’ll increase the clock frequency to stay above the minimum from the datasheet.
About the pdm clock frequency I have a question. In CubeMX I have I2S configured a 16kHz, 24 bit on 32 data frame. Decimation is 128. Considering that the internal DMA buffer is 16bit, it takes two cycle to store one PDM data (first 16bit and then the other 8). Theoretically the PDM frequency at the output of the stm32 should be 16kHz * 128, which is 2.048MHz.
However, due to the 32 bit frame, the account frequency that I measure with the oscilloscope is 1.024MHz.
Is that right?
Reducing the data frame to 16bit breaks everything and the audio recorded in completely garbage. Do you have suggestions on this? Should I open I new topic? I would like to reduce the pdm bits from 24 to 16 to halve the size of the buffers and speed up processing.
Thanks.
2023-11-08 06:37 AM
I don't understand why you are using 24 bits in 32 bit frame. The PDM format is not aware of the frame length. That way you are dropping 8 bits from each 32 bits received. That must affect the sound quality. You should use all bits in the frame.