AnsweredAssumed Answered

I2S standards - strange values

Question asked by keepcoding on Aug 12, 2013
Latest reply on Aug 14, 2013 by waclawek.jan

I am using the I2S bus to transfer audio samples from an audio codec module to the microprocessor. There are several standards for I2S like Phillips, MSB, LSB or PCM. With the Phillips standard, everything works fine (see first attachment with audio sample values for background noise). When I switch to MSB (left-justified) by setting the value in the I2S init struct and changing the configuration of the audio codec, I get strange values (see 2nd attachment). I figured out that the value 127 for the upper byte should be 255 and 128 should be 0. What's wrong?

Here my I2S config:

RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE);
I2S_InitStructure.I2S_Mode = I2S_Mode_SlaveRx;
I2S_InitStructure.I2S_Standard = I2S_Standard_MSB;
I2S_InitStructure.I2S_AudioFreq = I2S_AudioFreq_8k;
I2S_InitStructure.I2S_DataFormat = I2S_DataFormat_16b;
I2S_InitStructure.I2S_MCLKOutput = I2S_MCLKOutput_Disable; 
I2S_InitStructure.I2S_CPOL = I2S_CPOL_Low;
I2S_Init(SPI2, &I2S_InitStructure);