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

Raspberry Pi 5 Support #19

Open
zytegalaxy opened this issue Dec 7, 2023 · 28 comments
Open

Raspberry Pi 5 Support #19

zytegalaxy opened this issue Dec 7, 2023 · 28 comments

Comments

@zytegalaxy
Copy link

zytegalaxy commented Dec 7, 2023

I tried installing the driver on a fresh bookworm image in Pi 5 and after reboot, the system does not boot anymore. On Pi 4, same OS image everything work well (v6.1).

I would like to get behind Pi 5 support and help to make it happen. This audio chip is super popular and it will be bummer not to have support for Pi 5...

The issue might be related to this:
raspberrypi/linux#5743

@flatsiedatsie
Copy link

flatsiedatsie commented Dec 14, 2023

I have it running on a Pi 5, on a bookworm LITE image I flashed today. I did have to add:

dtoverlay=i2s-mmap
dtparam=i2s=on
dtoverlay=seeed-2mic-voicecard

to /boot/firmware/config.txt

@makermelissa
Copy link

It installs and works fine on the lite version of bookworm using the above, but it kills the desktop even after uninstalling.

@zytegalaxy
Copy link
Author

This script ended up working well for me:

https://github.com/ubopod/ubo-sdk/blob/main/system/setup/install_wm8960.sh

@makermelissa
Copy link

Thank you @ubopod. It appears to be working for me as well.

@HinTak
Copy link
Owner

HinTak commented Jan 10, 2024

Pi5 support and bookworm supports are separate issues. I believe the latter is fixed by #23 . Not sure about the former - anybody with a pi5 want to try after the #23 merge again?

@HinTak HinTak closed this as completed Jan 10, 2024
@HinTak HinTak reopened this Jan 10, 2024
@HinTak
Copy link
Owner

HinTak commented Jan 10, 2024

sorry, didn't mean to close.

@makermelissa
Copy link

Yes, #23 fixed an issue with Bookworm, but was it still not working not Pi 5.

@HinTak
Copy link
Owner

HinTak commented Jan 10, 2024

@makermelissa is the desktop issue same as lxpanel problem mentioned elsewhere?

I am a bit confused - @flatsiedatsie and @ubopod seems to have something that works?

@makermelissa
Copy link

I'm not sure what the lxpanel problem is. However, installing causes the desktop environment to stop working, but I can still SSH into the Pi and play audio just fine. The solution @ubopod mentioned works in the desktop environment, but isn't working for me on the lite version.

@HinTak
Copy link
Owner

HinTak commented Jan 10, 2024

@makermelissa pulseaudio seems to interfere with the desktop environment - #8 .

@makermelissa
Copy link

makermelissa commented Jan 10, 2024

Thanks, I'll see if removing it first (or after) fixes the issue.

@makermelissa
Copy link

Uninstalling PulseAudio had no effect. Still no desktop.

@HinTak
Copy link
Owner

HinTak commented Jan 10, 2024

@makermelissa surely there are signs why it doesn't start - e.g. if you can still ssh in, as root, have a look at sys log - for systemd based systems, it is journalctl -r -b (since this boot), you might have to hunt around /var/log to see what other sys log mechanisms record.

@makermelissa
Copy link

I'll take a deeper look into the issue and let you know if I see something that stands out.

@makermelissa
Copy link

Here are the relevant sections of the log that stood out. Much of it is repeated:

