Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I2S DAC not found when Raspberry Pi running in 64bit mode #407

Open
dheckl opened this issue Dec 29, 2020 · 2 comments
Open

I2S DAC not found when Raspberry Pi running in 64bit mode #407

dheckl opened this issue Dec 29, 2020 · 2 comments
Assignees
Labels
P3 Priority: Normal src-alsa ALSA Host API /src/hostapi/alsa

Comments

@dheckl
Copy link

dheckl commented Dec 29, 2020

Describe the bug
PortAudio does not detect a DAC directly connected to I2S (HiFiBerry DAC2 HD) when running Raspberry Pi OS in 64bit mode. It shows following error message:

Expression 'GetExactSampleRate( hwParams, &defaultSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 895

ALSA lib conf.c:5014:(snd_config_expand) Unknown parameters {AES0 0x6 AES1 0x82 AES2 0x0 AES3 0x2 CARD 0}
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM iec958:{AES0 0x6 AES1 0x82 AES2 0x0 AES3 0x2 CARD 0}
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card

Raspberry Pi OS in 32bit mode (default) can access the devices without any problems.

To Reproduce

  1. Set arm_64bit=1 in /boot/config.txt and reboot
  2. Execute bin/pa_devs
  3. Find I2S DAC in log output

Expected behavior
I2S DAC (in this case a HiFiBerry DAC2 HD) should be displayed in the output log.

--------------------------------------- device #0
Name = snd_rpi_hifiberry_dacplushd: HiFiBerry DAC+ HD HiFi pcm179x-hifi-0 (hw:0,0)
Host API = ALSA
Max inputs = 0, Max outputs = 2
Default low input latency = -1.0000
Default low output latency = 0.0087
Default high input latency = -1.0000
Default high output latency = 0.0348
Default sample rate = 44100.00
Supported standard sample rates
for half-duplex 16 bit 2 channel output =
44100.00, 48000.00, 88200.00, 96000.00,
192000.00

Actual behavior
Device is not found. The sysdefault device is found and can be used as an alternative.

