NXP Sound Cards & Media Devices Driver

  1. Introduction
  2. NVIDIA Tegra Based Modules
  3. NXP/Freescale i.MX 6/7 Based Modules
  4. NXP/Freescale i.MX 8/8X Family Based Modules
  5. NXP/Freescale i.MX 8M Mini Based Modules
  6. NXP/Freescale Vybrid Based Modules
    1. WM9715L AC97 Capture

Our Embedded Linux BSPs use the regular Linux audio subsystem Advanced Linux Sound Architecture (ALSA). The ALSA subsystem can be configured using amixer or alsamixer whereas playing and recording is possible using the ALSA utilities aplay and arecord. Higher-level frameworks such as GStreamer allow to convert audio streams (e.g. sample rate) and play/record encoded audio streams such as MP3, FLAC, or Ogg/Vorbis file formats. This article provides some example commands showing how to control and use audio with a Toradex Embedded Linux BSP.

NXP provides a large portfolio of smart switches and drivers for robust, highly-efficient and reliable automotive and industrial applications. These devices provide load control switching to ground (low side) for resistive and inductive loads. Configurable Switches. I want to know a working example of DTS for sai, codec and simple-audio-card in kernel 5.0.5 using imx8mq and ti, pcm3060, specially from the clocks perspective. I have got a sound card through the simple-audio-card, but when I try to play back a WAV file using aplay, it fails in hwparams check in.

First Steps

You can use the speaker-test to test audio, or alternatively aplay if you have an audio file deployed to the board. See a simple example below.

List the available audio devices:

In the example above, sgtl5000audio, the interface number 2, is the one connected to the headphone jack available on our carrier board. We'll use it. It may vary depending on your SoM; if you have questions, jump to the section specific to your SoM!

First, unmute the interface and adjust the volume:

Then, play a test sound:

Or, if you have a wave file on the board, for instance we'll use Gong.wav:

Audio Multi-channel Routing and Mixing Using alsalib

Bootlin has a great blog post on the topic, read Audio multi-channel routing and mixing using alsalib.

The Colibri T20 modules have a Wolfson WM9715L audio codec on board. To find pin assignment refer to the Hardware reference.

The Apalis T30, Apalis TK1 and Colibri T30 modules feature an on-module SGTL5000 audio codec:

HDA through HDMI

Please note that not all pixel clock frequencies allow for HDA being streamed through HDMI. E.g. at VESA VGA resolution you may get an error reported as follows:

Plus the number of available channels depends on the resp. HDMI device is connected to.

SGTL5000 Capture from Line-In

SGTL5000 Capture from Microphone

SGTL5000 Playback through Headphone

SPDIF through HDMI

The Colibri T20 provides SPDIF signals and Audio through HDMI.

Note that the HDMI sound card is only available if the video output is configured for HDMI and a monitor is attached.

Please note that not all pixel clock frequencies allow for SPDIF being streamed through HDMI. E.g. at VESA VGA resolution you may get an error reported as follows:

WM9715L AC97 Capture from Line-in

  • Colibri SODIMM pin 5 & 7 (LINEIN_L/R)
  • Iris: Audio header X9 pin 3 & 4 (Line IN R/L)
  • Colibri Evaluation Board: Audio jack X26 top blue
  • Orchid: Audio jack X11 top blue line in
  • MECS Tellurium: Audio jack X11 pin 1 & 2 (LINEIN_L/R)

First ALSA needs to be configured correctly using amixer.

Recording can then be done easily using GStreamer.

ALC898 HDA Capture from Line-in

  • Apalis Evaluation Board: HDA Audio jack X27 top blue

First ALSA needs to be configured correctly using amixer.

Recording can then be done easily using GStreamer.

WM9715L AC97 Capture from Microphone

  • Colibri SODIMM pin 1 (MIC_IN)
  • Iris: Audio header X9 pin 2 (requires biasing)
  • Colibri Evaluation Board: Audio jack X26 bottom pink
  • Orchid: Audio jack X11 bottom pink MIC in

ALC898 HDA Capture from Microphone

  • Apalis Evaluation Board: Audio jack X27 bottom pink

NXP Sound Cards & Media Devices Driver

