Hide navigation sidebar
Hide table of contents sidebar
Back to top
Toggle table of contents sidebar

# I2S Library

A software defined library that allows you to control an I2S (Inter-IC Sound) bus via xcore ports. I2S is a digital data streaming interfaces particularly appropriate for transmission of audio data. TDM is a special case of I2S which supports transport of more than two audio channels and is partially included in the library at this time. The components in the library are controlled via C and can either act as I2S master, I2S slave or TDM slave.

Note

TDM is only currently supported as a TDM16 slave Tx component. Expansion of this library to support master or slave Rx is possible and can be done on request.

I2S is a protocol between two devices where one is the master and one is the slave which determines who drives the clock lines. The protocol is made up of four signals shown in I2S data wires.

Table 68 I2S data wires
MCLK | Clock line, driven by external oscillator. This signal is optional.
BCLK | Bit clock. This is a fixed divide of the MCLK and is driven by the master.
LRCLK (or WCLK) | Word clock (or word select). This is driven by the master.
DATA | Data line, driven by one of the slave or master depending on the data direction. There may be several data lines in differing directions.

All I2S functions can be accessed via the `i2s.h` header:

    #include "i2s.h"

TDM is a protocol between two devices similar to I2S where one is the master and one is the slave which determines who drives the clock lines. The protocol is made up of four signals shown in TDM data wires.

Table 69 TDM data wires
MCLK | Clock line, driven by external oscillator. This signal is optional.
BCLK | Bit clock. This is a fixed divide of the MCLK and is driven by the master.
FSYCNH | Frame synchronization. Toggles at the start of the TDM data frame. This is driven by the master.
DATA | Data line, driven by one of the slave or master depending on the data direction. There may be several data lines in differing directions.

Currently supported TDM functions can be accessed via the `i2s_tdm_slave.h` header:

    #include "i2s_tdm_slave.h"

- I2S Common API
  - I2S Instances
  - TDM Instances
- I2S Master
  - I2S Master Usage
  - I2S Master API
- I2S Slave
  - I2S Slave Usage
  - I2S Slave API
- TDM Slave
  - TDM Slave Tx Usage
  - TDM Slave Tx API