How to Config Alsa Mixer Controls for a DFSDM Sound Card

Forums Reference, Evaluation, and Development Boards OSD32MP1-RED How to Config Alsa Mixer Controls for a DFSDM Sound Card

Tagged: , ,

Viewing 1 reply thread
  • Author
    Posts
    • #12534
      Farid AzharFarid Azhar
      Participant

        We’ve successfuly configured a digital Microphone on our custom board (based on OSD32MP1-RED) as a “STM32MP15DK” dfsdm sound card and able to record audio using “arecord” command. The recorded audio volume is very low and we find no way to increase it.

        We added the /etc/asound.conf file

        The contents of amixer utility are empty.

        The /var/lib/alsa/asound.state configuration file is also empty.

        There is no STM32MP15DK card specific alsa-lib configuration file “STM32MP15DK.conf” in /usr/share/alsa/cards/ directory as stated in Soundcard_configuration wiki

        How do we assign the “amixer” contents for the STM32MP15DK dfsdm sound card to modify the audio recording volume.

        Here are some of the audio commands output:

        debian@device-1293a743:~$ sudo arecord -v -r 16000 -f S16_LE -d 20 sound_S16_16khz.wav
        Recording WAVE 'sound_S16_16khz.wav' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono
        Plug PCM: Hardware PCM card 0 'STM32MP15-DK' device 0 subdevice 0
        Its setup is:
          stream       : CAPTURE
          access       : RW_INTERLEAVED
          format       : S16_LE
          subformat    : STD
          channels     : 1
          rate         : 16000
          exact rate   : 16000 (16000/1)
          msbits       : 16
          buffer_size  : 6144
          period_size  : 1024
          period_time  : 64000
          tstamp_mode  : NONE
          tstamp_type  : MONOTONIC
          period_step  : 1
          avail_min    : 1024
          period_event : 0
          start_threshold  : 1
          stop_threshold   : 6144
          silence_threshold: 0
          silence_size : 0
          boundary     : 1610612736
          appl_ptr     : 0
          hw_ptr       : 0
        debian@device-1293a743:~$ 
        
        debian@device-1293a743:~$ ls -al *.wav
        -rw-r--r-- 1 root root 640044 Mar 20 20:55 sound_S16_16khz.wav
        debian@device-1293a743:~$ 
        		=> Volume is very low in this audio
        
        debian@device-1293a743:~$ sudo arecord -l
        **** List of CAPTURE Hardware Devices ****
        card 0: STM32MP15DK [STM32MP15-DK], device 0: 4400d000.dfsdm:filter@0:dfsdm-dai-dmic-hifi dmic-hifi-0 []
          Subdevices: 1/1
          Subdevice #0: subdevice #0
        debian@device-1293a743:~$ 
        
        debian@device-1293a743:~$ sudo arecord -L
        null
            Discard all samples (playback) or generate zero samples (capture)
        default
        mic
        hw:CARD=STM32MP15DK,DEV=0
            STM32MP15-DK, 
            Direct hardware device without any conversions
        plughw:CARD=STM32MP15DK,DEV=0
            STM32MP15-DK, 
            Hardware device with all software conversions
        sysdefault:CARD=STM32MP15DK
            STM32MP15-DK, 
            Default Audio Device
        dsnoop:CARD=STM32MP15DK,DEV=0
            STM32MP15-DK, 
            Direct sample snooping device
        debian@device-1293a743:~$ 
        
        debian@device-1293a743:~$ sudo amixer -v
        amixer version 1.2.4
        debian@device-1293a743:~$ 
        
        debian@device-1293a743:~$ sudo amixer
        debian@device-1293a743:~$ 
        
        debian@device-1293a743:~$ sudo amixer scontrols
        debian@device-1293a743:~$ 
        
        debian@device-1293a743:~$ sudo amixer scontrols
        debian@device-1293a743:~$ 
        
        debian@device-1293a743:~$ sudo amixer scontents
        debian@device-1293a743:~$ 
        
        debian@device-1293a743:~$ sudo amixer controls
        debian@device-1293a743:~$ 
        
        debian@device-1293a743:~$ sudo amixer contents
        debian@device-1293a743:~$ 
        
        debian@device-1293a743:~$ cat /var/lib/alsa/asound.state
        state.STM32MP15DK {
        	control {
        	}
        }
        debian@device-1293a743:~$ 
        
        debian@device-1293a743:~$ cat /etc/asound.conf
        pcm.!default {
        	type asym
        	capture.pcm "mic"
        }
        pcm.mic {
        	type plug
        	slave {
        		pcm "hw:0,0"
        	}
        }
        debian@device-1293a743:~$
        
        debian@device-1293a743:~$ sudo alsactl -v
        alsactl version 1.2.4
        debian@device-1293a743:~$ 
        
        debian@device-1293a743:~$ cat /sys/bus/iio/devices/iio:device9/name
        dfsdm-pdm0
        debian@device-1293a743:~$ 
        
        debian@device-1293a743:~$ ls -al /usr/share/alsa/cards/STM32*.conf
        ls: cannot access '/usr/share/alsa/cards/STM32*.conf': No such file or directory
        debian@device-1293a743:~$
        
        Any help is much appreciated.
        
        /Farid.
      • #12585
        Neeraj Dantu
        Moderator

          Hey Farid,

          My apologies for the delayed response. Did you take a  look at the sound card configuration files from meta-st-stm32mp here: https://github.com/STMicroelectronics/meta-st-stm32mp/tree/kirkstone/recipes-bsp/alsa?

          Since you are using the DFSDM interface same as STM32MP157C-EV1, I would look at what the STM32MP157C-EV1 is using for the configuration files that are missing in your system.

          Best,

          Neeraj

      Viewing 1 reply thread
      • You must be logged in to reply to this topic.