alanbarr / STM32F4_Streaming_Mic

STM32F407 Internet Streaming Microphone
https://www.theunterminatedstring.com/tag/project_stm32_streaming_mic/
43 stars 19 forks source link

PDM to PCM to DAC #2

Closed hananabilabd closed 5 years ago

hananabilabd commented 5 years ago

I am using STM32F446RC MCU and I am trying to wire the MEMS microphone directly through the I2S , but I don't know how to redirect this acquired PCM to DAC , I get nothing except noise Any help

alanbarr commented 5 years ago

Sorry, I haven't tried using the DAC. All I can suggest is you first try and output a clean sine wave from RAM to the DAC then take it from there. It'd be best trying this with the same clock configurations required for the MEMS microphone in case there is a conflict.

hananabilabd commented 5 years ago

I output the audio coming from MEMS mic now to the DAC and the sound is good to hear ,, and the gain is perfect ,, but there is a lot of noise , I am asking where can I found the parameters to the PDMtoPCM library cause , I read all the datasheet related and the documentation is really poor ,, I tried to apply the values from equations in the MEMS examples they are providing ,, but even worse ,, I am using STM32F446RC , with 16 MHZ external , 180 MHz as sysclk ,, 120MHz to the I2S clk the I2S clk pin output nearly 3.05 MHZ I tried decimation factor 64 & 32 ( supposed that 64 gives 48 khz sampling frequency and 32 gives 96 sampling frequency )

hananabilabd commented 5 years ago

@alanbarr

alanbarr commented 5 years ago

By PDMtoPCM library are you referring to: libPDMFilter (see AN3998) ? If so there's going to be a trade off of quality for performance there.

I recall that it produced a pretty noisy signal, but unfortunately I don't think I still have the configuration used when testing it.

For more information on using libPDMFilter, your best bet might be ST forums.

hananabilabd commented 5 years ago

@alanbarr Thanks but really with the discovery board MIC and the sound was pretty noisy ?

alanbarr commented 5 years ago

I recall libPDM (IIR) not being as clean as a FIR filter, but can't remember anything more than that. However, skimming the application note I'm not sure you're using libPDM?

I tried decimation factor 64 & 32 ( supposed that 64 gives 48 khz sampling frequency and 32 gives 96 sampling frequency )

Where are you getting 32 from? AN3998 states it supports a decimation factor of 64 or 80:

There are four different implementations of this function depending on the decimation factor (64 or 80) and on the LSB or MSB representation of the input buffer.

hananabilabd commented 5 years ago

@alanbarr I am using PDM2PCM library image image and I am using AN5027

I recall libPDM (IIR) not being as clean as a FIR filter, but can't remember anything more than that. However, skimming the application note I'm not sure you're using libPDM?

I can't find the libPDM (IIR) you are talking about I think AN3998 is an outdated application note released in 2011 m but even the api stated in it , is now changed