Waveshare WM8960 HAT - Retropie compatibility?
-
Hi everyone,
I recently bought a Waveshare WM8960 hat to work with the Raspberry Pi 4 and I've been having nothing but issues getting the software working. I followed the guide here but it doesn't compile on the latest version of Retropie. It also looks like Waveshare are offering zero support to get it working. I've managed to install the driver by running sudo apt-get update; sudo apt-get dist-upgrade and sudo apt-get install raspberrypi-kernel-headers, followed by rpi-update and then installing, but sound still doesn't work yet.
https://github.com/waveshare/WM8960-Audio-HAT
Does anyone else have any recommended stereo amps that have been tested with the latest version of Retropie and confirmed working? Ideally, I'm looking for an i2s amp that can drive 2 speakers, and switch to headphones. I'm considering switching away from Waveshare due to lack of support when new drivers are released.
Cheers!
Ben -
If you're running a recent Raspberry Pi OS version, then you shouldn't need any additional driver.
You haven't mentioned what's your RetroPie version and which image did you used, but if you start with the latest RetroPie image you'll need to update your kernel and included packages, then just adddtparam=i2s=on dtoverlay=i2s-mmap dtoverlay=wm8960-soundcard
to your
/boot/config.txt
. -
@mitu Hi, thanks for your reply and sorry for the bump in the other post. I'll post my config.txt below, but this is the order of operations I've had to take to install the amplifier drivers. Without running sudo-apt get dist-upgrade, I get the following error on a freshly flashed image:
DKMS: add completed. Error! echo Your kernel headers for kernel 5.4.51-v7l+ cannot be found at /lib/modules/5.4.51-v7l+/build or /lib/modules/5.4.51-v7l+/source. Created symlink /etc/systemd/system/sysinit.target.wants/wm8960-soundcard.service → /lib/systemd/system/wm8960-soundcard.service. Job for wm8960-soundcard.service failed because the control process exited with error code. See "systemctl status wm8960-soundcard.service" and "journalctl -xe" for details.
I'm using a CM4 running the latest RetroPie image available here, which I believe runs on the kernel 5.4.72-v71:
https://retropie.org.uk/download/Order of operations taken to get the drivers installed. I have the amplifier connected to the I2C0 bus, so I had to change the target bus to i2c0 in the dtoverlay & recompile the DTBO file by executing the following command in terminal:
sudo dtc -@ -I dts -O dtb -o wm8960-soundcard.dtbo wm8960-soundcard.dts sudo cp wm8960-soundcard.dtbo /boot/overlays/
- sudo apt-get install raspberrypi-kernel-headers --> sudo apt-get dist-upgrade --> sudo apt-get update --> sudo rpi-update
- git clone https://github.com/waveshare/WM8960-Audio-HAT
- cd WM8960-Audio-HAT
- sudo nano wm8960-soundcard.dts
- Change target = <&i2c1>; to <&i2c0>; --> save file before install
- sudo ./install.sh
- sudo reboot
- sudo i2cdetect -y 0 --> 1a appears (slave device)
- sudo aplay -l (wm8960-soundcard appears)
- Turn up speaker volume, turn on PCM channels (left and right)
- Access configuration menu in RetroPie
- Moving up and down the menus is extremely laggy, sometimes causing a bus error or just flat out freezing.
Here's my config.txt for good measure:
# uncomment if hdmi display is not detected and composite is being output hdmi_force_hotplug=1 # uncomment to force a specific HDMI mode (here we are forcing 800x480!) hdmi_group=2 hdmi_mode=87 hdmi_cvt=800 480 60 6 0 0 0 # uncomment to force a HDMI mode rather than DVI. This can make audio work in # DMT (computer monitor) modes hdmi_drive=1 # uncomment to increase signal to HDMI, if you have interference, blanking, or # no display #config_hdmi_boost=4 # uncomment for composite PAL #sdtv_mode=2 #uncomment to overclock the arm. 700 MHz is the default. #arm_freq=800 # for more options see http://elinux.org/RPi_config.txt # Uncomment some or all of these to enable the optional hardware interfaces dtparam=i2c_arm=on dtparam=i2s=on dtparam=spi=on dtoverlay=i2s-mmap dtoverlay=i2c0,pins_44_45 dtoverlay=wm8960-soundcard # Uncomment this to enable infrared communication. #dtoverlay=gpio-ir,gpio_pin=17 #dtoverlay=gpio-ir-tx,gpio_pin=18 # Additional overlays and parameters are documented /boot/overlays/README # Enable audio (loads snd_bcm2835) dtparam=audio=on [pi4] # Enable DRM VC4 V3D driver on top of the dispmanx display stack dtoverlay=vc4-fkms-v3d max_framebuffer=2
Let me reiterate that sound does indeed work in the configuration menu, I can hear the clicks of moving up and down the menus, albeit it laggy, sometimes the inputs skip a few lines and move the cursor up randomly up and down when I push up on the DPAD, for example. I'm not sure what is causing the bus error, but here is a couple of pictures of the errors flagged:
-
@stonededge said in Waveshare WM8960 HAT - Retropie compatibility?:
@mitu Hi, thanks for your reply and sorry for the bump in the other post. I'll post my config.txt below, but this is the order of operations I've had to take to install the amplifier drivers. Without running sudo-apt get dist-upgrade, I get the following error on a freshly flashed image:
DKMS: add completed. Error! echo Your kernel headers for kernel 5.4.51-v7l+ cannot be found at /lib/modules/5.4.51-v7l+/build or /lib/modules/5.4.51-v7l+/source. Created symlink /etc/systemd/system/sysinit.target.wants/wm8960-soundcard.service → /lib/systemd/system/wm8960-soundcard.service. Job for wm8960-soundcard.service failed because the control process exited with error code. See "systemctl status wm8960-soundcard.service" and "journalctl -xe" for details.
I'm using a CM4 running the latest RetroPie image available here, which I believe runs on the kernel 4.5.71+-v71:
https://retropie.org.uk/download/Order of operations taken to get the drivers installed. I have the amplifier connected to the I2C0 bus, so I had to change the target bus to i2c0 in the dtoverlay & recompile the DTBO file by executing the following command in terminal:
sudo dtc -@ -I dts -O dtb -o wm8960-soundcard.dtbo wm8960-soundcard.dts sudo cp wm8960-soundcard.dtbo /boot/overlays/
- sudo apt-get install raspberrypi-kernel-headers --> sudo apt-get dist-upgrade --> sudo apt-get update --> sudo rpi-update
- git clone https://github.com/waveshare/WM8960-Audio-HAT (firmware available here - https://github.com/waveshare/WM8960-Audio-HAT)
- cd WM8960-Audio-HAT
- sudo nano wm8960-soundcard.dts
- Change target = <&i2c1>; to <&i2c0>; --> save file before install
- sudo ./install.sh
- sudo reboot
- sudo i2cdetect -y 0 --> 1a appears (slave device)
- sudo aplay -l (wm8960-soundcard appears)
- Turn up speaker volume, turn on PCM channels (left and right)
- Access configuration menu in RetroPie
- Moving up and down the menus is extremely laggy, sometimes causing a bus error or just flat out freezing.
Here's my config.txt for good measure:
# uncomment if hdmi display is not detected and composite is being output hdmi_force_hotplug=1 # uncomment to force a specific HDMI mode (here we are forcing 800x480!) hdmi_group=2 hdmi_mode=87 hdmi_cvt=800 480 60 6 0 0 0 # uncomment to force a HDMI mode rather than DVI. This can make audio work in # DMT (computer monitor) modes hdmi_drive=1 # uncomment to increase signal to HDMI, if you have interference, blanking, or # no display #config_hdmi_boost=4 # uncomment for composite PAL #sdtv_mode=2 #uncomment to overclock the arm. 700 MHz is the default. #arm_freq=800 # for more options see http://elinux.org/RPi_config.txt # Uncomment some or all of these to enable the optional hardware interfaces dtparam=i2c_arm=on dtparam=i2s=on dtparam=spi=on dtoverlay=i2s-mmap dtoverlay=i2c0,pins_44_45 dtoverlay=wm8960-soundcard # Uncomment this to enable infrared communication. #dtoverlay=gpio-ir,gpio_pin=17 #dtoverlay=gpio-ir-tx,gpio_pin=18 # Additional overlays and parameters are documented /boot/overlays/README # Enable audio (loads snd_bcm2835) dtparam=audio=on [pi4] # Enable DRM VC4 V3D driver on top of the dispmanx display stack dtoverlay=vc4-fkms-v3d max_framebuffer=2
I'm also on Discord if it would be easier to chat there too. I'm keen to get this amp working, but considering switching out to something more compatible with RetroPie if I need to for my console build. Hopefully I was clear enough with the above! I don't think having it on i2c0 bus instead of i2c1 would cause any issues, but maybe I'm not recompiling the dtbo correctly.
-
@stonededge said in Waveshare WM8960 HAT - Retropie compatibility?:
I'm using a CM4 running the latest RetroPie image available here, which I believe runs on the kernel 5.4.72-v71:
Yes, but if you update your Raspberry Pi OS (and RetroPie setup script), you'll get the latest RPI kernel which should support the hat natively, without an additional driver, or this is how I read the following changes:
I'm not familiar with the device tree overlays and I don't know if the driver provided by Waveshare still works with the latest RPI, so if you get any errors during installation, you'd be better asking the Waveshare project's issue page.
-
@mitu said in Waveshare WM8960 HAT - Retropie compatibility?:
@stonededge said in Waveshare WM8960 HAT - Retropie compatibility?:
I'm using a CM4 running the latest RetroPie image available here, which I believe runs on the kernel 5.4.72-v71:
Yes, but if you update your Raspberry Pi OS (and RetroPie setup script), you'll get the latest RPI kernel which should support the hat natively, without an additional driver.
The best way to update is with sudo apt-update and sudo apt full-upgrade?
-
@stonededge said in Waveshare WM8960 HAT - Retropie compatibility?:
The best way to update is with sudo apt-update and sudo apt full-upgrade?
Yes, that should get you the latst kernel and firmware version.
-
@mitu Hmm, that got the amp working but RetroPie seems to crash for me after the kernel update, also nothing works, I tried to load a PS1 game but it just spat a bunch of errors.
Maybe I’d have better luck installing it over the top of Raspbian Desktop? Are crashes common on the new kernel?
-
@stonededge said in Waveshare WM8960 HAT - Retropie compatibility?:
Hmm, that got the amp working but RetroPie seems to crash for me after the kernel update
What exactly crashes ? The front-end (EmulationStation) / emulators / the setup script ?
-
It's a lot of stuff.
Clicking around in the Configuration menu for example usually leads me to this error for one. Loading a PSX game also just doesn't work, something to do with missing image. Let me see if I can get that error as well. I'm wondering if it may be better to install Raspbian Desktop --> install drivers --> install RetroPie. What do you think? I have been rebooting with sudo reboot during the installations which I don’t think would corrupt the card.
-
@stonededge said in Waveshare WM8960 HAT - Retropie compatibility?:
Clicking around in the Configuration menu for example usually leads me to this error for one.
I would suggest starting with a clean Raspberry Pi Lite / RetroPie image, don't modify any
config.txt
options and make sure it works without the audio HAT.Loading a PSX game also just doesn't work,...
That could be just a wrong image for the disc, a
.cue
file that's not correct. A verbose log would show more details about the error - what files are not found, if the BIOS is missing, etc.I'm wondering if it may be better to install Raspbian Desktop --> install drivers --> install RetroPie.
Running RetroPie from the desktop is not supported nor recommended. I suggest you start with either the RetroPie image (which is just a Raspberry Pi OS Lite image with RetroPie pre-installed) or to use the latest Raspberry Pi OS Lite image + updates and then install RetroPie manually.
-
@mitu RetroPie works entirely fine on a fresh image with no modification. My point is that when I try to install the drivers for the WM8960, I get kernel header issues on the older version of the kernel:
DKMS: add completed. Error! echo Your kernel headers for kernel 5.4.51-v7l+ cannot be found at /lib/modules/5.4.51-v7l+/build or /lib/modules/5.4.51-v7l+/source. Created symlink /etc/systemd/system/sysinit.target.wants/wm8960-soundcard.service → /lib/systemd/system/wm8960-soundcard.service. Job for wm8960-soundcard.service failed because the control process exited with error code. See "systemctl status wm8960-soundcard.service" and "journalctl -xe" for details.
I’ve asked the software developers, but they keep telling me to upgrade to 5.10 kernel, which RetroPie seems to not work with for me anyway. Have you experienced any issues after updating to 5.10, or can we expect any update to the kernel any time soon for RetroPie?
-
My point is that when I try to install the drivers for the WM8960, I get kernel header issues on the older version of the kernel:...
The advice to update to the latest kernel/firmware was so that you don't have to install any drivers and just configure the HAT's overlay in
config.txt
. Doesn't that work ?I’ve asked the software developers, but they keep telling me to upgrade to 5.10 kernel, which RetroPie seems to not work with for me anyway.
RetroPie always uses the same kernel as Raspberry Pi OS. Version 5.10 has been available for quite some time now and there's no inherent incompatibility or problems running it with RetroPie (well, except maybe this issue, but that shouldn't lead to a crash in RetroPie).
Have you experienced any issues after updating to 5.10, or can we expect any update to the kernel any time soon for RetroPie?
No, I haven't experienced any issues with 5.10. As said above, RetroPie uses the Raspberry Pi OS (nee Raspbian) kernel/firmware, there's no separate RetroPie kernel update.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.