Waveshare WM8960

Hi everyone, new user to Volumio here!
I’ve come across the Volumio system as a viable solution to distribute music easily with both DACs and have been looking at using this Waveshare WM8960 driver board with small speakers as a little test bench but it does not want to work.
looking at the kernel files for Volumio there is a file for the WM8960 codec installed but if I go through the steps to install the sound card driver I get errors

DKMS: add completed.

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area....(bad exit status: 2)
make KERNELRELEASE=3.6-trunk-rpi -C /lib/modules/3.6-trunk-rpi/build M=/var/lib/dkms/wm8960-soundcard/1.0/build....(bad exit status: 2)
Error! Bad return status for module build on kernel: 3.6-trunk-rpi (armv7l)
Consult /var/lib/dkms/wm8960-soundcard/1.0/build/make.log for more information.
Error! echo
Your kernel headers for kernel 4.14.92+ cannot be found at
/lib/modules/4.14.92+/build or /lib/modules/4.14.92+/source.
Error! echo
Your kernel headers for kernel 4.14.92-v7+ cannot be found at
/lib/modules/4.14.92-v7+/build or /lib/modules/4.14.92-v7+/source.
Created symlink from /etc/systemd/system/sysinit.target.wants/wm8960-soundcard.service to /lib/systemd/system/wm8960-soundcard.service.
------------------------------------------------------
Please reboot your raspberry pi to apply all settings
Enjoy!
------------------------------------------------------
volumio@volumio:~/WM8960-Audio-HAT$ sudo reboot

Anyone able to give me any pointers as to how to have this soundcard installed and functional, the small speaker form factor and smallness of the unit with a pi zero w is what I’m looking for as a test bench.

Thanks All.

Hi Sammers, same here. I just recently received mine in the mail, assuming it will work with the various dac amps that volumio supports. I was wrong… A whole day of searching and following the brief wiki guide https://github.com/waveshare/WM8960-Audio-HAT%20for%20the%20WM8960 from waveshare, yields zero results.

Mine is added manually to dkms correctly but failed to be detected in the aplay -l list as card 1. However it was detected as hifiberry instead? Strange…I tried all sorts of i2c configurations from volumio’s GUI, nothing works.

A bit upsetting from waveshare, the audio hat is just what I need too, small, supports 2 x amped L/R audio outputs.

Did anyone get this to work? I’m struggling around and I’m about to replace it with a hi-fi berry board

