Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
WM8731 Example

Purpose

This example uses the Synchronous Serial Controller (SSC) of SAM devices to output an audio stream through the on-board WM8731 CODEC.

Requirements

This example can be used with SAM evaluation kits with the on-board WM8731 CODEC.

Description

This program plays a WAV file pre-loaded into the RAM. The audio stream is sent through the SSC interface connected to the on-board WM8731, enabling the sound to be audible using a pair of headphones.

Since the WM8731 DAC requires that it be feeded a master clock multiple of the sample rate, it is difficult to handle any WAV file. As such, this example application is limited to playing files with the following format:

  • Format: WAV
  • Sample rate: 48 kHz

The code can be roughly broken down as follows:

  • Enable the clock.
  • Configure and enable the Codec.
  • Configure and enable the SSC interrupt.
  • Load WAV file information.
  • Play WAV file.

Usage

  1. Build the program and download it into the evaluation board.
  2. On the computer, open and configure a terminal application (e.g. HyperTerminal on Microsoft Windows) with these settings:
    • 115200 bauds
    • 8 bits of data
    • No parity
    • 1 stop bit
    • No flow control
  3. Start the application.
  4. In the terminal window, the following text should appear:
    -- WM8731 example xxx --
    -- SAMxx-xx
    -- Compiled: xxx xx xxxx xx:xx:xx --
    Menu :
    ------
    W: Play the WAV file loaded
    I: Display the information of the WAV file
    R: Receive WAV file with XMODEM Protocol
    S: Stop playback