seeed-voicecard icon indicating copy to clipboard operation
seeed-voicecard copied to clipboard

Raspberry Pi 5 Support

Open zytegalaxy opened this issue 1 year ago • 28 comments

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: https://github.com/raspberrypi/linux/issues/5743

zytegalaxy avatar Dec 07 '23 07:12 zytegalaxy

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

flatsiedatsie avatar Dec 14 '23 13:12 flatsiedatsie

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

makermelissa avatar Jan 05 '24 23:01 makermelissa

This script ended up working well for me:

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

zytegalaxy avatar Jan 05 '24 23:01 zytegalaxy

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

makermelissa avatar Jan 08 '24 17:01 makermelissa

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 avatar Jan 10 '24 16:01 HinTak

sorry, didn't mean to close.

HinTak avatar Jan 10 '24 16:01 HinTak

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

makermelissa avatar Jan 10 '24 18:01 makermelissa

@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?

HinTak avatar Jan 10 '24 19:01 HinTak

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.

makermelissa avatar Jan 10 '24 21:01 makermelissa

@makermelissa pulseaudio seems to interfere with the desktop environment - https://github.com/HinTak/seeed-voicecard/issues/8 .

HinTak avatar Jan 10 '24 22:01 HinTak

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

makermelissa avatar Jan 10 '24 22:01 makermelissa

Uninstalling PulseAudio had no effect. Still no desktop.

makermelissa avatar Jan 10 '24 23:01 makermelissa

@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.

HinTak avatar Jan 10 '24 23:01 HinTak

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

makermelissa avatar Jan 10 '24 23:01 makermelissa

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 avatar Jan 11 '24 17:01 makermelissa

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.

makermelissa avatar Jan 11 '24 18:01 makermelissa

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?

HinTak avatar Jan 11 '24 23:01 HinTak

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

makermelissa avatar Jan 12 '24 16:01 makermelissa

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

etiennedv-mathu avatar Jan 17 '24 15:01 etiennedv-mathu

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

sassanh avatar Jan 18 '24 00:01 sassanh

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 https://github.com/HinTak/seeed-voicecard/issues/19#issuecomment-1879387637 works on lite version too

zytegalaxy avatar Jan 23 '24 08:01 zytegalaxy

~~PR here https://github.com/HinTak/seeed-voicecard/pull/29~~ See the below comments.

AIWintermuteAI avatar Mar 29 '24 20:03 AIWintermuteAI

@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 avatar Mar 30 '24 01:03 HinTak

It seems that i2cdetect on P5 is indeed faulty : https://github.com/raspberrypi/linux/issues/6056

HinTak avatar Mar 30 '24 02:03 HinTak

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

HinTak avatar Mar 30 '24 02:03 HinTak

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

HinTak avatar Mar 30 '24 02:03 HinTak

@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.

AIWintermuteAI avatar Apr 01 '24 08:04 AIWintermuteAI

@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.

fonix232 avatar May 23 '24 15:05 fonix232