WM9715L AC97 Playback through Headphone

  • Colibri SODIMM pin 15 & 17 (HEADPHONE_L/R)
  • Iris: Audio jack X8
  • Colibri Evaluation Board: Audio jack X26 middle green
  • Orchid: Audio jack X11 middle green line out
  • Protea: Audio jack X53 line out
  • MECS Tellurium: Audio jack X11 pin 4 & 5 (HEADPHONE_LF/RF)

ALC898 HDA Playback through Headphone

  • Apalis Evaluation Board: Audio jack X27 middle green

MP3 Playback

The following example shows how to playback MP3 audio via GStreamer using hardware-accelerated MP3 decoding. Please note that the two numbers at the end specify which ALSA card and device to use for audio (e.g. alsasink device=hw:0,0 for WM9715L AC97 through headphones and alsasink device=hw:1,0 for SPDIF through HDMI).

All modules based on the NXP/Freescale i.MX 6 SoC or i.MX 7 SoC provides an on-module NXP/Freescale SGTL5000 audio codec. The SPDIF signals and Audio through HDMI are available only on modules based on i.MX 6 Soc.

HW accelerated decoding and encoding are provided by GStreamer plugins.

Note that the HDMI sound card is only available if the video output is configured for HDMI and a monitor is attached.

SGTL5000 Playback

The SGTL5000 is the default sound device, thus one does not need to specify it explicitly on the command line.

Playback of a wave file:

SGTL5000 Capture from Line-in

Stereo capture can be achieved using Line-in functionality. First, 'Capture Select' needs to be selected correctly in ALSA mixer:

Then recording in various sample rates is natively possible:

SGTL5000 Capture from Microphone

Change the input channel to MIC_IN:

In contrast to Line-in, Microphone capture is mono anyway, hence we can save some space by only recording one channel. The argument -V offers a VU meter which helps to see whether there is any input and if its volume is at a reasonable level.

SPDIF Playback

Apalis features dedicated SPDIF pins and the Apalis Evaluation board provides an Optical Transmitter. Thus the Apalis iMX6 image has the SPDIF feature enabled in our default device tree, while for the Colibri iMX6 and Colibri iMX7 it is not enabled.

HDMI Playback

In addition to the video data stream, HDMI is able to carry audio data as well.Note that depending on the video resolution/framerate used, that feature might not be available.HDMI Playback is currently unavailable for Colibri i.MX7.

Sound

MP3 Playback

The following example shows how to playback MP3 audio via GStreamer using hardware-accelerated MP3 decoding. Please note that the two numbers at the end specify which ALSA card and device to use for audio (e.g. alsasink device=hw:0,0 for SGTL5000, alsasink device=hw:1,0 for SPDIF and, alsasink device=hw:2,0 for audio through HDMI, compare with /proc/asound/cards).

Additional GStreamer pipelines can be found on the Freescale community website here.

Additional encoders and decoders can be verified with GStreamer command gst-inspect.

Alternatively, using the playbin plugin, which sets up the pipeline automatically:

Recording MP3

To record and encode to MP3, the following GStreamer command can be used:

The Colibri iMX6ULL does not feature an audio codec on the module. However, it is possible to access all three audio interfaces placing an external audio codec.

However, the Colibri iMX6ULL features a Medium Quality Sound (MQS) interface that can be used to generate medium quality audio via a standard GPIO. Please refer to the module datasheet for more information.

Note: This section currently only applies to Apalis iMX8

SGTL5000 Playback

SGTL5000 Capture from Line-in

SGTL5000 Capture from Microphone

SPDIF Playback

SPDIF Recording

This was done with an optical to electronic medium converter and the signalhooked up to MXM3_217

HDMI Playback

The Verdin iMX8M Mini does not feature an audio codec on the module. However, it is possible to access all Synchronous Audio Interfaces (SAI) placing an external audio codec. The SAI interfaces can beused as I2S (Recommended) or AC97. An I2S is connected to the Wi-Fi module for Bluetooth audio features. Please refer to the module datasheet for more information.

WM8904 Audio Codec

Verdin Development Board and Dahlia Carrier Board features an analog audio interface based on the WM8904CGEFL/RV audio codec IC from Cirrus Logic.

To check the available sound cards, use the cat /proc/asound/cards command. The expected result on a Verdin iMX8MM:

