Skip to main content
Visitor II
May 13, 2022
Solved

Very noisy signal from IMP34DT05 recorded with STM32-F401RE

  • May 13, 2022
  • 4 replies
  • 3438 views

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.

    This topic has been closed for replies.
    Best answer by frnt

    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

    4 replies

    ST Employee
    May 13, 2022

    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 :

    • What is Microphone clock frequency ? Make sure frequency is between 1,2MHz and 3,25MHz.
    • How did you connect microphone to STM32F401 ? Are you using long wires ?
      • I would recommend to use X-NUCLEO-CCA02M2 expansion board which can host STEVAL-MIC003V1

    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.

    frntAuthor
    Visitor II
    May 13, 2022

    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:

    • 24bits data on 32bits frame
    • Selected frequency: 16 kHz

    Thanks again for your help.

    ST Employee
    May 13, 2022

    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 :

    0693W00000NpwA3QAJ.png 

    Regards,

    Sebastien.

    frntAuthorAnswer
    Visitor II
    May 17, 2022

    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

    ST Employee
    May 17, 2022

    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.

    frntAuthor
    Visitor II
    May 24, 2022

    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.

    Visitor II
    November 8, 2023

    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.