AnsweredAssumed Answered

stm32f4 + ICS43432 I2S Digital Microphone

Question asked by core.dmas on Oct 29, 2016
Latest reply on Oct 31, 2016 by core.dmas
I am using stm32f4 dev kit for making that things work.
I use I2S_Mode_MasterRx for I2S module(SPI2).
Screenshot_50.png
For getting system_stm32f4xx.c i use STM32F4xx_Clock_Configuration_V1.1.0.xls
please find my current config below
Screenshot_51.png

void SPI2_IRQHandler(void) {
 
  // Receiving data
  if(SPI_GetITStatus(SPI2, SPI_I2S_IT_RXNE) == SET) {
      uint16_t data = SPI2->DR;
  }
}
int main(void)
{
    //RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE);
    while(RCC_GetFlagStatus(RCC_FLAG_PLLI2SRDY));
      RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE);
 
    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);
    RCC_PLLI2SCmd(ENABLE);
 
    //RCC_APB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);
    // GPIO
    GPIO_InitTypeDef  GPIO_InitStructure;
    GPIO_PinAFConfig(GPIOB,GPIO_PinSource12, GPIO_AF_SPI2);   // WCLK
    GPIO_PinAFConfig(GPIOB,GPIO_PinSource13, GPIO_AF_SPI2);   // BCLK
    GPIO_PinAFConfig(GPIOB,GPIO_PinSource15, GPIO_AF_SPI2); // SDATA
 
    GPIO_StructInit(&GPIO_InitStructure);
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_15; // WCLK-BCLK-SDATA
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
    GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
    GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_Init(GPIOB, &GPIO_InitStructure);
 
    NVIC_InitTypeDef NVIC_InitStructure;
    NVIC_InitStructure.NVIC_IRQChannel = SPI2_IRQn;
    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
    NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
    NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
    NVIC_Init (&NVIC_InitStructure);
 
    I2S_InitTypeDef I2S_InitStructure;
    I2S_StructInit(&I2S_InitStructure);
    SPI_I2S_DeInit(SPI2);
    I2S_InitStructure.I2S_AudioFreq = I2S_AudioFreq_48k;
    I2S_InitStructure.I2S_Standard = I2S_Standard_Phillips;
    I2S_InitStructure.I2S_MCLKOutput = I2S_MCLKOutput_Disable;
    I2S_InitStructure.I2S_CPOL = I2S_CPOL_Low;
    I2S_InitStructure.I2S_DataFormat = I2S_DataFormat_16b;
    I2S_InitStructure.I2S_Mode = I2S_Mode_MasterRx;
    I2S_Init(SPI2, &I2S_InitStructure);
 
    /* Enable the Rx buffer not empty interrupt */
    SPI_I2S_ITConfig (SPI2, SPI_I2S_IT_RXNE, ENABLE);
    /* Enable the I2S2 */
    I2S_Cmd(SPI2, ENABLE);
 
    while(1);
}
But i got the following diagram it seems to me the i2s does not work well any ideas?
Screenshot_52.png

Outcomes