Standard SDK: [RTL8195AM] I2S - Ameba I2S Audio Demo

Ameba I2S

RTL8195AM and RTL8711AM each is equipped with 2 and 1 channel I2S interface and supports both master and slave mode. I2S features: 1. Support sample rate: 8/16/24/32/48/96/44.1/88.2 KHz 2. Support sample bit width: 16/24 bits 3. Integrated DMA engine 4. Support TX/RX bidirectional transmission 5. Support master/slave mode

I2S Audio demo

In this demo, we use Ameba as I2S master, SGTL5000 codec as I2S slave. Ameba send audio data to SGTL5000 via I2S, then SGTL5000 output audio signal to headphone. In this demo, we illustrate two approaches to acquire the audio data: read the data stored in RAM or read from SD card. The audio data used in this demo is of CD quality (16bits, 44.1KHz).

Preparation

Demo set up

The Teensy audio shield uses SGTL5000 codec. It supports stereo input and output. 1 Official document: https://www.pjrc.com/store/teensy3_audio.html

1. Connect Ameba with SGTL5000

2 SGTL5000 and Ameba is connected through 7 pins: I2C(SDA and SCL) is used to control SGTL parameters. I2S is used to transmit audio data: TX, RX, LRCLK(44.1KHz) and BCLK(1.41MHz) and MCLK(11.29MHz), the three clock signal is generated by Ameba. 3

2. Ameba SD card extension (optional)

Refer to the diagram below to connect SD/MMC Card Connector to Ameba, so as to read the audio data from SD card (.wav format). 4

3. Ameba connect to volume control (optional)

We can use a linear potentiometer to adjust the output volume. Connect end 1 and end 3 to V3.3 and GND, and end 2 to pin A2 on Ameba. 5

Open Audio Example

In Standard SDK 3.4b, please add patch: 3.4b_patch_i2s_audio_demo(v01) To read from SD card (RTL8195AM only), please add patch: 3.4b_patch_sd_storage_(v04) In platform_opts.h, set Audio Example to 1 to open Audio example. 6 In example_audio.c, configure whether to read audio data from SD card and whether to turn on the volume control (both disabled by default).
#define CONFIG_PLAY_SD_WAV		0	// 1: play wav audio file store on SD card
                                                // 0: play audio file store on memory
#define CONFIG_TUNE_VOLUME		0	// tune volume by trimmer resistor and ADC
Re-build SDK and download ram_all.bin to Ameba. Plug in your headphone nad you can hear the audio output. If the audio data is from RAM, default audio file is bird chirping sound. If the audio data is from SD, store the audio file in SD and rename to “AudioSDTest.wav”. If volume control is enabled, try to tune the potentiometer and observe the volume change.
Copyrights ©瑞晟微电子(苏州)有限公司 2021. All rights reserved.
Please confirm that QQ communication software is installed