Main Content

Authoring a Reference Design for Audio System on a ZYBO Board

This example shows how to build a reference design to run an audio algorithm and access audio input and output on ZYBO™ Z7-10 board.

Before You Begin

To run this example, you must have the following software and hardware installed and set up:

  • HDL Coder™ Support Package for Xilinx® FPGA and SoC Devices

  • Xilinx Vivado®, with latest version mentioned in the documentation

  • Digilent® Zybo Z7-10 Zynq development board with the accessory kit

This example can be used as reference for creating custom reference design for Digilent® ZYBO Z7-20 board.

To setup the ZYBO Z7-10 board, refer to the Set up the Zybo board section in the Define Custom Board and Reference Design for AMD Workflow article.

Introduction

In this example you will create a reference design which receives audio input from ZYBO Z7-10 board, performs some processing on it and transmits the processed audio data out of ZYBO Z7-10 board. You also generate IP cores for peripheral interfaces using HDL Workflow Advisor.

To perform audio processing on ZYBO Z7-10 board, following 2 protocols are needed:

  1. I2C to configure the SSM2603 audio codec chip on ZYBO Z7-10 board.

  2. I2S to stream the digitized audio data between the codec chip and zynq fabric.

The above figure is a high level architecture diagram that shows how the reference design is used by the Filtering Algorithm IP on ZYBO Z7-10 board. This example is similar to the audio system reference design for Zedboard except that the ZYBO Z7-10 board uses a SSM2603 audio codec chip whereas the Zedboard uses ADAU1761 audio codec chip. Rest of the operating parameters are same as the Audio System reference design for Zedboard. For more details, please refer to Build Custom Reference Design to Interface with Peripheral Chip example.

The following steps are used to create the reference design described above:

  1. Generate IP Cores for peripheral interfaces

  2. Create a custom audio codec reference design in Vivado

  3. Create the reference design definition file

  4. Verify the reference design

1. Generate IP Cores for peripheral interfaces using HDL Workflow Advisor

In this example,

  1. I2C IP is developed using Stateflow® blocks & legacy VHDL code for tristate buffer.

  2. I2S IP is developed by modelling it in Simulink.

1.1 Creation of I2C IP

For creation of I2C IP to configure Audio Codec SSM2603, refer to Generate IP Core from I2C Controller Model Built Using Stateflow article.

1.2 Creation of I2S IP

Design a model in Simulink® with a MATLAB® function which implements the I2S protocol.

modelname = 'hdlcoder_I2S_ssm2603';
open_system(modelname);

Testing and IP core generation steps are same as Zedboard I2S model. For generation of I2S IP, see Build Custom Reference Design to Interface with Peripheral Chip example.

2. Create a custom audio codec reference design in Vivado

I2C, I2S and FIFO IPs are incorporated in the custom reference design. To create a custom reference design, refer to the "Create and export a custom reference design using Xilinx Vivado" section in Define Custom Board and Reference Design for AMD Workflow.

Key points to be noted while creating this custom reference design:

  1. We must understand the theory of operation of the audio codec chip on the ZYBO board.

  2. The FIFOs are set to default values for their configuration.

  3. For the IP cores generated using HDL Workflow Advisor, IPCORE_CLK and AXI4_Lite_ACLK should be connected to the same clock source.

  4. On validating the block design in Vivado, there should be no critical warnings except for the unconnected ports.

  5. In this reference design, the audio codec is configured to operate in the Master mode.

The following signals run between the reference design on Zynq Soc and the audio codec on ZYBO board:

  1. Bit_clock is the product of the sampling frequency, the number of bits per channel and the number of channels. It is driven by the audio codec in master mode. In this example, Sampling frequency is 48KHz, No of channels is 2, Number of bits per channel is 24.

  2. Serial_data_in is the analog to digital converted audio data from the codec.

  3. Serial_data_out is the digital audio data going to codec to be converted into analog form.

  4. I2C_CLK and I2C_DATA are standard I2C signals

  5. MUTEN is the Hardware mute pin connected to audio codec SSM2603.

  6. MCLK is the 12.288MHz clock signal required by the codec.

The custom audio codec reference design created for this example is shown below:

3. Create the reference design definition file

The following code describes the contents of the ZYBO board reference design definition file plugin_rd.m for the above reference design. For more details on how to define and register custom board, refer to Define Custom Board and Reference Design for AMD Workflow example.

Add the ZYBO folder to the MATLAB path using the following command:

example_root = (hdlcoder_amd_examples_root)
cd (example_root)
addpath(genpath('ZYBO'));

All files that are required for the reference design such as IP core files, XDC files, plugin_rd file etc should be added to the MATLAB path, inside ZYBO folder using the hierarchy shown below. The user generated IP core files should be in +vivado folder. plugin_rd.m, tcl files and xdc files should be in +vivado_audio_filter_2020_2 folder.

4. Verify the reference design

To verify the reference design, to generate Audio Filter IP core from a model and integrate it with the audio codec reference design, refer to Implement an Audio Filter on a Zynq Board example.