The purpose of this page is to describe the Linux ALSA CPU Dai driver for I2s Rx and Tx SoftIP.
Table of Contents
The Xilinx® LogiCORE™ IP I2S Transmitter and Receiver cores are soft Xilinx IP core for use with the Xilinx Vivado® Design Suite. These IPs provide easy way of sending/receiving PCM audio over I2S interface and IPs provide an easy way to interface I2S based audio DAC/ADC. These IPs requires minimal register programming. Further, the IPs support any audio sampling rates.
Up to 4 I2S channels
Supports up to 8 audio channels.
Typical system using I2S Rx and I2S Tx
The following figure shows the data flow from i2s rx to i2s tx. In the design, External I2S DAC(video FMC card consist of 3.5mm Jack) receives the data from audio source to I2S Rx where audio data is encoded into AES and audio data is sampled at 48KHz with 24bit depth and transferred to i2s Tx. I2S Tx further decodes the audio data and send it over Video FMC's Line Out interface to play audio on Speaker.
The I2S Rx/Tx driver (xilinx_iis.c) is based on the ALSA framework. It creates a device node(/dev/snd/pcmCxDx*) which can be used to query and configure the I2S Rx IP and also exposes various ALSA audio parameters Like: Sampling Rate, No.of channels and bit depth which can be used to configure the subsystem.
Recording a file: gst-launch is used to record the audio file with 24bit bit depth, 48khz sampling frequency and 2 channel audio properties. Gst-launch is using alsa src plugin to enable recording on i2s driver.
Playing a file: gst-launch is used to record the audio file with 24bit bit depth, 48khz sampling frequency and 2 channel audio properties. Gst-launch is using alsa sink plugin to enable recording on i2s driver.
gst-launch-1.0 filesrc location=/home/root/test.wav ! wavparse ! alsasink
Pass Through i2s driver testing Procedure
G-streamer and alsa-utils tools enables pass through design for the i2s Linux driver i.e i2s receiver is connecting to i2s transmitter.
This page provides different tools and techniques useful for debugging audio issues encountered in Linux-based systems. The document is mostly focused on the Linux operating system and also describes the build-in ALSA driver tool to debug PCM ring buffer positions.
Replace '#' with your card number (usually 0). This proc file can enable various debugging tools. The CONFIG_SND_PCM_XRUN_DEBUG, CONFIG_SND_VERBOSE_PROCFS, CONFIG_SND_DEBUG options must be enabled in your kernel (if xrun_debug proc file is present - this feature is enabled).
1 Basic debugging - show xruns in ksyslog interface
2 Dump stack - dump stack for basic debugging
4 Jiffies check - compare the position with kernel jiffies (a sort of in-kernel monotonic clock),
show what's changed when basic debugging is enabled
8 Dump positions on each period update call
16 Dump positions on each hardware pointer update call
32 Enable logging of last 10 ring buffer positions
64 Show the last 10 ring buffer position only once (when first error situation occured)
To enable more features just do sum values of above (for example 1+2=3). Some good value combinations:
# Enable basic debugging and dump stack
# Usefull to just see, if PCM stream is stopped for a reason (usually wrong audio process timing from scheduler)
echo 3 > /proc/asound/card0/pcm0p/xrun_debug