1.1.6.4 SSC Peripheral Library Help

This section provides an interface to use the Serial Synchronous Controller (SSC) peripheral.

Introduction

This section provides a brief overview of the SSC peripheral.

Description

The SSC module implements an I2S (Inter-IC Sound) interface, for connection between an MCU and an audio peripheral such as a codec or Bluetooth module. The SSC hardware also provides for other protocols, which can be configured manually.

The SSC module provides support to the audio protocol functionality via four standard I/O pins. The four pins that make up the audio protocol interface modes are:

Configuring the Library

  • RD: Serial Data Input for receiving sample digital audio data (ADCDAT)

  • TD: Serial Data Output for transmitting digital audio data (DACDAT)

  • TK/RK: Transmit/Receive Serial Clock, also known as bit clock (BCLK)

  • TF/RF: Transmit/Receive Frame Clock, also known as Left/Right Channel Clock (LRCK)

BCLK provides the clock required to drive the data out or into the module, while LRCK provides the synchronization of the frame based on the protocol mode selected.

In Host mode, the module generates both the BCLK on the TK pin and the LRCK on the TF pin. In certain devices, while in Client mode, the module receives these two clocks from its I2S partner, which is operating in Host mode.

When configured in Host mode, the leading edge of BCLK and the LRCK are driven out within one SCK period of starting the audio protocol. Serial data is shifted in or out with timings determined by the protocol mode set.

In Client mode, the peripheral drives zeros out TD, but does not transmit the contents of the transmit FIFO until it sees the leading edge of the LRCK, after which time it starts receiving data.

Host Mode

Host Generating its Own Clock – Output BCLK and LRCK

Client Mode

Codec Device as Host Derives MCLK from MCU Reference Clock Out

Default values are shown. The DMA and Interrupt Mode are always enabled.

Usage Mode can be either Host -- the SSC peripheral supplies the I2S clocks, or Client -- the peripheral such as a codec or Bluetooth module supplies the I2S clocks.

Audio Protocol Mode can be either I2S, Left Justified, or Custom. In the latter case, a number of other options are then available, which allows the SSC peripheral to be used for a number of protocols (not currently supported by existing drivers).

Data Length is set to the number of data bits per channel.

Using the Library

This topic describes the basic architecture of the SSC Peripheral Library and provides information and examples on how to use it.

Abstraction Model

The SSC module sits between the I2S Driver, and the actual hardware.

Note: Some devices may have only one instance of an SSC interface (SSC0 only).

Interface Header File: plib_ssc.h

The interface to the SSC Peripheral Library is defined in the plib_ssc.h header file. Any C language source (.c) file that uses the SSC Peripheral Library should include plib_ssc.h.

Library Source Files:

The SSC Peripheral Library library source files are provided in the audio/peripheral/ssc_xxxx/src or audio/peripheral/ssc_xxxx/templates directory. This folder may contain optional files and alternate implementations. Please refer to Configuring the Library for instructions on how to select optional features.

Usage Model

The only usage model for the SSC Peripheral Library is to use a Interrupt/DMA model. Therefore many functions normally associated with a PLIB like this (handling write or read requests, or returning transfer status), will be accomplished by the I2S driver directly communicating with the appropriate DMA functions, which is why they are not provided here.

Example Applications:

This library is used by the following applications, among others:

  • audio/apps/audio_tone

  • audio/apps/audio_tone_linkeddma

Library Interface

This section describes the Application Programming Interface (API) functions of the Peripheral Library.

Refer to each section for a detailed description.

  • Initialization Function

NameDescription
SSC_InitializeInitializes SSC module of the device
  • Transaction Functions

NameDescription
SSC_BaudSetChanges the baud rate (samples/second) of the interface.
SSC_LRCLK_GetGet the level of the I2S LRCLK (left/right clock) signal