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


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

Further to my previous post, just completed fresh install, essentially followed steps suggested by Sniglar except skipped stage of fixing card numbers, and finally it’s working, so on to next stage of moving to touch screen user interface. Decided not to bother looking at drvoptions ..err.. option as that area is outside my skill level.

Still a little concerned, prior to trying Moode Audio, I had a Pi/Cirrus/MPD/NAS system working as a ‘headless’ server running MPD clients on phone & tablet that was working with the minimal audio_output setting (as Moode Audio uses). It all still worked with the minimal MPD audio_output parameter setting after I had upgraded to the latest version of Pi O/S in October but found out that I needed to select device 2 instead of 1 (Pi O/S being reconfigured to show on Pi’s on board HDMI & Headphone as separate cards in the latest version). Then earlier this month re-installed Pi O/S after trying a few potential media servers/music players and couldn’t get MPD to play unless I did the fuller audio_output specification detailed in my preceding post.

So there’s something odd somewhere, maybe some sort of software race and/or stored/preserved data setup problem, anyway, experience tells me that such failings don’t go away, just re-appear sometime in the future, maybe after some other un-related quite innocuous change, oh well time will tell.

For now happy to resume adding touch screen user interface and if that all works, will package it all up in a more house-trained style, job done.

Thank you to Sniglar and Kent (TheOldPresbyope) for your assistance in this topic


RE: Cirrus wm5102 Audio Card - keldo - 05-27-2021

Hi.
I have 3 RPi audio players build around Element14 Cirrus / Wolfson audio cards, with Pi 2, 3 and 4 respectively as base computer.
I used to run those with Volumio and some simple config hacks to enable the Wolfson card, but I would like to shift to Moode Audio for various reasons.
I'm using my Pi4 box, which also has a 7" official RPi touchscreen, as test for Moode ; I started with version 7.0.x and, as some others, I could get some sound out of the Wolfson card by manually hacking the RPi config files as explained by "Horus" on his driver page, but hardware volume control doesn't work and any re-config on Moode may ruin the MDP config and stop the sound. Not Practical.
Then I tried to edit the configuration DB file of Moode to add the needed "I2S" config line for the Wolfson card ... and all I succeed to do is to prevent the Web GUI of Moode to load, stuck at the CLI level on the screen.
I tried with manual DB commands on a running Moode player and also from a fresh - never run - new Moode image by using an external DB editor . None worked correctly.  There must be some DB revision number checking system built into some parts of Moode ?

I was expecting a lot of good things from version 7.1.x with the support of "foreign I2S drivers" somewhat promised, so I made the upgrade ... but I cannot see the Cirrus-RPi overlay in the list of I2S drivers, so no luck.  :-(

So, I am wondering if anyone knows how the configuration DB of Moode can be modified properly without breaking things, in order to test other I2S drivers & cards ?

One way I did not test yet is to delete a "Moode Approved" I2S overlay file and rename the RPi-Cirrus overlay by the name of this deleted file ... but that would be a very ugly hack. Maybe worth trying anyway, just to have a look at other possible issues (MPD config, for exemple).


RE: Cirrus wm5102 Audio Card - Tim Curtis - 05-27-2021

The DT overlay list in Audio Config is genereted by the PHP function below which corresponds to the -o option in the moodeutl command. There is no preference being applied. It just lists all the audio overlays in kernel directory /boot/overlays.

Code:
function list_audio_overlays () {
    $dir = '/boot/overlays/';
    $files = scandir($dir);

    foreach ($files as $file) {
        $contents = file_get_contents($dir . $file);
        if (strpos($contents, 'sound-dai-cells') !== false) {
            echo $file . "\n";
        }
    }
}

Audio overlay files should contain the string 'sound-dai-cells'.

Whats the name of the overlay for the Wolfson card?


RE: Cirrus wm5102 Audio Card - keldo - 05-27-2021

This is the line that need to be added to the /boot/config.txt :
Code:
dtoverlay=rpi-cirrus-wm5102
So I expect the file to be : /boot/overlays/rpi-cirrus-wm5102.dtbo


N.B. : Full instructions given here : https://www.horus.com/~hias/cirrus-driver.html#installation


RE: Cirrus wm5102 Audio Card - TheOldPresbyope - 05-27-2021

@keldo

That overlay file is present. However, it is the only audio driver out of nearly 50 which doesn't contain the comment string "sound-dai-cells". I don't know anything about the requirements for an audio overlay file so I'll creep back into my cave at this point.

Regards,
Kent


RE: Cirrus wm5102 Audio Card - Tim Curtis - 05-27-2021

The file is in /boot/overlays but it doesn't contain the string 'sound-dai-cells'. That explains why it's not in the dropdown list.

I'll add an 'or' clause to the function so it shows up in the list in upcoming 7.3.0 release. If you want to add it yourself now then edit /usr/local/bin/moodeutl and change the 'if' statement in the function.

Code:
from...
       if (strpos($contents, 'sound-dai-cells') !== false) {

to...
    if (strpos($contents, 'sound-dai-cells') !== false || $file == 'rpi-cirrus-wm5102.dtbo') {

Then it will appear in the list.

Code:
pi@rp2:~ $ moodeutl -o
adau7002-simple.dtbo
akkordion-iqdacplus.dtbo
allo-boss-dac-pcm512x-audio.dtbo
allo-boss2-dac-audio.dtbo
allo-digione.dtbo
allo-katana-dac-audio.dtbo
allo-piano-dac-pcm512x-audio.dtbo
allo-piano-dac-plus-pcm512x-audio.dtbo
applepi-dac.dtbo
audioinjector-addons.dtbo
audioinjector-isolated-soundcard.dtbo
audioinjector-ultra.dtbo
audioinjector-wm8731-audio.dtbo
audiosense-pi.dtbo
dionaudio-loco-v2.dtbo
dionaudio-loco.dtbo
draws.dtbo
fe-pi-audio.dtbo
ghost-amp.dtbo
googlevoicehat-soundcard.dtbo
hifiberry-amp.dtbo
hifiberry-dac.dtbo
hifiberry-dacplus.dtbo
hifiberry-dacplusadc.dtbo
hifiberry-dacplusadcpro.dtbo
hifiberry-dacplusdsp.dtbo
hifiberry-dacplushd.dtbo
hifiberry-digi-pro.dtbo
hifiberry-digi.dtbo
i-sabre-q2m.dtbo
iqaudio-codec.dtbo
iqaudio-dac.dtbo
iqaudio-dacplus.dtbo
iqaudio-digi-wm8804-audio.dtbo
justboom-both.dtbo
justboom-dac.dtbo
justboom-digi.dtbo
max98357a.dtbo
mbed-dac.dtbo
merus-amp.dtbo
pibell.dtbo
pifi-40.dtbo
pisound.dtbo
rpi-cirrus-wm5102.dtbo
rpi-dac.dtbo
rpi-proto.dtbo
rra-digidac1-wm8741-audio.dtbo
superaudioboard.dtbo
tc358743-audio.dtbo
udrc.dtbo
pi@rp2:~ $



RE: Cirrus wm5102 Audio Card - keldo - 05-27-2021

Thanks Tim, modifying the moodeutl script indeed allows to list and enable the right overlay.

To get a working Cirrus/Wolfson card, there are 2 more steps, which I manually did via SSH :
- adding a "/etc/modprobe.d/cirrus.conf" file (with the right content "softdep arizona-spi pre: arizona-ldo1")
- adding the configuration scripts for the card (http://www.horus.com/~hias/tmp/cirrus/cirrus-ng-scripts.tgz) somewhere useful - I chosed /usr/local/bin - and running one of them at choice to enable an output.

Then, after a reboot, I could listen to some music.  Great ! ... and thanks for the quick reaction.


Now, there are some more steps to go before we can reach a "production grade" support of this audio card :
1) Pack the needed files with the base image of Moode (if the author of the driver - Hias - is OK with that ...) or find a way to automatically download and install them when the rpi-cirrus-wm5102 overlay is selected.
2) Find a nice way to select/enable the different outputs (SPDIF out, Line out, Speakers, Headphones) from the GUI
3) Explain to MPD how to use the different hardware volume controls available in the card
4) Optionnaly, make some useful use of the different inputs available (SPDIF in, Line in, etc.)
5) Adding the card to the DB of know I2S cards in Moode would be nice too.

