Skip to main content
jcrepetto
Associate II
March 25, 2009
Question

Problem with I2S in 24 bits mode

  • March 25, 2009
  • 3 replies
  • 808 views
Posted on March 25, 2009 at 13:40

Problem with I2S in 24 bits mode

    This topic has been closed for replies.

    3 replies

    jcrepetto
    jcrepettoAuthor
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:07

    I am trying to use a STM32F103ZE to get data from a CODEC via the I2S interface with 24 bits data.

    This is the init sequence :

    Code:

    I2S_InitStructure.I2S_Mode = I2S_Mode_MasterRx;

    I2S_InitStructure.I2S_Standard = I2S_Standard_Phillips;

    I2S_InitStructure.I2S_DataFormat = I2S_DataFormat_24b;

    I2S_InitStructure.I2S_MCLKOutput = I2S_MCLKOutput_Enable;

    I2S_InitStructure.I2S_AudioFreq = I2S_AudioFreq_16k;

    I2S_InitStructure.I2S_CPOL = SPI_CPOL_Low;

    I2S_Init(SPI2, &I2S_InitStructure);

    and the read sequence :

    Code:

    for (i=0; i<sizeof(buffer)/sizeof(u32); i++)

    {

    while(SPI_I2S_GetFlagStatus(SPI2,SPI_I2S_FLAG_RXNE)==RESET)

    ;

    buffer[i] = SPI_I2S_ReceiveData(SPI2) << 16;

    while(SPI_I2S_GetFlagStatus(SPI2,SPI_I2S_FLAG_RXNE)==RESET)

    ;

    buffer[i] |= SPI_I2S_ReceiveData(SPI2);

    }

    This is an example of the data I get :

    0xFFFCA9FF

    0xFFC1A200

    0x0006E9FF

    0xFEB01A00

    0xFFF6D000

    ...

    According to the STM32 Ref Manual, page 549 (Figure 213),

    the 8 LSB should be cleared. They are not ...

    Am I doing something wrong, or is it a bug in the STM32 I2S implementation ?

    211768963
    Associate
    April 1, 2016
    Posted on April 01, 2016 at 08:54

    hi,

    I got the same problem. Have you found the solution to this?

    Tesla DeLorean
    Guru
    April 1, 2016
    Posted on April 01, 2016 at 10:05

    This is a five year old zombie thread. Please just open a new thread that fully decribes your own problem

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..