AnsweredAssumed Answered

How to capture raw pcm data on STM32F4 Discovery?

Question asked by 92.kabuto on Oct 22, 2015
Latest reply on Oct 23, 2015 by 92.kabuto
Hello,
Sorry for my poor english first. I tried to run few project packaged in peripheral driver provided by ST. It was audio playback and recording. My intention is monitoring raw PCM data after PDM processing. Here spi interrupt handler
void AUDIO_REC_SPI_IRQHANDLER(void)
   u16 volume;
   u16 app;
 
  /* Check if data are available in SPI Data register */
  if (SPI_GetITStatus(SPI2, SPI_I2S_IT_RXNE) != RESET)
  {
    app = SPI_I2S_ReceiveData(SPI2);
    InternalBuffer[InternalBufferSize++] = HTONS(app);
     
    /* Check to prevent overflow condition */
    if (InternalBufferSize >= INTERNAL_BUFF_SIZE)
    {
      InternalBufferSize = 0;
      
      volume = 50;
       
      PDM_Filter_64_LSB((uint8_t *)InternalBuffer, (uint16_t *)pAudioRecBuf, volume , (PDMFilter_InitStruct *)&Filter);
      Data_Status = 1; 
      
    }
  }
}
And i placed my code after data_status = 1
for(i=0;i<buffer_size;i++)
pcm_index[i]=*(pAudioRecbuf + i)
And then send serially pcm_index to pc. Is it right way to get the pcm output data? I implemented this, and then look raw data and build to wav file in matlab. I got just like noise, anything i did i always get noise like. So please tell me right way to do this
Thanks so much

Outcomes