Jan 11 08:43:53 raspberrypi wireplumber[1060]: Trying to use legacy bluez5 API for LE Audio - only A2DP will be supported. Please upgrade bluez5.
Jan 11 08:43:53 raspberrypi systemd[1]: Started session-5611.scope - Session 5611 of User pi.
Jan 11 08:43:53 raspberrypi systemd-logind[713]: New session 5611 of user pi.
Jan 11 08:43:53 raspberrypi lightdm[1330355]: pam_unix(lightdm-autologin:session): session opened for user pi(uid=1000) by (uid=0)
Jan 11 08:43:53 raspberrypi systemd[1]: Started lightdm.service - Light Display Manager.
Jan 11 08:43:52 raspberrypi systemd[1]: Starting lightdm.service - Light Display Manager...
Jan 11 08:43:52 raspberrypi systemd[1]: Stopped lightdm.service - Light Display Manager.
Jan 11 08:43:52 raspberrypi systemd[1]: lightdm.service: Scheduled restart job, restart counter is at 2794.
Jan 11 08:43:52 raspberrypi systemd[1]: lightdm.service: Failed with result 'exit-code'.
Jan 11 08:43:52 raspberrypi systemd[1]: lightdm.service: Main process exited, code=exited, status=1/FAILURE
Jan 11 08:43:52 raspberrypi systemd-logind[713]: Session c2794 logged out. Waiting for processes to exit.
Jan 11 08:43:52 raspberrypi systemd[1]: session-c2794.scope: Deactivated successfully.
Jan 11 08:43:52 raspberrypi lightdm[1329811]: g_signal_emit_valist: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
Jan 11 08:43:52 raspberrypi lightdm[1329811]: instance with invalid (NULL) class pointer
Jan 11 08:43:52 raspberrypi lightdm[1330170]: pam_unix(lightdm-greeter:session): session closed for user lightdm
Jan 11 08:43:42 raspberrypi pipewire[1330190]: mod.rt: Can't find org.freedesktop.portal.Desktop. Is xdg-desktop-portal running?
Jan 11 08:43:42 raspberrypi wireplumber[1330191]: Can't find org.freedesktop.portal.Desktop. Is xdg-desktop-portal running?
Jan 11 08:43:42 raspberrypi pipewire-pulse[1330192]: mod.rt: Can't find org.freedesktop.portal.Desktop. Is xdg-desktop-portal running?

@makermelissa
Copy link

Reinstalling lightdm lets it boot to the desktop once again, but it loses any customizations and looks like the default debian desktop rather than the Raspberry Pi bookworm desktop.

@HinTak
Copy link
Owner

HinTak commented Jan 11, 2024

The repeatedness is meaningful - lightdm refuses to start, so systemd try to start it over and over.

@makermelissa I think there is a apt.log (or as part of systemd messages) about installed packages. So it would be interesting to know what is most recently installed because of lightdm. It looks like it might depends on pulseaudio - that's a bit insane surely, the display manager needing to play sound?

@makermelissa
Copy link

Makes sense with what I was seeing. I'll keep looking, but probably a bit later today.

@etiennedv-mathu
Copy link

etiennedv-mathu commented Jan 17, 2024

I haven't been able to get it working on my Pi5 with the Respeaker 4-Mic Array v1.2.

With a fresh copy of bookworm lite I can install without issue. But I don't see any devices listed.

pi@username:~ $ arecord -L
null
    Discard all samples (playback) or generate zero samples (capture)
lavrate
    Rate Converter Plugin Using Libav/FFmpeg Library
samplerate
    Rate Converter Plugin Using Samplerate Library
speexrate
    Rate Converter Plugin Using Speex Resampler
jack
    JACK Audio Connection Kit
oss
    Open Sound System
pulse
    PulseAudio Sound Server
speex
    Plugin using Speex DSP (resample, agc, denoise, echo, dereverb)
upmix
    Plugin for channel upmix (4,6,8)
vdownmix
    Plugin for channel downmix (stereo) with a simple spacialization
default
playback
ac108

@sassanh
Copy link

sassanh commented Jan 18, 2024

The solution @ubopod mentioned works in the desktop environment, but isn't working for me on the lite version.

My observation on a lite installation of bookworm is that when I ran the script, rebooted the device and played some audio, I heard nothing, I had to set "Playback" and "Speaker" values to a non-zero value in alsamixer to hear things:
image

@zytegalaxy
Copy link
Author

I'm not sure what the lxpanel problem is. However, installing causes the desktop environment to stop working, but I can still SSH into the Pi and play audio just fine. The solution @ubopod mentioned works in the desktop environment, but isn't working for me on the lite version.

I confirm the solution suggested in #19 (comment) works on lite version too

@AIWintermuteAI
Copy link

AIWintermuteAI commented Mar 29, 2024

PR here
#29

See the below comments.

@HinTak
Copy link
Owner

HinTak commented Mar 30, 2024

@AIWintermuteAI I am not convinced about pull - for two reasons, it just loads the 2-mic device tree so doesn't apply to the other devices; the i2cdetect -y .... lines in seeed-voiceccard is supposed to auto-detect what device is actually connected, and load that automatically.