~# ./bin/pa_devs
Expression 'GetExactSampleRate( hwParams, &defaultSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 895
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused
ALSA lib pcm_a52.c:823:(_snd_pcm_a52_open) a52 is only for playback
ALSA lib conf.c:5014:(snd_config_expand) Unknown parameters {AES0 0x6 AES1 0x82 AES2 0x0 AES3 0x2 CARD 0}
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM iec958:{AES0 0x6 AES1 0x82 AES2 0x0 AES3 0x2 CARD 0}
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
Expression 'GetExactSampleRate( hwParams, &defaultSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 895
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
PortAudio version: 0x00130600
Version text: 'PortAudio V19.6.0-devel, revision unknown'
Number of devices = 7
--------------------------------------- device #0
[ Default Output ]
Name = sysdefault
Host API = ALSA
Max inputs = 0, Max outputs = 128
Default low input latency = -1.0000
Default low output latency = 0.0087
Default high input latency = -1.0000
Default high output latency = 0.0348
Default sample rate = 44100.00
Supported standard sample rates
for half-duplex 16 bit 128 channel output =
8000.00, 9600.00, 11025.00, 12000.00,
16000.00, 22050.00, 24000.00, 32000.00,
44100.00, 48000.00, 88200.00, 96000.00,
192000.00
--------------------------------------- device #1
Name = lavrate
Host API = ALSA
Max inputs = 0, Max outputs = 128
Default low input latency = -1.0000
Default low output latency = 0.0078
Default high input latency = -1.0000
Default high output latency = 0.0232
Default sample rate = 44100.00
Supported standard sample rates
for half-duplex 16 bit 128 channel output =
[AVAudioResampleContext @ 0x1f77c30] Invalid input channel layout: 0
[AVAudioResampleContext @ 0x1f77c30] Invalid input channel layout: 0
[AVAudioResampleContext @ 0x1f77c30] Value 640.000000 for parameter 'phase_shift' out of range [0 - 30]
[AVAudioResampleContext @ 0x1f77c30] Invalid input channel layout: 0
[AVAudioResampleContext @ 0x1f77c30] Invalid input channel layout: 0
[AVAudioResampleContext @ 0x1f77c30] Invalid input channel layout: 0
[AVAudioResampleContext @ 0x1f77c30] Value 320.000000 for parameter 'phase_shift' out of range [0 - 30]
[AVAudioResampleContext @ 0x1f77c30] Invalid input channel layout: 0
[AVAudioResampleContext @ 0x1f77c30] Invalid input channel layout: 0
[AVAudioResampleContext @ 0x1f77c30] Invalid input channel layout: 0
[AVAudioResampleContext @ 0x1f77c30] Value 160.000000 for parameter 'phase_shift' out of range [0 - 30]
[AVAudioResampleContext @ 0x1f77c30] Invalid input channel layout: 0
[AVAudioResampleContext @ 0x1f77c30] Invalid input channel layout: 0
[AVAudioResampleContext @ 0x1f77c30] Value 147.000000 for parameter 'phase_shift' out of range [0 - 30]
[AVAudioResampleContext @ 0x1f77c30] Invalid input channel layout: 0
[AVAudioResampleContext @ 0x1f77c30] Invalid input channel layout: 0
[AVAudioResampleContext @ 0x1f77c30] Invalid input channel layout: 0
None
--------------------------------------- device #2
Name = samplerate
Host API = ALSA
Max inputs = 0, Max outputs = 128
Default low input latency = -1.0000
Default low output latency = 0.0078
Default high input latency = -1.0000
Default high output latency = 0.0232
Default sample rate = 44100.00
Supported standard sample rates
for half-duplex 16 bit 128 channel output =
8000.00, 9600.00, 11025.00, 12000.00,
16000.00, 22050.00, 24000.00, 32000.00,
44100.00, 48000.00, 88200.00, 96000.00,
192000.00
--------------------------------------- device #3
Name = speexrate
Host API = ALSA
Max inputs = 0, Max outputs = 128
Default low input latency = -1.0000
Default low output latency = 0.0078
Default high input latency = -1.0000
Default high output latency = 0.0232
Default sample rate = 44100.00
Supported standard sample rates
for half-duplex 16 bit 128 channel output =
8000.00, 9600.00, 11025.00, 12000.00,
16000.00, 22050.00, 24000.00, 32000.00,
44100.00, 48000.00, 88200.00, 96000.00,
192000.00
--------------------------------------- device #4
Name = upmix
Host API = ALSA
Max inputs = 0, Max outputs = 8
Default low input latency = -1.0000
Default low output latency = 0.0087
Default high input latency = -1.0000
Default high output latency = 0.0348
Default sample rate = 44100.00
Supported standard sample rates
for half-duplex 16 bit 8 channel output =
8000.00, 9600.00, 11025.00, 12000.00,
16000.00, 22050.00, 24000.00, 32000.00,
44100.00, 48000.00, 88200.00, 96000.00,
192000.00
--------------------------------------- device #5
Name = vdownmix
Host API = ALSA
Max inputs = 0, Max outputs = 6
Default low input latency = -1.0000
Default low output latency = 0.0087
Default high input latency = -1.0000
Default high output latency = 0.0348
Default sample rate = 44100.00
Supported standard sample rates
for half-duplex 16 bit 6 channel output =
8000.00, 9600.00, 11025.00, 12000.00,
16000.00, 22050.00, 24000.00, 32000.00,
44100.00, 48000.00, 88200.00, 96000.00,
192000.00
--------------------------------------- device #6
Name = dmix
Host API = ALSA
Max inputs = 0, Max outputs = 2
Default low input latency = -1.0000
Default low output latency = 0.0213
Default high input latency = -1.0000
Default high output latency = 0.0213
Default sample rate = 48000.00
Supported standard sample rates
for half-duplex 16 bit 2 channel output =
48000.00
----------------------------------------------.

Desktop (please complete the following information):

  • OS: Debian (Raspberry Pi OS)
  • OS Version: Linux Kernel 5.4.79
  • PortAudio version: stable, nightly snapshot (29-Dec-2020 01:23:04 UTC) and current (f4a9023) tested
  • Host API: ALSA
@philburk
Copy link
Collaborator

philburk commented Jan 2, 2021

We need to figure out if this is a problem in ALSA or PortAudio.
What happens if you try to play a WAV file using aplay?

aplay --list-devices
aplay --list-pcms
aplay --rate=48000 mysound.wav
aplay --help

@dheckl
Copy link
Author

dheckl commented Jan 2, 2021

Here is the output of the commands:

