19.4.2.5 Audio Protocol Modes

The SPI module supports four Audio Protocol modes and can be operated in any one of these modes:

  • I2S mode
  • Left Justified mode
  • Right Justified mode
  • PCM/DSP mode

These Audio Protocol modes can be enabled by configuring the AUDMOD[1:0] bits (SPIxCON1[25:24]). These modes enable communication to different types of codecs and control the edge relationships of LRCK and SDIx/SDOx with respect to SCKx.

With respect to data transmit, in all of the Protocol modes, the MSb is first transmitted followed by MSB-1, and so on, until the LSb transmits. The length of the data is discussed in Audio Data Length and Frame Length. If there are SCKx periods left over after the LSb is transmitted, zeros are sent to fill up the frame.

When in Client mode, the relationship between the BCLK (on the SCKx pin) and the period (or frame length) of the LRCK (on the SSx pin) is far less constrained than that of Host mode. In Host mode, the frame length equals 32 or 64 BCLKs, depending on the MODE[32,16] (SPIxCON1[11:10]) bit settings. However, in Client mode, the frame length can be greater than or equal to 32 or 64 BCLKs, but the FRMERR bit (SPIxSTAT[12]) will be set if the frame LRCK edge arrives early.

Figure 19-21 illustrates the general interface between the codec device and the SPI module in Audio mode.

Figure 19-21. SPIx Module in Audio Client Mode – BCLK and WS or LRCK Generated by Host