cancel
Showing results for 
Search instead for 
Did you mean: 

stereo recording with 2 MEMS mics... Capturing both channels

mad88
Associate II
Posted on January 19, 2016 at 09:16

Hello everyone,

I have a STM32F4-Discovery board with an integrated MP45DT02 MEMS mic, and I've bought also anothere mic (an MP34DT01), I would like to record at the same time from the 2 mics.

By now I've captured audio from the integrated mic, and simulated the other mic with a RAM-stored pdm bitstream... Now I want to capture audio from the 2 mics at the same time... To do so I've to capture a bit both on the rising, both on the falling edge of the clock fed to the mics, but I don't know how to do... Up to now I've captured bits from the integrated mic just on one edge using the I2S...

This is my I2S configuration:

static void WaveRecorder_SPI_Init(uint32_t Freq)

{

  I2S_InitTypeDef I2S_InitStructure;

  /* Enable the SPI clock */

  RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2,ENABLE);

  /* SPI configuration */

  SPI_I2S_DeInit(SPI2);

  I2S_InitStructure.I2S_AudioFreq = 32000;

  I2S_InitStructure.I2S_Standard = I2S_Standard_LSB;

  I2S_InitStructure.I2S_DataFormat = I2S_DataFormat_16b;

  I2S_InitStructure.I2S_CPOL = I2S_CPOL_High;

  I2S_InitStructure.I2S_Mode = I2S_Mode_MasterRx;

  I2S_InitStructure.I2S_MCLKOutput = I2S_MCLKOutput_Disable;

  /* Initialize the I2S peripheral with the structure above */

  I2S_Init(SPI2, &I2S_InitStructure);

  RCC_I2SCLKConfig(RCC_I2S2CLKSource_PLLI2S);

  RCC_PLLI2SCmd(ENABLE);//con questo da solo va con rumore

  while (RCC_GetFlagStatus(RCC_FLAG_PLLI2SRDY) == RESET);

  /* Enable the Rx buffer not empty interrupt */

  SPI_I2S_ITConfig(SPI2, SPI_I2S_IT_RXNE, ENABLE);

}

Any suggestions?

Thank you very much!

#stm32f4-mems-stereo-rec-pdm-i2s
2 REPLIES 2
mad88
Associate II
Posted on January 23, 2016 at 10:14

...In this page

http://stackoverflow.com/questions/32942756/stm32f4-stereo-mems-mic

, a user suggest to choose an I2S clock speed that is double the speed of the mics' clock... That make sense...

But wich clock source should I use to feed the mics?

Then I think the fast and the slow clock must be synchronized (for example the first rising edge must arrive at the same time) ...How to achieve that result???

''Is there anybody out there''?
Posted on May 05, 2017 at 17:31

Hello,

In stereo configuration, the I2S peripheral must operate at twice the microphone frequency to be able 

to read the data on both the rising and falling edges of the microphone clock, thus reading the bits of two microphones. In your case, reading data from the integrated digital mems  microphone on one edge, and from the simulated microphone in the other edge. The integrated microphone shouldn't be clocked from the I2S peripheral anymore. The I2S epripheral will provide the clock to an embedded timer (with an external trigger in slave mode) to divide it. The timer output will provide the clock signal to the digital microphone.

For more details on the timer and the I2S configuration in stereo mode, you can check the Audio playback and record application on the STM32496I-Discovery in the

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubef4.html

 package.