Associate II
April 24, 2014
Question
STM32F4 I2S Frame Error
- April 24, 2014
- 2 replies
- 1159 views
Posted on April 24, 2014 at 22:15
I am having trouble using I2S to connect an audio codec, CS42L55, to the STM32F405. When I configure the STM32F4 to be in MasterTX mode, the codec reports that there is a clock ratio error. With an oscilloscope, I measure my MCLK signal at 12MHz and the LRCK measures at 48kHz, and I believe I have set the codec accordingly to give me a ratio of 250. I receive no output from the codec on the SDOUT line, and I see 32 clock changes on the SCK line between LRCK changes.
When I configure the STM32F4 in SlaveTX mode, I create a MCLK signal for the codec using a timer and measure the clock signal at 6MHz. The codec then creates and sends the LRCK and SCK signals. I measure LRCK at 48kHz and this time I only count 31 clock changes on the SCK line between LRCK changes. This time I am able to receive output on SDOUT and send output that I can hear on SDIN, but since I am missing that one clock tick on SCK the data I get from SDOUT is distorted -- it seems to be shifting circularly as more data comes in. The STM32F4 reports a frame error, which seems to make sense.The CS42L55 codec has a fixed output from the ADCs of 24bits and has a variable input which I am sending 24bits.Has anyone ever experienced something similar or have ideas on how to fix this? I have attached my configuration code with both my master and my slave configurations. Let me know if you need more of my code. #stm32f4-i2s-frame-cs42l55-codec