~# aplay --list-devices
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_dacplushd], device 0: HiFiBerry DAC+ HD HiFi pcm179x-hifi-0 [HiFiBerry DAC+ HD HiFi pcm179x-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
~# aplay --list-pcms
null
    Discard all samples (playback) or generate zero samples (capture)
jack
    JACK Audio Connection Kit
pulse
    PulseAudio Sound Server
default
sysdefault:CARD=sndrpihifiberry
    snd_rpi_hifiberry_dacplushd, HiFiBerry DAC+ HD HiFi pcm179x-hifi-0
    Default Audio Device
dmix:CARD=sndrpihifiberry,DEV=0
    snd_rpi_hifiberry_dacplushd, HiFiBerry DAC+ HD HiFi pcm179x-hifi-0
    Direct sample mixing device
dsnoop:CARD=sndrpihifiberry,DEV=0
    snd_rpi_hifiberry_dacplushd, HiFiBerry DAC+ HD HiFi pcm179x-hifi-0
    Direct sample snooping device
hw:CARD=sndrpihifiberry,DEV=0
    snd_rpi_hifiberry_dacplushd, HiFiBerry DAC+ HD HiFi pcm179x-hifi-0
    Direct hardware device without any conversions
plughw:CARD=sndrpihifiberry,DEV=0
    snd_rpi_hifiberry_dacplushd, HiFiBerry DAC+ HD HiFi pcm179x-hifi-0
    Hardware device with all software conversions
usbstream:CARD=sndrpihifiberry
    snd_rpi_hifiberry_dacplushd
    USB Stream Output
~# aplay --rate=48000 mysound.wav
Playing WAVE 'mysound.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
~# aplay --help
Usage: aplay [OPTION]... [FILE]...

-h, --help              help
    --version           print current version
-l, --list-devices      list all soundcards and digital audio devices
-L, --list-pcms         list device names
-D, --device=NAME       select PCM by name
-q, --quiet             quiet mode
-t, --file-type TYPE    file type (voc, wav, raw or au)
-c, --channels=#        channels
-f, --format=FORMAT     sample format (case insensitive)
-r, --rate=#            sample rate
-d, --duration=#        interrupt after # seconds
-s, --samples=#         interrupt after # samples per channel
-M, --mmap              mmap stream
-N, --nonblock          nonblocking mode
-F, --period-time=#     distance between interrupts is # microseconds
-B, --buffer-time=#     buffer duration is # microseconds
    --period-size=#     distance between interrupts is # frames
    --buffer-size=#     buffer duration is # frames
-A, --avail-min=#       min available space for wakeup is # microseconds
-R, --start-delay=#     delay for automatic PCM start is # microseconds 
                        (relative to buffer size if <= 0)
-T, --stop-delay=#      delay for automatic PCM stop is # microseconds from xrun
-v, --verbose           show PCM structure and setup (accumulative)
-V, --vumeter=TYPE      enable VU meter (TYPE: mono or stereo)
-I, --separate-channels one file for each channel
-i, --interactive       allow interactive operation from stdin
-m, --chmap=ch1,ch2,..  Give the channel map to override or follow
    --disable-resample  disable automatic rate resample
    --disable-channels  disable automatic channel conversions
    --disable-format    disable automatic format conversions
    --disable-softvol   disable software volume control (softvol)
    --test-position     test ring buffer position
    --test-coef=#       test coefficient for ring buffer position (default 8)
                        expression for validation is: coef * (buffer_size / 2)
    --test-nowait       do not wait for ring buffer - eats whole CPU
    --max-file-time=#   start another output file when the old file has recorded
                        for this many seconds
    --process-id-file   write the process ID here
    --use-strftime      apply the strftime facility to the output file name
    --dump-hw-params    dump hw_params of the device
    --fatal-errors      treat all errors as fatal
Recognized sample formats are: S8 U8 S16_LE S16_BE U16_LE U16_BE S24_LE S24_BE U24_LE U24_BE S32_LE S32_BE U32_LE U32_BE FLOAT_LE FLOAT_BE FLOAT64_LE FLOAT64_BE IEC958_SUBFRAME_LE IEC958_SUBFRAME_BE MU_LAW A_LAW IMA_ADPCM MPEG GSM S20_LE S20_BE U20_LE U20_BE SPECIAL S24_3LE S24_3BE U24_3LE U24_3BE S20_3LE S20_3BE U20_3LE U20_3BE S18_3LE S18_3BE U18_3LE U18_3BE G723_24 G723_24_1B G723_40 G723_40_1B DSD_U8 DSD_U16_LE DSD_U32_LE DSD_U16_BE DSD_U32_BE
Some of these may not be available on selected hardware
The available format shortcuts are:
-f cd (16 bit little endian, 44100, stereo)
-f cdr (16 bit big endian, 44100, stereo)
-f dat (16 bit little endian, 48000, stereo)

@philburk philburk self-assigned this Mar 24, 2022
@RossBencina RossBencina added src-alsa ALSA Host API /src/hostapi/alsa P3 Priority: Normal labels Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 Priority: Normal src-alsa ALSA Host API /src/hostapi/alsa
Projects
None yet
Development

No branches or pull requests

3 participants