Hi,
I started to play with Waveshare WM8960 and volumio and now I have a partially working setup.
To avoid the ‘linux-image-3.6-trunk-rpi’ error messages you have to extend the /boot partition from 60M to eg. 100M.
Right before the ./install.sh card driver installation script you have to download the kernel source of your current kernel with sudo volumio kernelsource command. (You can also remove the apt-get -y install raspberrypi-kernel-headers raspberrypi-kernel line from intsall.sh if you want to save some disk space).
After the install.sh you can check the success of the installation volumio@volumio:~$ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: wm8960soundcard [wm8960-soundcard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 [bcm2835-i2s-wm8960-hifi wm8960-hifi-0] Subdevices: 0/1 Subdevice #0: subdevice #0 card 1: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA] Subdevices: 7/7 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 card 1: ALSA [bcm2835 ALSA], device 1: bcm2835 IEC958/HDMI [bcm2835 IEC958/HDMI] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: ALSA [bcm2835 ALSA], device 2: bcm2835 IEC958/HDMI1 [bcm2835 IEC958/HDMI1] Subdevices: 1/1 Subdevice #0: subdevice #0

Under the playback options now you can select wm8960-soundcard as output device. And voilà!

Currently the I2S mode doesn’t work for me but I will try to find out the right entry in dacs.json to make it work.

EDIT: it works with 2.692 but not with 2.668 or 2.657

The correct entry is {"id":"wm8960-soundcard","name":"Waveshare - WM8960","overlay":"wm8960-soundcard","alsanum":"0","mixer":"","modules":"","script":"","needsreboot":"no"},
You need to insert it into dacs.json under /volumio/app/plugins/system_controller/i2s_dacs in “Raspberry PI” section
So the result would be similar to this:

{ "devices":[ {"name":"Raspberry PI","data":[ {"id":"wm8960-soundcard","name":"Waveshare - WM8960","overlay":"wm8960-soundcard","alsanum":"0","mixer":"","modules":"","script":"","needsreboot":"no"}, {"id":"adafruit-max98357","name":"Adafruit MAX98357","overlay":"hifiberry-dac","alsanum":"1","mixer":"","modules":"","script":"","needsreboot":"yes"},
Now you can switch I2S DAC to on and select Waveshare - WM8960 form the list under Playback options.

Hi,
Thanks for the info posted here, it helped me setup my Waveshare. I would just like to add that, for my setup, using volumio 2.692, the i2s mode didn’t quite work reliably at each reboot and I wasn’t able to change the volume level. I had to update dacs.json to include the i2s-mmap overlay, the mixer and the i2c address, as well as force a reboot. The updated dacs.json line looks as follows:

{"id":"wm8960-soundcard","name":"Waveshare WM8960","overlay":"i2s-mmap, wm8960-soundcard","alsanum":"0","mixer":"Speaker","modules":"","script":"","i2c_address":"1a","needsreboot":"yes"}

Hi,
I tested it with Raspberry Pi Zero W and it works fine for me and I did not have problems with reboot. What kind of SBC are you using?

Hi,
I am using a Pi 3 Model A+. I’ve found that it keeps reverting the Volume Mixer Control to headphones but I have a speaker connection on the green block not on the headphone jack. When that happens I have to go to Settings and set it back to Speaker…
waveshare.jpg

Hello, i have the same problem to work this card wm8960 with volumio
It is work with the 2.773 of volumio? how i can " extend the /boot partition from 60M to eg. 100M" because raspi-config isn’t installed? could you please explain how i have to do?
Thank you very much

Hi,
You can use any free partition manager such as EaseUS Partition Master Free or GParted Disk Partition

Hi there!

Sorry to bother you guys with a maybe stupid beginner-question: How do I do that? How can I update the dacs.json file? I’m not even able to find this file.

Thanks for your time!

hi, is it possible to make an image of your working volumio with the WM8960 HAT?

I can’t get it to work…

Thanks

Hi,

Im trying to get this wm8960 working on a RPi Zero, but I can’t seem to get past the “resizing of the /boot partition”, and is stuck with the ‘linux-image-3.6-trunk-rpi’ error message.

Whatever I do, I cant find any way to resize it, and im stuck.
I found this page which sums up my problem, but still haven’t got it working:

What have you guys done to successfully do this resizing?

Resize the boot partition on Linux with gparted. (with error when gparted verifies the boot partition)
With a Windows PC (maybe possible with Linux), save all the files present on the fat32 partition.
From Disk Manager format the partition (FAT32). The new partition size is applied.
Move all saved files to the fat32 partition.

But for me the install.sh command failed… (ZeroW)

Hi , how can I extend the /boot partition from 60M to e.g. 100M?
It doesn’t work with raspi-config.
Clearing space under /boot: what can I delete?

It worked!

So the steps you have to take!

  1. Download and install Volumio version 2.692 on a SD
    Older volumio versions .img files - #3 by tobidud
  2. Let it run and install it and select HDMI as output
  3. Shut it down, take the SD and put it on another linux/raspberry pi pc and use gparted to change the boot partition size to 100MB(it’s possible it gives a small error, but the important thing is that your FAT partition is around 100MB)
  4. put it back in to your RP ZW and start up
  5. add the rule in the /volumio/app/plugins/system_controller/i2s_dacs/dacs.json file

Blockquote

{“id”:“wm8960-soundcard”,“name”:“Waveshare - WM8960”,“overlay”:“wm8960-soundcard”,“alsanum”:“0”,“mixer”:“Digital”,“modules”:“”,“script”:“”,“i2c_address”:“1a”,“needsreboot”:“yes”},

Blockquote

  1. sudo volumio kernelsource
  2. git clone -b rpi-4.9.y GitHub - waveshareteam/WM8960-Audio-HAT: The drivers of [WM8960 Audio HAT] for Raspberry Pi
    cd WM8960-Audio-HAT
    sudo ./install.sh
    sudo reboot
  3. You should hear a sound when it is finished turning on.
  4. Go to your browser and go to your volumio page, open the play options
  5. put on I2S DAC and choose the Waveshare -WM8960 and save, it will reboot
  6. For making the sound level go to the max:
    go into alsamixer(just type it in a shell) and put the speakers to the max
  7. Now for making the volume change(go up and down) you have to play with the volume options in the browser, I choose mixer type Software
  8. Now the volume can be changed and “everything” should work(small stuff that doesn’t work like pausing music played from another source is a Volumio problem).

Although reverting back to version 2.692 is the easiest way to get things up and running, I took a dip on version 2.882 and figured out that it is required to add Stretch repository into package lists (under /etc/apt/sources.list), referring to this post

deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi

Also, in order to build kernel properly, the following packages are required:

  • libssl-dev

There are several error messages while running volumio kernelsource command:

tar: include/dt-bindings/input: Directory renamed before its status could be extracted
tar: include/dt-bindings: Directory renamed before its status could be extracted
tar: include: Directory renamed before its status could be extracted
tar: arch/arm64/boot/dts/broadcom: Directory renamed before its status could be extracted
tar: arch/arm64/boot/dts/arm: Directory renamed before its status could be extracted
tar: arch/arm64/boot/dts: Directory renamed before its status could be extracted
tar: arch/arm64/boot: Directory renamed before its status could be extracted
tar: arch/arm64: Directory renamed before its status could be extracted
tar: arch: Directory renamed before its status could be extracted
tar: Exiting with failure status due to previous errors
...
  HOSTCC  scripts/extract-cert
Linking Modules
ln: failed to create symbolic link ‘/lib/modules/4.19.118+/build/rpi-linux’: File exists

I don’t know what the script is trying to do, but those errors don’t look right to me. More over, the install.sh from branch rpi-4.9.y installs linux headers 3.6, which doesn’t make sense to me neither.

Anyway. In the end it kinda built dmks modules and have them installed as:

volumio@voluzero:~$ sudo dkms status
wm8960-soundcard, 1.0, 4.19.118+, armv6l: installed

Yet those built kernel modules are not loaded properly, even though both snd-soc-wm8960.ko and snd-soc-wm8960-soundcard.ko are installed in place (as indicated in install.sh)

volumio@voluzero:~$ sudo systemctl status systemd-modules-load.service
● systemd-modules-load.service - Load Kernel Modules
   Loaded: loaded (/lib/systemd/system/systemd-modules-load.service; static)
   Active: failed (Result: exit-code) since Fri 2021-07-09 02:10:59 UTC; 2s ago
     Docs: man:systemd-modules-load.service(8)
           man:modules-load.d(5)
  Process: 1198 ExecStart=/lib/systemd/systemd-modules-load (code=exited, status=1/FAILURE)
 Main PID: 1198 (code=exited, status=1/FAILURE)

Jul 09 02:10:59 voluzero systemd-modules-load[1198]: Failed to insert 'snd_soc_wm8960': No such file or directory
Jul 09 02:10:59 voluzero systemd-modules-load[1198]: Failed to insert 'snd_soc_wm8960_soundcard': No such file or...tory
Jul 09 02:10:59 voluzero systemd[1]: systemd-modules-load.service: main process exited, code=exited, status=1/FAILURE
Jul 09 02:10:59 voluzero systemd[1]: Failed to start Load Kernel Modules.
Jul 09 02:10:59 voluzero systemd[1]: Unit systemd-modules-load.service entered failed state.

Adding them though modprobe won’t help neither:

[  133.676462] snd_soc_wm8960: Unknown symbol __sanitizer_cov_trace_pc (err -2)
[  133.682986] snd_soc_wm8960_soundcard: Unknown symbol __sanitizer_cov_trace_pc (err -2)

so if I understand it wright. Leave it like it is and don’t try to update? :slight_smile:

Exactly. It will take me a while to understand the image builder architecture and automate/fix the process from the ground, but that would be the way to go if we really want to bring this up.

I’m already glad that I got it to work! It really was a battle to get it to work.