2015-09-30 06:31 AM
I want to pass data from MP45DT02 MEMS mic to the audio DAC CS43l22. All the configurations seems okay, the thing I can't seem to achieve is the correct Fifo buffer. The FIFO read variable (which points to the next array element to read) seems to always catch up to the FIFO write variable (the next array element to write to). Here my FIFO read and FIFO write functions:
void FIFO_add(uint16_t element){ if(Fifo_write + 1 != Fifo_read){ FiFo_buffer[Fifo_write] = element; if(Fifo_write == 31){ Fifo_write = 0; }else{ Fifo_write++; } } } uint16_t FIFO_remove(){ uint16_t output; if(Fifo_read+1 != Fifo_write){ output = FiFo_buffer[Fifo_read]; if(Fifo_read == 31){ Fifo_read = 0; }else{ Fifo_read++; } return output; }else{ output = 0; return output; } }what do you think? i keep hearing a lot of screaching on the audio output (and my voice in the background).I tested the DAC with a PCM array which played music as it supposed to. So DAC is really ok. #stm32f4 #mems #mp45dt022015-09-30 08:56 AM
Buffer seems a bit shallow, but I don't really understand the flow rates in your situation
This test looks to be broken at the wrapping condition if(Fifo_write + 1 != Fifo_read)2015-10-03 10:10 AM
Thanks, I replaced it with another way to pass data. Everything seems running okay now with one microphone. Now I want to move forward and attach a second one to catch stereo sound, but a funny thing happens as the MEMS microphone datasheet indicates, to attach a second microphone all you have to do is to set up the L/R pin in MIC nr. 1 GND and for MIC nr. 2 VDD, all other connections are shared (Clock, Data). When I connect the second Mic to PB10 (CLK) and PC3 (Data) the program only catch the microphone with grounded L/R pin. I checked it by grounding both microphones and the output was trashy, yet both microphones were sensitive.
So all in all, If the L/R pin of an external mems MIc is high, the Mic is ignored. So is there a setting which I have to change, because, I can't seem to find it. And I tried changing up the frequencies, but that also doesn't help.2015-10-03 11:47 AM
I have found the mistake, it catches the samples of one microphone, depending on the selected I2S standard. If the standard is uses rising edges to separate samples (Philips, MSB, LSB protocols) it catches the MIC with grounded L/R, if I use PCM protocol it catches only the one with the High L/R, so how to get them both? :D Switch between protocols, can't be right.