Is there any implementation of the I2S protocol? It seems similar to SPI, but with the left/right sync signal (which would be implemented easily probably). I2S is half-duplex and SPI is full-duplex.
Thanks.
Solved! Go to Solution.
It would be rather difficult to implement I2S with the SPI, unless you intend to run it at slower than audio speeds. Although you could probably get the I2S SCLK and SDATA to behave using the SPI, you also need a synchronous LRCLK, and many codecs also need MCLK. The problem would be generating these other signals synchronized with the SPI signals. Timing for LRCLK is pretty critical.
Another issue would be making sure the SPI transmit continuously, as a rock-steady SCLK / MCLK is necessary for the conversions inside the codec.
And then there is the issue of the clock-rate. You would need to run your processor at a clock-rate that could give you a valid SCLK frequency for the audio format you select, like 1,411.2 kHz. for CD audio.
It could more easily be done with an external state-machine.
It would be rather difficult to implement I2S with the SPI, unless you intend to run it at slower than audio speeds. Although you could probably get the I2S SCLK and SDATA to behave using the SPI, you also need a synchronous LRCLK, and many codecs also need MCLK. The problem would be generating these other signals synchronized with the SPI signals. Timing for LRCLK is pretty critical.
Another issue would be making sure the SPI transmit continuously, as a rock-steady SCLK / MCLK is necessary for the conversions inside the codec.
And then there is the issue of the clock-rate. You would need to run your processor at a clock-rate that could give you a valid SCLK frequency for the audio format you select, like 1,411.2 kHz. for CD audio.
It could more easily be done with an external state-machine.
Ok, It seems more difficult than I thought. Even with a codec without MCLK, and getting the LRCLK signal from the PWM module, I wonder how to keep the SPI transmiting continuisly...
Probably it is a good chance to try one of the new Kinetis with I2S.
Thanks for your reply.