AnsweredAssumed Answered

STM32F4 DISCO data transfer

Question asked by jasonas.matas on Sep 30, 2015
Latest reply on Oct 3, 2015 by jasonas.matas
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.

Outcomes