I'm willing to help for those steps if I can get some initial directions.
Note : I used to be a programmer 25 years ago, but I'm an absolute beginner when it comes to Python.


RE: Cirrus wm5102 Audio Card - Tim Curtis - 05-27-2021

That would be a major work effort, even more work than doing the Hifiberry and Audiophonics devices that have switchable inputs.

My backlog of TODO's is already a mile long so maybe a dev will become interested and volunteer their time and effort to do this and create a PR.


RE: Cirrus wm5102 Audio Card - keldo - 05-27-2021

Point 1) Is probably a quick task (copy of a few files).

Point 3) Is a little bit of test/trials and errors but does not requires very special competencies ... except beeing the owner of a Cirrus card to make the tests, of course.  Exactly something I could do if I know how/where to tweak the settings that Moode send to MPD.

Points 2) and 4) are somewhat linked, as a specific interface must be developped in the GUI to configure inputs and outputs.
This is where the major work is I suppose but, if designed correctly, it can be reused for all the cards with multiple inputs and/or outputs.
If the GUI part is made generic, the card specific settings could be specified into individual "scripts library" files wearing the same name as the overlay file for any given card.
That way, in the moode DB file, the table with the different I2S cards just needs 2 additional numeric fields : "number of outputs" and "number of inputs" ; if value is "0" (for inputs) or "1", the GUI page for selection is disabled, if the value is superior then the selector page is enabled and the names of the inputs/outputs can be found at the beginning of the "script library" files.
By using those separate "scripts library", anyone with such a card could write and test the scripts for his own type of card - based on a skeleton file - and easily contribute back when the scripts are working well.
Another complex part is probably the link with MPD settings if each output has a separate hardware volume mixer name, but if a framework is given, it could maybe be treated like point 3 ?
... Well , this is just a quick and dirty analysis.
And yes there are probably dozens of other todo's and nice feature requests already waiting.  (DAB+ radio with integration of Welle.io would be top for example !   Tongue  )  

Point 5) : No idea about the quantity of work involved into this point, but I suppose it is not massive once other points have been fixed.


Now, there is maybe a "not so nice" but probably easier way to use cards with multiple outputs : to configure multiple entries for the same card into the "I2S cards" table of the DB, with differents settings depending on the output enabled ; so for the Cirrus/Wolfson card, it would mean 4 different DB entries (for SPDIF, Line Out, Headphones and Speakers), each with specific settings for the MPD mixer and, possibly, calling an (existing) specific setup script to activate the right output (only needed once).
A little bit dirty, but this would not require any change in the GUI part nor any heavy developement I suppose.


That said, I'm listening to some nice Jazz Streaming Radio via Moode and the Cirrus card for more than an hour now ...   it is already a pleasure !


RE: Cirrus wm5102 Audio Card - Tim Curtis - 05-27-2021

Something odd. Every time you post to this thread I get a PM. If its a setting on your end please turn it off :-)