Audio device unknown errors (PJMEDIA_EAUD_SYSERR status=420002) with I2S / ALSA on Raspberry Pi

MT
Michael Thomson
Fri, Mar 2, 2018 6:29 PM

Hi folks

I have a working Raspberry Pi GPIO connected audio interface that I want to build into a PJSIP-based project.
I am able to record from the MEMS microphone and play back through the amplifier at a variety of sample rates, bit depths and in mono or stereo, using the default capture and playback ALSA devices.

However I’m completely unable to figure out why pjsystest can find the devices, but doesn’t seem able to use them.

I’ve searched every combination of I2S, pjsip, pjsua, ALSA, and the error messages and read the PJSIP Audio troubleshooting Wiki page without a lightbulb coming on to illuminate my ignorance.
Any help would be gratefully received, as I suspect I’m missing something very fundamental and therefore so simple it doesn’t end up in a FAQ...

Pastebin contains more gory details, I’ve only included the summary here:

pjsystest audio device failure(https://pastebin.com/52UbvQpz)

17:42:56.473      systest.c  Running Audio Tone Playback Test
17:42:56.474    pjsua_aud.c  Conf connect: 1 --> 0
17:42:56.474    pjsua_aud.c  .Set sound device: capture=-1, playback=-2
17:42:56.474    pjsua_aud.c  ..Opening sound device (speaker + mic) PCM@8000/1/20ms
17:42:56.482    alsa_dev.c  ...ALSA lib pcm_direct.c:931:(snd1_pcm_direct_initialize_slave) snd_pcm_hw_params_any failed
17:42:56.482    alsa_dev.c  ...ALSA lib pcm_dsnoop.c:629:(snd_pcm_dsnoop_open) unable to initialize slave
17:42:56.483    pjsua_aud.c  ..Opening sound device (speaker + mic) PCM@44100/1/20ms
17:42:56.489    alsa_dev.c  ...ALSA lib pcm_direct.c:931:(snd1_pcm_direct_initialize_slave) snd_pcm_hw_params_any failed
17:42:56.489    alsa_dev.c  ...ALSA lib pcm_dsnoop.c:629:(snd_pcm_dsnoop_open) unable to initialize slave
17:42:56.490    pjsua_aud.c  ..Opening sound device (speaker + mic) PCM@48000/1/20ms
17:42:56.495    alsa_dev.c  ...ALSA lib pcm_direct.c:931:(snd1_pcm_direct_initialize_slave) snd_pcm_hw_params_any failed
17:42:56.495    alsa_dev.c  ...ALSA lib pcm_dsnoop.c:629:(snd_pcm_dsnoop_open) unable to initialize slave
17:42:56.497    pjsua_aud.c  ..Opening sound device (speaker + mic) PCM@32000/1/20ms
17:42:56.503    alsa_dev.c  ...ALSA lib pcm_direct.c:931:(snd1_pcm_direct_initialize_slave) snd_pcm_hw_params_any failed
17:42:56.503    alsa_dev.c  ...ALSA lib pcm_dsnoop.c:629:(snd_pcm_dsnoop_open) unable to initialize slave
17:42:56.503    pjsua_aud.c  ..Opening sound device (speaker + mic) PCM@16000/1/20ms
17:42:56.509    alsa_dev.c  ...ALSA lib pcm_direct.c:931:(snd1_pcm_direct_initialize_slave) snd_pcm_hw_params_any failed
17:42:56.509    alsa_dev.c  ...ALSA lib pcm_dsnoop.c:629:(snd_pcm_dsnoop_open) unable to initialize slave
17:42:56.510    pjsua_aud.c  ..Opening sound device (speaker + mic) PCM@8000/1/20ms
17:42:56.516    alsa_dev.c  ...ALSA lib pcm_direct.c:931:(snd1_pcm_direct_initialize_slave) snd_pcm_hw_params_any failed
17:42:56.516    alsa_dev.c  ...ALSA lib pcm_dsnoop.c:629:(snd_pcm_dsnoop_open) unable to initialize slave
17:42:56.517    pjsua_aud.c  ..Unable to open sound device: Unknown error from audio driver (PJMEDIA_EAUD_SYSERR) [status=420002]
17:42:56.517    pjsua_aud.c  .Error opening sound device: Unknown error from audio driver (PJMEDIA_EAUD_SYSERR) [status=420002]

ALSA recording at 8kHz, L16, 1 channel (https://pastebin.com/EPn5a0e0)

pi@pibell:~/pjproject-2.7.2/pjsip-apps/bin $ arecord -r 8000  -fS16_LE -c 1 -v -twav -d5 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono

ALSA playback (https://pastebin.com/rqD08N8r)

pi@pibell:~/pjproject-2.7.2/pjsip-apps/bin $ aplay -v ./test.wav
Playing WAVE './test.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono

alsa-info output (https://pastebin.com/pjHcqbWn)

!!ALSA configuration files
!!------------------------

!!System wide config file (/etc/asound.conf)

defaults.pcm.rate_converter "samplerate"
pcm.pibell_amp {
type hw
card "PiBell"
device 0
subdevice 0
channels 2
rate 48000
format S16_LE
}
pcm.pibell_mic {
type hw
card "PiBell"
device 1
subdevice 0
channels 2
rate 48000
format S32_LE
}
pcm.pibell_playmixer {
type dmix
slave.pcm "pibell_amp"
ipc_key 1987234 # Pseudo random, locally unique
ipc_key_add_uid true
}
pcm.pibell_recmixer {
type dsnoop
slave.pcm "pibell_mic"
slave.channels 2
bindings.0 0
bindings.1 0
ipc_key 3491587 # Pseudo random, locally unique
ipc_key_add_uid true
}
pcm.pibell_micboost {
type softvol
slave.pcm "pibell_recmixer"
control.name "Boost Capture Volume"
control.card "PiBell"
min_dB -3.0
max_dB 30.0
}
pcm.!default {
type asym
playback.pcm "plug:pibell_playmixer"
capture.pcm "plug:pibell_micboost"
}

!!Aplay/Arecord output
!!--------------------

APLAY

**** List of PLAYBACK Hardware Devices ****
card 0: PiBell [PiBell], device 0: bcm2835-i2s-dit-hifi dit-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0

ARECORD

**** List of CAPTURE Hardware Devices ****
card 0: PiBell [PiBell], device 1: bcm2835-i2s-ics43432-hifi ics43432-hifi-1 []
Subdevices: 1/1
Subdevice #0: subdevice #0

Cheers
Mike

Hi folks I have a working Raspberry Pi GPIO connected audio interface that I want to build into a PJSIP-based project. I am able to record from the MEMS microphone and play back through the amplifier at a variety of sample rates, bit depths and in mono or stereo, using the default capture and playback ALSA devices. However I’m completely *un*able to figure out why pjsystest can find the devices, but doesn’t seem able to use them. I’ve searched every combination of I2S, pjsip, pjsua, ALSA, and the error messages and read the PJSIP Audio troubleshooting Wiki page without a lightbulb coming on to illuminate my ignorance. Any help would be gratefully received, as I suspect I’m missing something very fundamental and therefore so simple it doesn’t end up in a FAQ... Pastebin contains more gory details, I’ve only included the summary here: pjsystest audio device failure(https://pastebin.com/52UbvQpz) 17:42:56.473 systest.c Running Audio Tone Playback Test 17:42:56.474 pjsua_aud.c Conf connect: 1 --> 0 17:42:56.474 pjsua_aud.c .Set sound device: capture=-1, playback=-2 17:42:56.474 pjsua_aud.c ..Opening sound device (speaker + mic) PCM@8000/1/20ms 17:42:56.482 alsa_dev.c ...ALSA lib pcm_direct.c:931:(snd1_pcm_direct_initialize_slave) snd_pcm_hw_params_any failed 17:42:56.482 alsa_dev.c ...ALSA lib pcm_dsnoop.c:629:(snd_pcm_dsnoop_open) unable to initialize slave 17:42:56.483 pjsua_aud.c ..Opening sound device (speaker + mic) PCM@44100/1/20ms 17:42:56.489 alsa_dev.c ...ALSA lib pcm_direct.c:931:(snd1_pcm_direct_initialize_slave) snd_pcm_hw_params_any failed 17:42:56.489 alsa_dev.c ...ALSA lib pcm_dsnoop.c:629:(snd_pcm_dsnoop_open) unable to initialize slave 17:42:56.490 pjsua_aud.c ..Opening sound device (speaker + mic) PCM@48000/1/20ms 17:42:56.495 alsa_dev.c ...ALSA lib pcm_direct.c:931:(snd1_pcm_direct_initialize_slave) snd_pcm_hw_params_any failed 17:42:56.495 alsa_dev.c ...ALSA lib pcm_dsnoop.c:629:(snd_pcm_dsnoop_open) unable to initialize slave 17:42:56.497 pjsua_aud.c ..Opening sound device (speaker + mic) PCM@32000/1/20ms 17:42:56.503 alsa_dev.c ...ALSA lib pcm_direct.c:931:(snd1_pcm_direct_initialize_slave) snd_pcm_hw_params_any failed 17:42:56.503 alsa_dev.c ...ALSA lib pcm_dsnoop.c:629:(snd_pcm_dsnoop_open) unable to initialize slave 17:42:56.503 pjsua_aud.c ..Opening sound device (speaker + mic) PCM@16000/1/20ms 17:42:56.509 alsa_dev.c ...ALSA lib pcm_direct.c:931:(snd1_pcm_direct_initialize_slave) snd_pcm_hw_params_any failed 17:42:56.509 alsa_dev.c ...ALSA lib pcm_dsnoop.c:629:(snd_pcm_dsnoop_open) unable to initialize slave 17:42:56.510 pjsua_aud.c ..Opening sound device (speaker + mic) PCM@8000/1/20ms 17:42:56.516 alsa_dev.c ...ALSA lib pcm_direct.c:931:(snd1_pcm_direct_initialize_slave) snd_pcm_hw_params_any failed 17:42:56.516 alsa_dev.c ...ALSA lib pcm_dsnoop.c:629:(snd_pcm_dsnoop_open) unable to initialize slave 17:42:56.517 pjsua_aud.c ..Unable to open sound device: Unknown error from audio driver (PJMEDIA_EAUD_SYSERR) [status=420002] 17:42:56.517 pjsua_aud.c .Error opening sound device: Unknown error from audio driver (PJMEDIA_EAUD_SYSERR) [status=420002] ALSA recording at 8kHz, L16, 1 channel (https://pastebin.com/EPn5a0e0) pi@pibell:~/pjproject-2.7.2/pjsip-apps/bin $ arecord -r 8000 -fS16_LE -c 1 -v -twav -d5 test.wav Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono ALSA playback (https://pastebin.com/rqD08N8r) pi@pibell:~/pjproject-2.7.2/pjsip-apps/bin $ aplay -v ./test.wav Playing WAVE './test.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono alsa-info output (https://pastebin.com/pjHcqbWn) !!ALSA configuration files !!------------------------ !!System wide config file (/etc/asound.conf) defaults.pcm.rate_converter "samplerate" pcm.pibell_amp { type hw card "PiBell" device 0 subdevice 0 channels 2 rate 48000 format S16_LE } pcm.pibell_mic { type hw card "PiBell" device 1 subdevice 0 channels 2 rate 48000 format S32_LE } pcm.pibell_playmixer { type dmix slave.pcm "pibell_amp" ipc_key 1987234 # Pseudo random, locally unique ipc_key_add_uid true } pcm.pibell_recmixer { type dsnoop slave.pcm "pibell_mic" slave.channels 2 bindings.0 0 bindings.1 0 ipc_key 3491587 # Pseudo random, locally unique ipc_key_add_uid true } pcm.pibell_micboost { type softvol slave.pcm "pibell_recmixer" control.name "Boost Capture Volume" control.card "PiBell" min_dB -3.0 max_dB 30.0 } pcm.!default { type asym playback.pcm "plug:pibell_playmixer" capture.pcm "plug:pibell_micboost" } !!Aplay/Arecord output !!-------------------- APLAY **** List of PLAYBACK Hardware Devices **** card 0: PiBell [PiBell], device 0: bcm2835-i2s-dit-hifi dit-hifi-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0 ARECORD **** List of CAPTURE Hardware Devices **** card 0: PiBell [PiBell], device 1: bcm2835-i2s-ics43432-hifi ics43432-hifi-1 [] Subdevices: 1/1 Subdevice #0: subdevice #0 Cheers Mike