To record audio, you might need to run the following command to unmute the capture device:

WM8904 Capture from Microphone

WM8904 Capture from Line-in

WM8904 Playback

WM8904 (MP3) Playback

Within the Vybrid module family, only Colibri VF61 supports analog audio. Audio is handled by the onboard Wolfson WM9715L audio codec connected via a AC97 audio link to the Vybrid SoC. The audio codec driver is called wm9712-codec, since it was initially created for the almost identical WM9712L codec.

WM9715L AC97 Playback

Playback of a WAVE file:

Note: Some parts of the AC97 protocol are realized in software. To make Software AC97 efficient, a rather large buffer is used to prepare several AC97 frames in a batch. However, using buffering does not allow the use of the variable sample rate (VRA) feature of the AC97 link during playback since that would require a response that depends on the request flag of the last received frame. Therefore, the hardware is only able to transfer 48kHz sample rate PCM streams. The ALSA audio stack is able to re-sample the sample rate dynamically, the only difference is that a file with a sample rate other than 48kHz requires somewhat more CPU resources while playback (<1% vs ~3%). Implementing the AC97 protocol without buffering would lead to a much higher CPU load than relying on ALSA's re-sampling feature.

The hardware parameter of the PCM stream during playback can be seen via the proc file system:

Playback of encoded audio formats can be achieved using GStreamer. The Colibri VF61 root filesystem does not provide GStreamer by default, however it is installable via Angstrom feeds:

The following GStreamer pipeline allows to playback Ogg Vorbis encoded audio files:

WM9715L AC97 Capture

The WM9715L has two audio ADCs hence allowing stereo audio capture. The input to these capture ADCS can be individually selected through the ALSA Capture Select controls. Capture volume and boost are handled after the channel selection, hence the volume applies for the Microphone as well as for Line-In capturing.

Two record volume modes can be selected, a standard AC97 1.5dB gain steps and an extended mode using 0.75dB gain steps. The extended mode (0.75dB gain steps) has also a larger gain range (-17.25-+30db), so we recommend using the extended mode.

The record volume can then be set to a value between 0-63 (which mappings linearly to the gain ranges above).

Depending on the input (e.g. microphones) a boost might be necessary to increase the ADC signal by +20dB.

Line-in

Stereo capture can be achieved using Line-in functionality. First, the 'Capture Select' needs to be selected correctly in ALSA mixer:

Then recording in various sample rates is natively possible:

To record the Ogg Vorbis audio format, the following GStreamer command can be used

Microphone

The Colibri standard has only one microphone input, which is connected to Mic 1 of the audio codec. The codec internally samples the same signal with both ADCs, hence the ALSA stack receives a stereo signal. However, since the signals are the same, we can save some space by only recording one channel. The argument -V offers a VU meter which helps to see whether there is any input and if its volume is on a reasonable level.

Note: The volume controls 'Mic 1' and 'Mic 2' do not change the volume when capturing from the microphone. Those volume controls are only active if the sidetone path is enabled (e.g. direct path from microphone to headphone). Use the main capture volume to control the microphone volume.

CONFIG_SND_USB_AUDIO is enabled, so you may use USB audio hardware.
If you get the following error when recording from USB, enable the CONFIG_USB_EHCI_TT_NEWSCHED kernel configuration.

  • LandTiger NXP LPC1768 Development Board

Product Description

We are sorry, but this product is discontinued. As an alternative have a look at:

The LandTiger development board with NXP LPC1768 ARM is an embedded system based on the second-generation ARM Cortex-M3 microcontroller core. It is designed for embedded system applications requiring a high-performance and low-power 32-bit microprocessor. As such it is highly suitable for instrumentation, industrial communications, motor control, lighting control, alarm systems, and more. The LandTiger development board has an on-board USB emulator, supports USB2.0 Device, dual CAN interfaces, RS232 and RS485 ports. The LandTiger development board supports a wealth of hardware and software functionality for rapid project development.

