Audio-USB

The phyCORE-i.MX7 development kit provides audio over USB2.0 (X9). This guide will demonstrate how to connect and use a USB headset for audio and microphone support.

Requirements

  • Logitech H570e headset

  • CAT5e cable (comes included with the development kit)

  • Network switch connected to a DHCP enabled network

Hardware Setup

  • Plug the headset into the USB2.0 (X9) connector.

    ../_images/pcm-061_audio-setup.jpg

After the device is connected, you should see Linux console output similar to the below:

Expected Output
root@phyboard-zeta-imx7d-1:~# usb 1-1: new full-speed USB device number 6 using ci_hdrc
usb 1-1: Warning! Unlikely big volume range (=4125), cval->res is probably wrong.
usb 1-1: [11] FU [Sidetone Playback Volume] ch = 1, val = 0/4125/1
input: Logitech Inc Logitech H570e Stereo as /devices/soc0/soc/30800000.aips-bus/30b10000.usb/ci_hdrc.0/usb1/1-1/1-1:1.3/0003:046D:0A56.0005/input/input6
hid-generic 0003:046D:0A56.0005: input: USB HID v1.11 Device [Logitech Inc Logictech H570e Stereo] on usb-ci_hdrc.0-1/input3
  • Verify that the device was connected.

    Target (Linux)
    lsusb
    
    Expected Output
    root@phyboard-zeta-imx7d-1:~# lsusb
    Bus 001 Device 006: ID 046d:0a56 Logitech, Inc.
    Bus 001 Device 001: ID 1d6b:0002 Linux 5.15.71-bsp-yocto-nxp-i.mx7-pd23.1.0 ehci_hcd EHCI Host Controller
    
  • Next, connect an Ethernet cable from X8 on the development kit carrier board to a network switch that is connected to a DHCP-enabled network.

Playing Audio

  • Copy an audio file onto the develoment kit.

    This example will use the wget command, which requires a network connection. Discover more mediums that can assist in copying files by following the guide Copying Files to the Device.

    Target (Linux)
    wget https://www2.cs.uic.edu/~i101/SoundFiles/ImperialMarch60.wav
    
  • Play the audio file.

    Target (Linux)
    aplay ImperialMarch60.wav
    
    Expected Output
    root@phyboard-zeta-imx7d-1:~# aplay ImperialMarch60.wav
    Playing WAVE 'ImperialMarch60.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Mono
    

Recording Audio

  • Use ‘arecord’ to record audio using the microphone on the headset. The following command will record audio from the microphone for 10 seconds and save it to testrecord.wav.

    Target (Linux)
    arecord -d 10 -f cd -t wav testrecord.wav
    
  • Use the following to play the file.

    Target (Linux)
    aplay testrecord.wav
    

Audio Mixer Settings

  • Control volume and various other audio setting using the ALSA soundcard driver’s ‘amixer’ or ‘alsamixer’ commands.

    Target (Linux)
    alsamixer
    

A GUI interface will pop up. This can be navigated using arrow keys.

../_images/pcm-061_audio-mixer.png

Tip

Click on the link for more information about alsamixer: https://linux.die.net/man/1/alsamixer