cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F107 read MP34DT05-A mic on I2S

PSeti.1
Associate

I am working on STM32F107 to read MP34DT05-A mems mic on I2S. I have tried any configuration setting with `pdm2pcm.c` and i2s.c but nothing shows the expected result.

The expected result is positive int value. This is what i did so far:

  • i2s3 (SPI3) set to master RX mode, standar msb, format 16b extended with audio freq 8k.
  • DMA2 channel 1 halfword, circular and very high priority.
  • PDM filter set to LSB, big endian, decimation by 64.

Calling the function:

usb_printf("\nMEAS MIC..");
__HAL_RCC_CRC_CLK_ENABLE();
HAL_I2S_Receive_DMA(&hi2s3, pdm_buff, 16);
usb_printf("\nPDM BUFF: ");
usb_printf(pdm_buff);
while (1) {
    uint16_t *pcm_out;
    uint16_t *pdm_out;
    memcpy(cbuff, pdm_buff, sizeof(pdm_buff));
    PDM_Filter(&cbuff[0], &pcm_buff[0], &PDM1_filter_handler);
    usb_printf("\ncbuff: 0x%04X  ", cbuff[0]);
    usb_printf("pcm_buff: 0x%04X  ", pcm_buff[0]);
    usb_printf("pcm_buff int: %d", pcm_buff[0]);
}
delay_ms(500);

And the result is something like this:

pcm_buff: 0xFFFF828F  pcm_buff int: -32113
 pcm_buff: 0xFFFFA2E3  pcm_buff int: -23837
 pcm_buff: 0xFFFFB379  pcm_buff int: -19591

Am I missing something? Or is there any missed configuration?

#STM32F1​ #I2S​ #[MEMS Microphones]​

0 REPLIES 0