The LPC7168 ARM Cortex-M3 Processor provides:

  • 512KB on-chip Flash, to support ISP and IAP
  • 64KB SRAM
  • Processing rates 100MHz, and includes a support eight areas of memory protection unit (MPU)
  • Built-nested vector interrupt controller
  • AHB multi-layer matrix with 8-channel DMA controller, general-purpose (GPDMA)
  • Support the SSP, UART, AD / DA, timer, GPIO, etc., can be used for memory to memory transfers
  • Standard JTAG test / debug interface and debug serial line and serial line tracking port option
  • Simulation trace module supports real-time tracking
  • 4 low-power modes: sleep, deep sleep, power-down, deep power-down
  • Single 3.3V power supply (2.4V - 3.6V)
  • Operating temperature: -40 ° C - 85 ° C
  • Non-maskable interrupt (NMI) input
  • On-chip integrated power-on reset circuit
  • Built-in systems beat the timer (SysTick), to facilitate the operating system migration

LandTiger Board Resources:

Cards With Sound

  • 2 x RS232 serial interface (using the straight-through serial cable)
  • 2 x Controller Area Network (CAN) bus communication interface (CAN Transceiver: SN65VHD230)
  • 1 x RS485 communication interface (485 Transceivers: SP3485)
  • 1 x RJ45-10/100M Ethernet network interface (Ethernet PHY: DP83848)
  • DA output interface (USB sound card can do experiments on-board speaker and speaker output driver)
  • AD input interface (adjustable potentiometer input)
  • Color LCD display interface (which can take 2.8-inch or 3.2-inch color TFT 320X240)
  • USB2.0 Interface, USB host and USB Device Interface.
  • SD / MMC card (SPI) interface (available with FAT12, FAT16, FAT32 file system)
  • IIC Interface (24LC02)
  • SPI serial FLASH interfaces (AT45DB161D)
  • 2 user keys, 2 function keys and the INT0 Reset button, 8 LED lights
  • Five keys to enter the joystick (Joystick)
  • Serial ISP download function (no need to set jumpers), the standard JTAG download, simulation debugging interface.
  • Integrated USB emulator: simulation and debug capabilities to support online and support KEIL, IAR and other mainstream development environment.
  • Optional external 5V power supply or USB input to provide 5V power supply.
  • Leads all the IO, user-friendly external circuit to the secondary development of other applications.

Packing List:

Sound Cards 7.1

  • Land Tiger V2.0 Development Board
  • USB cable
  • Serial download cable
  • Ethernet cable
  • 5 VDC power supply
  • CD ROM containing a wealth of software drivers and samples

by Joseph Yiu

This new edition has been fully revised and updated to include extensive information on the ARM Cortex-M4 processor, providing a complete up-to-date guide to both Cortex-M3 and Cortex-M4 processors, and which enables migration from various processor architectures to the exciting world of the Cortex-M3 and M4.

This book presents the background of the ARM architecture and outlines the features of the processors such as the instruction set, interrupt-handling and also demonstrates how to program and utilize the advanced features available such as the Memory Protection Unit (MPU).

Chapters on getting started with IAR, Keil, gcc and CooCox CoIDE tools help beginners develop program codes. Coverage also includes the important areas of software development such as using the low power features, handling information input/output, mixed language projects with assembly and C, and other advanced topics.

  • Two new chapters on DSP features and CMSIS-DSP software libraries, covering DSP fundamentals and how to write DSP software for the Cortex-M4 processor, including examples of using the CMSIS-DSP library, as well as useful information about the DSP capability of the Cortex-M4 processor
  • A new chapter on the Cortex-M4 floating point unit and how to use it
  • A new chapter on using embedded OS (based on CMSIS-RTOS), as well as details of processor features to support OS operations
  • Various debugging techniques as well as a troubleshooting guide in the appendix
  • Topics on software porting from other architectures
  • A full range of easy-to-understand examples, diagrams and quick reference appendices

Product Reviews

Write Review

This product hasn't received any reviews yet. Be the first to review this product!

Find Similar Products by Category

Customers also viewed

  • $49.95
  • $199.00
  • $12.95
  • $26.95
  • $49.95

Related Products

  • LPC1768 Mini-DK2 Development Board$49.95
  • Open1768 - LPC1768 ARM Cortex M3 Development Board$24.95
  • STM32F4 Core Development Board$19.95
  • XBee USB Adapter - Development Board
  • LPC1788 Development Board
Comments are closed.