Moode Forum
[PROBLEM] Cirrus wm5102 Audio Card - Printable Version

+- Moode Forum (https://moodeaudio.org/forum)
+-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3)
+--- Forum: Support (https://moodeaudio.org/forum/forumdisplay.php?fid=7)
+--- Thread: [PROBLEM] Cirrus wm5102 Audio Card (/showthread.php?tid=3160)

Pages: 1 2


Cirrus wm5102 Audio Card - jonsom - 11-15-2020

Not sure whether this topic has been addressed before, a quick search didn’t return any relevant posts; new forum member and first post so apologies if the topic has already been addressed elsewhere.

Trying, but failing to get Moode Audio working with a Wolfson/Cirrus wm5102 audio card, I know it’s obsolete but I have one, and am pleased with the sound quality; there is even built in Linux kernel support these days.

I am currently attempting to re-purpose an existing Pi & Sound Card I’ve had knocking about for a few years by adding a touch screen. After trying a few alternatives decided that Moode Audio appeared the best for a stand-alone system. On the plus side it was easy to get it to access the NAS where my music collection is stored and I liked the user interface, which whilst maybe a bit quirky, looked pleasant, was fairly easy to use and appeared to render my library contents correctly, so +++.
It’s just that I’m just failing to get sound of the system; rather strange since as I understand the system, MPD is responsible for sound rendering.

As far as I could see the Cirrus card was not listed/supported as an I2S audio device within the Moode Audio GUI.

Is the Cirrus card supported under a different name?
Or is there some way to support the settings to /boot/config.txt (dtoverlay) & /etc/mpd.conf (Audio_Output declaration) that are required to make the card available and work with MPD respectively retained over restarts?

I had the Cirrus card working with the current and preceding versions of Raspbian using the music player daemon (MPD); and Cantata and other MPD based players, even managed to download and rebuild the latest version of MPD to work with Rasbian. Was therefore a bit disappointed that Moode Audio, which as far as I understand things layers on top of MPD, doesn't appear to allow my setup.

P.S. did notice in another thread that only cards where the manufacturer provides a card and an interface person contact can be supported, clearly that ain’t going to happen for my legacy/obselete cards.


RE: Cirrus wm5102 Audio Card - vinnn - 11-15-2020

If it works on Raspbian it should work on Moode as Moode is a distro built on Raspbian (now branded as Rasperry Pi OS).
I know you said you tried and failed but what did you try? Did you do the same as what you did in Raspbian?


RE: Cirrus wm5102 Audio Card - TheOldPresbyope - 11-15-2020

@jonsom

There's a driver in /boot/overlays which may work with your card: /boot/overlays/rpi-cirrus-wm5102.dtbo

What's needed in moOde is one more line in its sqlite3 database so this driver can be selected from the WebUI.

The database file is /var/local/www/db/moode-sqlite3.db

The DAC data table is cfg_audiodev

Here's the first two lines from the section of the /var/local/www/db/moode-sqlite3.db.sql file used to create this table and populate it:

Code:
CREATE TABLE cfg_audiodev (id INTEGER PRIMARY KEY, name CHAR (64), alt_name CHAR (64), dacchip CHAR (64), chipoptions CHAR (64), iface CHAR (32), list CHAR (10), driver CHAR (64), drvoptions CHAR (64));
INSERT INTO cfg_audiodev (id, name, alt_name, dacchip, chipoptions, iface, list, driver, drvoptions) VALUES (1, 'Allo Boss DAC', '', 'Burr Brown PCM5122', '100,0,FIR interpolation with de-emphasis', 'I2S', 'yes', 'allo-boss-dac-pcm512x-audio', 'slave');


I extrapolate from this you'll need to execute an sql command similar to 

Code:
INSERT INTO cfg_audiodev (id, name, alt_name, dacchip, chipoptions, iface, list, driver, drvoptions) VALUES (75, 'Wolfson Cirrus WM5102', '', 'Cirrus Logic WM5102', '', 'I2S', 'yes', 'rpi-cirrus-wm5102', '');

where '75' is just the available next I2S dac entry and I guessed the rest. YMMV.

Sorry, I have to run. Others can fill in how to do this insertion from the command line if you're not familiar with sqlite3.

Regards,
Kent


RE: Cirrus wm5102 Audio Card - Sniglar - 11-15-2020

I have a couple of the old Wolfson wm5102 cards on a Raspberry Pi 1B boards.

The Moode one is currently working on Moode 6.4.2

Here's the driver info I use to get them working:

https://www.horus.com/~hias/cirrus-driver.html

....just to add that within my working Moode/Wolfson unit the I2S Audio Device is left on "None"


RE: Cirrus wm5102 Audio Card - TheOldPresbyope - 11-15-2020

@jonsom

I'm back.

To follow up on my previous post, one could enter the new row in the cfg_audiodev table interactively after firing up sqlite3 from the command line

Code:
sudo sqlite3 /var/local/www/db/moode-sqlite3.db

then cut and paste the INSERT statement into the command line. This interactive session can be ended with a ".exit" command.

Or, one could execute the single sqlite3 command in one shot

Code:
sudo sqlite3 /var/local/www/db/moode-sqlite3.db "INSERT INTO cfg_audiodev (id, name, alt_name, dacchip, chipoptions, iface, list, driver, drvoptions) VALUES (75, 'Wolfson Cirrus WM5102', '', 'Cirrus Logic WM5102', '', 'I2S', 'yes', 'rpi-cirrus-wm5102', '');"

In either case, I'd make a backup copy of the database file first.

I have no idea what driver options, if any, have to be dealt with.

Regards,
Kent


RE: Cirrus wm5102 Audio Card - jonsom - 11-15-2020

Thank you Vinn, Kent & Sniglar for taking time to reply to my query I found your respective suggestions of interest, I had sort of run out of ideas/expertise.
I will attempt both solutions in turn and update on any progress.

The driver: /boot/overlays/rpi-cirrus-wm5102.dtbo is the one that I normally use, or at least I assume I use it when I add the DTOVERLAY command line specifying rpi-cirrus-wm5102 in /boot/config.txt.



Thank you Kent for the follow up reply, I am indeed unfamiliar with sqlite3 but will have a go anyway.
regards Jon


RE: Cirrus wm5102 Audio Card - Sniglar - 11-15-2020

@jonsom

I usually only use the "Playback_to_Lineout" mixer script from the driver website (in my post above) but I noticed this headphone output script is missing from the website.

Code:
./Playback_to_Headset.sh



RE: Cirrus wm5102 Audio Card - Sniglar - 11-17-2020

@jonsom

I have upgraded to Moode 6.7.1 on the RPi 1B/Wolfson WM5102 but it needed an extra step in the Moode GUI to get sound output.

I followed the instructions from the driver website and after starting the appropriate scripts (e.g. ./Playback_to_Lineout.sh) and going through the  "Optionally: use fixed card number" procedure, I had to go into the Moode GUI/M/Configure/Audio/Edit MPD Config and select RPi-Cirrus from the Audio Device/Audio Output drop down. The I2S Audio Device in Audio Config is still left as "None".


RE: Cirrus wm5102 Audio Card - jonsom - 11-18-2020

(11-17-2020, 06:41 PM)Sniglar Wrote: @jonsom

I have upgraded to Moode 6.7.1 on the RPi 1B/Wolfson WM5102 but it needed an extra step in the Moode GUI to get sound output.

I followed the instructions from the driver website and after starting the appropriate scripts (e.g. ./Playback_to_Lineout.sh) and going through the  "Optionally: use fixed card number" procedure, I had to go into the Moode GUI/M/Configure/Audio/Edit MPD Config and select RPi-Cirrus from the Audio Device/Audio Output drop down. The I2S Audio Device in Audio Config is still left as "None".

Thank you Sniglar for the update, up to now I have tried the approach suggested by Kent (TheOldPresbyope), updating the configuration database. It sort of worked, in that I could see the Cirrus card listed as an I2S option. On selecting that option the Moode Audio software did generate the appropriate dtoverlay addition to /boot/config.txt, but on re-start the system crashed out leaving it at a terminal interaction session (i.e. keyboard and HDMI of Pi).

Restoring the original configuration database enabled the system to complete start-up. Then leaving I2S at none (Cirrus no longer being present) found I could select it in → Configure → Audio → Edit MPD Config. After doing this and re-starting caused the system to bring up an error box, I think reporting an error generated by MPD related to ALSA something like “no such device”.

Looking at the 'audio_output' setting the Moode Audio system generates in the /etc/mpd.conf file I could see that it was not complete enough to enable MPD to work with the Cirrus card, at least with the latest Pi O/S and Linux kernel 5.4.72.

I did a bit of investigating and found that with Pi O/S and Linux kernel version 4.19.50, MPD appeared to work the Cirrus with most of the audio_output parameters left at default (as Moode Audio appears to do), but with 5.4.72 I had to provide values for ‘device’, ‘mixer_device’ and ‘mixer_control’.

I did notice that one of the fields for entries in the 'cfg_audiodev' database entries is ‘drvoptions’ and wondered whether that might be the method providing the facility to enable setting the additional 'audio_output' parameters (may investigate that next)

Out of interest the 'audio_output' setting in /etc/mpd.conf I found worked with MPD and latest Pi O/S + Linux kernel 5.4.72 was:
          (-- are my local comments for information here and are not in the mpd.conf file)
audio_output {
            type                “alsa”
            name              “My ALSA Device”                             --  didn’t appear important
#         mixer_type      “hardware”         # optional
           device               “hw:0,0”                                         --   was 2,0 if Pi’s on board audio enabled
           mixer_device     “hw:0” – again 2 …
           mixer_control    “Speaker Digital”                             --   name found using alsamixer utility
#        mixer_index       “0”                    # optional
}

So a couple of things to try, I’ll have a go at configuring a 6.7.1 system as Sniglar suggested.
...then perhaps, just out of interest, look into potential use of ‘drvoptions’ configuration database fields...


RE: Cirrus wm5102 Audio Card - TheOldPresbyope - 11-18-2020

FYI, some basic driver stuff is located in the Raspbian Linux source tree (https:/github.com/raspbian/linux) at

Code:
kreed@T520:~/repos/linux$ find . -name wm5102\*
./sound/soc/codecs/wm5102.c
./sound/soc/codecs/wm5102.h
./drivers/mfd/wm5102-tables.c

Without the card or decent documentation in hand, I can't add anything more.

Good hunting.

Regards,
Kent