Basic Electronics: High-Quality Audio with Inter-IC Sound(I2S) Bus

CD player, as an indispensable audio product in the 20th century, has a transport and a DAC in one box. But, do you ever wonder how is the information for transport connected to the DAC inside of a CD player? The Inter-IC Sound(I2S) Bus is the key!

In this blog, I will cover the following topics:

  • Introduction to Inter-IC Sound(I2S)
  • Inter-IC Sound(I2S) v.s. Inter-Integrated Circuit(I2C)
  • What is I2S?
  • I2S Operation Modes
  • I2S with Arduino and Raspberry Pi

Introduction to Inter-IC Sound(I2S)

Similar to the CD player, lots of digital audio systems need the (V)LSI ICs for processing:

  • DAC and ADC
  • Digital signal processors
  • Error correction for CD and digital recording
  • Digital filters
  • Digital input / output interface

Standardized communication structures are critical for manufacturers in order to increase the flexibility of the system. I2S is designed for this purpose.

Inter-IC Sound(I2S) or Integrated Interchip Sound is a digital audio serial bus interface transmission standard defined by Philips in February 1986 (revised June 1996). It aims to transmit digital audio data between the internal devices of the system, such as CODEC, DSP, digital input/output interface, DAC, ADC and digital filter.

Be careful not to confuse I2S with the other Phillips Semiconductor protocol, Inter-Integrated Circuit(I2C), which was released in 1982.

Inter-IC Sound(I2S) v.s. Inter-Integrated Circuit(I2C)

Inter-IC Sound(I2S)

  • Used to connect digital audio devices. It is an electrical bus interface standard as well.
  • Low jitter connection since the data and clock signal transmit separately.
  • Support full-duplex / half-duplex
  • Support master/slave mode
  • Support multiple channels, since the variant of I2S supports multi-channel time-division multiplexing
  • Delivers fully digital audio signal chain. It eliminates ADC/DACs and pre-amplifier usually found in the traditional audio chain
  • No issue with synchronization with the use of master clock

Inter-Integrated Circuit(I2C)

  • I2C includes electrical and timing specifications, and an associated bus protocol.
  • Low-speed and two-wire serial data connection bus.
  • Bi-directional data transfer.
  • Used for signals transmission between ICs on the same PCB.
  • Two lines only between multiple masters and multiple slaves, Serial Dara(SDA) and Serial Clock(SCL).
  • Synchronous communication, it has a global clock signal between masters and slaves.
  • Support different data rates, e.g. 100Kbps, 400Kbps, 1Mbps, and 3.4Mbps.
  • Unique start and stop condition. Start and stop bits as well as ACK bit is used for every 8 bits of data transfer.
  • No fixed length to transfer

In Summary, the I2C bus is used to connect the microcontroller and its peripheral devices while the I2S bus focuses on the audio data transmission between digital audio devices.

But, what is I2S and what does it actually do?

What is I2S?

The bus has only to handle the audio signal, while the other signals, such as sub-coding and control, are transferred separately. To minimize the number of pins, there are three lines defined in the I2S bus:

  • word select line (WS)
  • continuous serial clock line (SCK)
  • serial data line (SD)

The device generating SCK and WS is the master. However, it is hard to define the master for the system with several transmitters and receivers. In this case, a system master is defined as controlling the flow of digital audio data between various ICs. Hence, transmitters need to generate data under the control of an external clock and act as a slave.

I2S interface timing diagram. ref. I2S bus specification by Phillips

word select line

A word select line is the channel selection signal, indicating the channel selected by the transmitter.

  • WS = 0, channel 1 (left)
  • WS = 1, channel 2 (right)

WS may change either on a trailing or leading edge of the serial clock, but it doesn’t need to be symmetrical.

In the slave, the signal is latched on the leading edge of the clock signal. The WS line changes one clock period before the MSB is transmitted allows the slave transmitter to derive synchronous timing of the serial data that will be set up for transmission. Furthermore, it enables the receiver to store the previous word and clear the input for the next word.

Clock line

Officially “continuous serial clock (SCK)”, typically written “bit clock (BCLK)”, is the synchronization signal in the module which is provided externally in slave mode and internally generated in master mode.

SCK = Sampling frequency (e.g. 48kHz, 44.1kHz, etc) * word length (16bit, 24bit, 32bit) * 2 (left and right channels)

Take propagation delays between the master clock and the data and/or word select signals into account, the total delay is the sum of:

  • the delay between the external(master) clock and the slave’s internal clock; and
  • the delay between the internal clock and the data and/or WS signals.

Data line

The serial data is transmitted in two’s complement with the MSB first. The MSB is transmitted because of different word lengths between transmitter and receiver.

  • If the system word length is greater than the transmitter word length, the word is truncated (LSBs are set to ‘0’) for data transmission.
  • If the receiver is sent more bits than its word length, the bits after the LSB are ignored.
  • If the receiver is sent fewer bits than its word length, the missing bits are set to zero internally.

The MSB has a fixed position, whereas the position of the LSB depends on the word length. The sender always sends the MSB of the next word one clock period after the WS changes.

Serial data sent by the transmitter may be synchronized with either falling or rising edge of the clock signal. However, the serial data must be latched into the receiver on the rising edge of the clock signal.

I2S Operation Modes

Based on the position of SD relative to SCK and WS, I2S is divided into three different operation modes: Phillips Standard, Left Justified Standard, Right Justified Standard.

Phillips Standard

Phillips Standard is a special case of left-justified, which is delayed by a change of one clock bit from the standard left justified standard. The data MSB of both left and right channels are valid after the second SCK / BCLK rising edge after WS changes.

Left Justified Standard

Left Justified Standard is not widely used, it is not delayed by one clock relative to BCLK. The MSB of both channels is valid after the first rising edge of SCK / BCLK after WS changes.

Right Justified Standard

Right Justified Standard, also called Japanese format, Electronic Industries Association of Japan(EIAJ) or SONY format. The LSB of the left channel is valid at the rising edge of SCK / BCLK before the falling edge of WS, while the LSB of the right channel is valid at the rising edge of SCK / BCLK before the rising edge of WS.

Compared to Left Justified Standard, the disadvantage of Right Justified Standard is that the receiving device must know the word length of the data to be transmitted in advance.

Please be careful, for Right Justified Standard and Left Justified Standard:

  • WS = 1, channel 1 (left)
  • WS = 0, channel 2 (right)

It is opposite to the Phillips Standard!

I2S with Arduino and Raspberry Pi

with Arduino

There is a library called ‘I2S library’ that allows you to use the I2S protocol on SAMD21 based boards. For the detailed information about the I2S library, please refer to ‘I2S library‘.

With the use of I2S bus, a low jitter audio data transmission between digital devices is achieved. Now, it’s time to build your real-time MIDI music player with this I2S protocol! In Seeed, a music shield is designed for this purpose which is compatible with  Arduino, Seeeduino, Seeeduino Mega, and Arduino Mega.

with Raspberry Pi

You are a fan of Raspberry Pi? Don’t worry, there is a perfect suite for you. ReSpeaker 4-Mic Array for Raspberry Pi is a 4 microphone expansion board for Raspberry Pi designed for AI and voice applications. This means that you can build a more powerful and flexible voice product that integrates Amazon Alexa Voice Service, Google Assistant, and so on.

There are other versions also available in the market:

Please follow and like us:

Calendar

May 2020
M T W T F S S
« Apr   Jun »
 123
45678910
11121314151617
18192021222324
25262728293031
Wordpress Social Share Plugin powered by Ultimatelysocial