Question
How to receive the 24-bit data via I2S
Posted on April 06, 2016 at 11:20
Hi,
I need to get 24bit data via I2S interface from a microphone.It is said on Reference Manual that I need to get the data twice, and 16 bits for each time.Also the 8 LSB should be cleared.This is my init sequence:-----------------------------------------------------------------------static void I2S_Config(void){ I2S_InitTypeDef I2S_InitStructure; RCC_I2SCLKConfig(RCC_I2S2CLKSource_PLLI2S); RCC_PLLI2SCmd(ENABLE); while(RCC_GetFlagStatus(RCC_FLAG_PLLI2SRDY)); RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI3, ENABLE); I2S_Cmd(SPI3,DISABLE); SPI_I2S_DeInit(SPI3); I2S_InitStructure.I2S_AudioFreq = 3000; 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_24b; I2S_InitStructure.I2S_Mode = I2S_Mode_MasterRx; I2S_Init(SPI3, &I2S_InitStructure); }-----------------------------------------------------------------------DMA is used to get the data into the buffer. But the data I received like this:
0x06120x847FThe first one is the 16MSB of the 24-bit data, and the second one should be the 16LSB. The 8LSB should be zero, but it was not.I am very confused about this problem.