0
\$\begingroup\$

I am trying to understand why we use I2S is better for transferring audio than SPI as I2S has less bandwidth compare to SPI.

\$\endgroup\$
  • 1
    \$\begingroup\$ as I2S has less bandwidth compare to SPI. is a fallacy. SPI simply doesn't define a data rate. \$\endgroup\$ – Marcus Müller Jul 12 '18 at 1:51
  • \$\begingroup\$ @MarcusMüller Can you elaborate your comment about that? SPI does have a SPI clock and it can more data transfer compare to I2S no? What about I2S, does it have data rate? \$\endgroup\$ – avltree Jul 12 '18 at 2:51
5
\$\begingroup\$

There is a lot more to audio than bandwidth. The way I2S works, the data are provided just in time to be converted to analog. So the I2S DAC or codec doesn't need to buffer data or maintain any type of complex synchronization. It relies on the incoming clock to determine the sample rate. This also means that the data must be sent continuously, meaning that the I2S bus will be completely utilized at all times while audio is playing.

If you wanted to use SPI the same way, you would have to run it at exactly the right rate, always delivering data just in time to be converted to analog. This means that the bus would be 100% occupied during audio playback and unavailable for anything else. Otherwise you would need to work out a complex buffering scheme and hardware flow control to tell the host when to send more data, etc.

I guess a simple way of answering the question is that I2S is specifically deisgned to send audio to a DAC. SPI is more general purpose. Most SPI implementations do not support the type of fine-grained clock speed control that would be needed to interface directly to a DAC the way I2S does.

\$\endgroup\$
  • \$\begingroup\$ can you talk from recording perspective as well? \$\endgroup\$ – avltree Jul 12 '18 at 5:26
  • \$\begingroup\$ I think most of the issues are the same with recording. If the I2S codec has a microphone or analog input capability, then the I2S bus allows it to send each sample to the host as soon as the sample is ready, and this relieves the codec of any need to buffer blocks of samples together. The issue of processing the samples and storing them (if needed) then becomes a problem for the host only. The I2S codec is basically just an ADC. \$\endgroup\$ – mkeith Jul 13 '18 at 6:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.