cancel
Showing results for 
Search instead for 
Did you mean: 

I2S Interfacing with MP45DT02 PDM Mic on STM32F4 Discovery

abarr16
Associate
Posted on September 30, 2014 at 21:29

Hello,

I've been racking my head trying to make sense of how to correctly configure the I2S Hardware to interface with the MP45DT02 microphone. I've been looking at ST's waverecorder.c for inspiration but I think some iffy comments are really throwing me off. I was hoping someone here would be able to help me make sense of the configuration. I'm also going to be doing this with ChibiOS, so basically I'm only interested in direct configuration of register bits.

So, say I desire to ultimately get 16 bit 16 kHz PCM audio. This means, with 64 decimation, I need to sample the PDM microphone at 64 * 16 kHz = 1.024 MHz.

The I2S needs to be configured to do this and I understand how  (in ST's example):

HSE_Frequency = 8 MHz

PLL_M = 8

PLLI2S_N = 258

PLLI2S_R = 3

Can give at 86 MHz clock to the I2S hardware. Its here where it all goes to pot. How do I configure I2S with an input of 86 MHz (or otherwise) to sample PDM at 1.024 MHz.

Would I be right in saying a 1.024 MHz clock for PDM is the same as considering 16 bit I2S to be sampled at 64 kHz? ST's code comments throw me at this point as they state:

  *         - Master clock output (MCKO): ON 

  *         - Audio sampling freq (KHz) : 48 

but then the I2S init function gets:

  I2S_InitStructure.I2S_MCLKOutput = I2S_MCLKOutput_Disable;

  I2S_InitStructure.I2S_AudioFreq = 32000;

I feel the last formula and diagram on page 893 of the reference manual should be helpful but I'm currently struggling how the tie together, especially with the two divisions of factor 2 in the formula. (I've never worked with audio before).

Any help appreciated.

#i2s
0 REPLIES 0