Audio (SBC-i.MX51)

Aus BECOM Systems Support
Version vom 31. Oktober 2023, 09:03 Uhr von Peter (Diskussion | Beiträge) (1 Version importiert)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen

The SBC contains an audio codec to supply interfaces like a standard PC:

  • Headphone Stereo Out (green 3,5mm jack)
  • Line In Stereo (blue 3,5mm jack)
  • Mic In Mono (pink 3,5mm jack)

Linux kernel configuration

Device Drivers  --->
  <*> I2C support  --->
    <*>   I2C device interface
    [*]   Autoselect pertinent helper modules
    I2C Hardware Bus support  --->
      <*> MXC I2C support
  <*> Sound card support  --->
    <*>   Advanced Linux Sound Architecture  --->
      <*>   OSS Mixer API
      <*>   OSS PCM (digital audio) API
      [*]     OSS PCM (digital audio) API - Include plugin system
      [*]   Support old ALSA API
      [*]   Verbose procfs contents
      <*>   ALSA for SoC audio support  --->
        <M>   SoC Audio for the Freescale i.MX CPU
        [*]     Locate Audio DMA playback buffers in IRAM
        <M>     SoC Audio support for IMX - SGTL5000

The OpenEmbedded Linux kernel recipe (sbc-imx51-kernel_git.bb) will take care that the following audio kernel modules are loaded at Linux boot.

  • snd-soc-sgtl5000
  • snd-soc-imx-3stack-sgtl5000
  • snd-soc-imx-ssi
  • snd-soc-imx

Test in Linux

There are some ALSA utilities that you can easily test the sound card with:

  • List available playback devices:
root@sbc-imx51:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: imx3stack [imx-3stack], device 0: SGTL5000 SGTL5000-PCM-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
root@sbc-imx51:~#
  • Play sound file on Headphone out:
root@sbc-imx51:~# aplay sample.wav 
Playing WAVE 'sample.wav' : Unsigned 8 bit, Rate 8000 Hz, Stereo
root@sbc-imx51:~#aplay sample.wav
  • List available capture devices:
root@sbc-imx51:~# arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: imx3stack [imx-3stack], device 0: SGTL5000 SGTL5000-PCM-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
root@sbc-imx51:~#
  • Record from Mic in:
alsamixer

In alsamixer, for "ADC Mux", select "MIC_IN". Then start arecord, hit [ Ctrl+c ] to stop.

root@sbc-imx51:~# arecord -D "hw:0,0" -t wav -c 2 -r 48000 -f S16_LE record.wav
Recording WAVE 'record.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
^CAborted by signal Interrupt...
root@sbc-imx51:~#
  • Record from Line in:

NOTE: The signal of a microphone is too weak for reasonable results. Instead, connect your PC's Lineout to the SBC's Linein and play any audio signal on your PC.

alsamixer

In alsamixer, for "ADC Mux", select "LINE_IN".

arecord -D "hw:0,0" -t wav -c 2 -r 48000 -f S16_LE record.wav