cancel
Showing results for 
Search instead for 
Did you mean: 

How to capture raw pcm data on STM32F4 Discovery?

ahmadanshoruddin
Associate
Posted on October 22, 2015 at 07:42

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 #audio-playback-and-recording
1 REPLY 1
ahmadanshoruddin
Associate
Posted on October 23, 2015 at 09:08

little disappointing there is no answer my question, maybe it`s so noob topic :( .I got the code worked and i found there was issue in serial terminal. Since i changed that, i can saw the data dan plot it with matlab. Thanks for any appreciate before