So the fact that force-loading the device tree works, seems to suggest that on p5, the i2cdetect -y ... code is broken. Can somebody with a p5 and some devices connected, runs the 3 i2cdetect -y lines and show the result? I mean just run these 3 lines:

i2cdetect -y  1 0x1a 0x1a
i2cdetect -y  1 0x35 0x35
i2cdetect -y  1 0x3b 0x3b

`

@HinTak
Copy link
Owner

HinTak commented Mar 30, 2024

It seems that i2cdetect on P5 is indeed faulty : raspberrypi/linux#6056

@HinTak
Copy link
Owner

HinTak commented Mar 30, 2024

@AIWintermuteAI this upstream issue seems highly relevant: raspberrypi/linux#5743 - have a read. It seems to suggest modifying the device tree overlays.

@HinTak
Copy link
Owner

HinTak commented Mar 30, 2024

This sort of explains why the 2-mic card is easier to get to work - it doesn't do playbacks.

@AIWintermuteAI
Copy link

@HinTak yes, after a look at the issue it seems that the PR I made is more a quick patch rather than actual long-term solution. I'll close it.
I've been away from all the reSpeaker stuff for quite a while now and it's not immediately clear to me what needs to be modified in the device tree overlays. I do have a Pi 5 here for testing tho.

@fonix232
Copy link

@HinTak looks like recent versions of the Pi5 kernel have fixed the I2C detection issue. I'm on 6.6.28+rpt-rpi-2712 and i2cdetect -y 1 properly shows the 4-mic HAT being installed:

admin@pi5:~ $ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

(note that at this point I had the drivers loaded hence the UU state)

The service also correctly identifies the 4-mic array and loads the appropriate config and state files. However, arecord -L still returns no devices:

admin@pi5:~ $ service seeed-voicecard status
● seeed-voicecard.service - Seeed Voicecard service
     Loaded: loaded (/lib/systemd/system/seeed-voicecard.service; enabled; preset: enabled)
     Active: active (exited) since Thu 2024-05-23 15:22:41 BST; 33min ago
   Main PID: 638 (code=exited, status=0/SUCCESS)
        CPU: 293ms

May 23 15:22:41 pi5 seeed-voicecard[638]: create seeed-4mic-voicecard asound status file
May 23 15:22:41 pi5 seeed-voicecard[638]: + ln -s /etc/voicecard/ac108_asound.state /var/lib/alsa/asound.state
May 23 15:22:41 pi5 seeed-voicecard[638]: + alsactl restore
May 23 15:22:41 pi5 seeed-voicecard[851]: No state is present for card Device
May 23 15:22:41 pi5 seeed-voicecard[851]: Found hardware: "USB-Audio" "USB Mixer" "USB0c76:1203" "" ""
May 23 15:22:41 pi5 seeed-voicecard[851]: Hardware is initialized using a generic method
May 23 15:22:41 pi5 seeed-voicecard[851]: No state is present for card Device
May 23 15:22:41 pi5 seeed-voicecard[852]: + aplay -l
May 23 15:22:41 pi5 seeed-voicecard[853]: + grep -q 'bcm2835 ALSA'
May 23 15:22:41 pi5 systemd[1]: Finished seeed-voicecard.service - Seeed Voicecard service.
admin@pi5:~ $ arecord -L
null
    Discard all samples (playback) or generate zero samples (capture)
sysdefault
    Default Audio Device
lavrate
    Rate Converter Plugin Using Libav/FFmpeg Library
samplerate
    Rate Converter Plugin Using Samplerate Library
speexrate
    Rate Converter Plugin Using Speex Resampler
jack
    JACK Audio Connection Kit
oss
    Open Sound System
pulse
    PulseAudio Sound Server
speex
    Plugin using Speex DSP (resample, agc, denoise, echo, dereverb)
upmix
    Plugin for channel upmix (4,6,8)
vdownmix
    Plugin for channel downmix (stereo) with a simple spacialization
playback
ac108
default
output
usbstream:CARD=Device
    USB PnP Audio Device
    USB Stream Output

(please ignore the USB PnP Audio Device, it's a separate audio card mounted on the bottom of the Pi5 )

The driver in question is running off the v6.6 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants