-
Notifications
You must be signed in to change notification settings - Fork 98
Description
Platform Information:
Raspberry Pi Model: Pi Zero W 2 and Pi 4
Kernel Version: 6.6.47+rpt-rpi-v8
Operating System: Debian-based Raspberry Pi OS
WM8960 HAT Repository: https://github.com/waveshare/WM8960-Audio-HAT
Problem Description:
The wm8960-soundcard.service fails to start on both the Raspberry Pi Zero W 2 and Raspberry Pi 4 after following the installation procedure for the WM8960 HAT. The soundcard is detected, and both playback and recording functionalities are working, but the service fails with exit code 99.
Expected Behavior:
The wm8960-soundcard.service should successfully load the device tree overlay and configure ALSA to recognize and initialize the WM8960 HAT soundcard.
The soundcard should be automatically initialized and work on boot without manual intervention.
Actual Behavior:
The wm8960-soundcard.service fails with exit code 99.
Device tree overlay application fails within the service, though it works when manually applied via /boot/firmware/config.txt.
Manual ALSA configuration is required for soundcard initialization.
Steps Taken to Investigate and Resolve the Issue:
Step 1: Installation Procedure
We followed the instructions in the official WM8960 HAT repository as follows:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git
git clone https://github.com/waveshare/WM8960-Audio-HAT
cd WM8960-Audio-HAT
sudo ./install.sh
sudo rebootAfter reboot, the wm8960-soundcard.service failed to start.
Step 2: Checking Service Status
The service status consistently failed with the following logs:
sudo systemctl status wm8960-soundcard.service
× wm8960-soundcard.service - WM8960 soundcard service
Loaded: loaded (/lib/systemd/system/wm8960-soundcard.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since [timestamp];
Process: [pid] ExecStart=/usr/bin/wm8960-soundcard (code=exited, status=99)
Main PID: [pid] (code=exited, status=99)journalctl -xeu wm8960-soundcard.service
This revealed that the device tree overlay failed to apply:
* Failed to apply overlay 'wm8960-soundcard' (kernel)Step 3: Investigating Overlay Loading
We manually checked the device tree overlays using:
sudo dtoverlay -lOutput:
0: dtparam i2c_arm=on
1: wm8960-soundcardThis shows that the overlay is loaded manually via /boot/firmware/config.txt.
We confirmed that the following line was present in /boot/firmware/config.txt:
dtoverlay=wm8960-soundcardStep 4: Manual ALSA Configuration
Since the service failed to configure ALSA, we manually created the required symlinks and saved the ALSA state:
sudo alsactl restorePlayback and recording functionality were confirmed by running:
aplay -l
arecord -lOutput:
**** List of PLAYBACK Hardware Devices ****
card 3: wm8960soundcard [wm8960-soundcard], device 0: fe203000.i2s-wm8960-hifi wm8960-hifi-0 [fe203000.i2s-wm8960-hifi wm8960-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
...
**** List of CAPTURE Hardware Devices ****
card 3: wm8960soundcard [wm8960-soundcard], device 0: fe203000.i2s-wm8960-hifi wm8960-hifi-0 [fe203000.i2s-wm8960-hifi wm8960-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0Testing the recording and playback:
arecord -D hw:3,0 -f cd test.wav
aplay test.wavBoth recording and playback worked without issues.
Step 5: Fixing Mono Channel Playback Issues
When attempting to play a mono .wav file (Front_Center.wav), we encountered a "Channels count not available" error:
aplay -D hw:3,0 /usr/share/sounds/alsa/Front_Center.wav
aplay: set_params:1358: Channels count non availableWe fixed this by converting the file to stereo:
sudo apt-get install sox
sox /usr/share/sounds/alsa/Front_Center.wav -c 2 /tmp/Front_Center_stereo.wav
aplay -D hw:3,0 /tmp/Front_Center_stereo.wavThis resolved the issue.
Step 6: Disabling the Failing Service
Since the soundcard worked manually, we decided to disable the failing wm8960-soundcard.service:
sudo systemctl disable wm8960-soundcard.serviceWe relied on manual setup (ALSA configuration and /boot/firmware/config.txt) to manage the soundcard, which worked consistently after reboots.
Final Outcome and Observations:
Manual Configuration Works: After manually applying the device tree overlay and configuring ALSA, the WM8960 soundcard works correctly for both playback and recording.
Service Failure: The wm8960-soundcard.service consistently fails to apply the device tree overlay, resulting in exit code 99.