Update for Wolfson Audio Card ( on Raspberry Pi)

Hi,

this is just an update for those who use the older Wolfson Audio Card. You can download it here or simply fire up your Raspberry Pi and install it directly. The kernel sources are from Cirrus Logic’s 3.12.33 kernel. This kernel is patched with the realtime preemption patches from https://www.kernel.org/pub/linux/kernel/projects/rt/ So now you should have a realtime linux system running on your Raspberry Pi for making LIVE MUSIC or other things.

THIS WON’T WORK FOR THE NEW RASPBERRY PI 2!

The kernel is running on a standard Raspberry Pi Debian Wheezy image  2015-02-16 which you can download from http://www.raspberrypi.org/downloads/

On Raspberry Pi, open a shell and type

wget https://blog.georgmill.de/wp-content/uploads/2015/02/linux-image-3.12.33-rt47-georg_3.12.33-rt47-georg-1_armhf.deb

Then install it with

dpkg -i linux-image-3.12.33-rt47-georg_3.12.33-rt47-georg-1_armhf.deb

sudo mv /boot/vmlinuz-3.12.33-rt47-georg /boot/kernel-rt-georg.img

Thanks for Ragnar Jensen’s patch for memory mapped I/O support to the Wolfson/Cirrus card.

A slightly modified version of this patch can be found here.

Change boot options in /boot/config.txt with

sudo nano /boot/config.txt

and change OR add this line:

kernel=kernel-rt-georg.img

Open  /etc/modules  with

sudo nano /etc/modules

and change OR add these lines:

spi-bcm2708
i2c-bcm2708
arizona-spi
snd-soc-wm5102
snd-soc-pcm5102a
snd-soc-wm8804
snd-soc-rpi-wsp
snd-soc-rpi-wsp

bcm2708-rng
snd-bcm2835
gpio_arizona
arizona_micsupp
snd_soc_bcm2708_i2s
snd-soc-arizona
snd-soc-wm-adsp
snd-soc-wm5102
snd-soc-rpi-wsp

Open /etc/modprobe.d/raspi-blacklist.conf with

 

 

66 Gedanken zu „Update for Wolfson Audio Card ( on Raspberry Pi)

  1. Georg: Thank you very much for explaining how to update software for the Wolfson card on the Raspberry Pi. I will try your instructions soon.
    I found that my Wolfson card wouldn’t work after I did a update and an upgrade, and the I discovered your instructions.
    My questions are:
    1. You refer to the „older Wolfson Card“. I bought mine in about June of 2014. Would you know whether it is an older card or a current card?
    2. Are all the steps in your instructions necessary? That is, do I need to change the boot options or can I skip the boot options steps?
    Thanks in advance.
    Charles Young

  2. What does the download mentioned in this sentence do for me?
    What should I do with it?
    „this is just an update for those who use the older Wolfson Audio Card. You can download it here or simply fire up your Raspberry Pi and install it directly.“
    Thanks again
    Charles Young

  3. Hi Charles,
    you may install it on a raspberry pi version 1 b/1 a+/1 b+ to get the Wolfson or Cirrus audio card working with a kernel version 3.12 that was newer than that was provided by Cirrus Logic at that time (which was 3.10) when I posted it in my blog. Additionaly this kernel is a realtime preemtible one. You can read more about realtime preemption on https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO.
    You normally do not need that, but I needed it for getting my midi software running on a raspberry pi 1b with the Wolfson Audio Card. With that kernel I was able to make live music on the pi.
    Nowadays Cirrus has swallowed Wolfson and the kernel version is now 3.18. They put their kernel source on github where you can find a description on how to compile it yourself ->
    https://github.com/CirrusLogic/rpi-linux/wiki/Building-the-code.
    This is the bare kernel source without realtime preemption which should be o.k. for all those who aren’t involved in making live music or flying around with drones or other things that depend on realtime interaction with the pi.

    Hope that helps.
    Georg

  4. Hi Charles,
    you have to ask Cirrus Logic. Normally they should have done that kind of support earlier. A lot of people waited for an update of the source code (especially their drivers for the card). Now they did it and things start working as they should. It doesn’t matter if you own an older Wolfson or a newer Cirrus Card, as the software is equal for both variants. I would even be able to provide a rt-kernel for the newer Pi 2b, but I don’t own such a device, so there is no need for me to struggle arround with that. It‘ Cirrus‘ job to do that. And now they do it and everything should be fine 😉

  5. Hi Georg
    I’m wondering whether your update is likely to work with the current Wheezy distro 2015-05-05? I have Wolfson 3.10 running on a B. I wanted to play with something ‚guaranteed‘ to work. Now I’ve got samba making the recorded files available on my network and a working knowledge of the WM audio chip, I’d like to get it up to date.

    I note that there’s a white noise generator in the chip. It may be possible to get rough ideas of what coefficients to use for filters by routing the WN gen thorugh the EQ , tweaking the EQ , and seeing what results. A spectrum analyser on the output should reveal the -3db point.

    Also, I noticed you were working on a ‚mixer‘. Please let me know where your lastest developments can be found.

    Lastly, my Wolfson card lay unused for over a year until I found your and Ragnar’s meticulous contributions. It was only when I worked through them that I could see light at the end of the waveguide. Many, many thanks for your efforts. Outstanding!!

    Thanks again, Conor.

  6. Hi Conor,
    the kernel should work on Wheezy distro 2015-05-05. My Card is the same as yours and so is the RPI (it’s a „B“). There are some other people working on a mixer. I personally do everything with „alsamixer“ which does the job on the command line. It’s not comfortable but it works. To get your solution just build a chain from the white noise generator to the deired inputs (EQ or whatever) and output it again to audio out. Have a look at the datasheet to get an impression of all possibilities (see e.g. http://files.linuxgizmos.com/wolfson_wm5102_block.jpg or this http://www.farnell.com/datasheets/1803925.pdf

    For using EQ here is a simple example -> http://www.element14.com/community/thread/37660/l/example-use-of-eq-on-playback
    Just route the whitenoise signal into it and you’re done.

  7. Hi Georg
    I followed the above to the letter and it all appears fine, I only get one warning related to ‚cgroups‘. However I cannot test the card because I cannot find any use scripts. My own scripts, previously perfect, won’t run at all.

    I think I have been naive, I thought I was simply setting up the Wolfson for use with the latest Wheezy (with a blizzard of tweaks to enable rt) but I guess that much has been stripped out.

    Please let me know whether the card should operate as before (with 3.10) though incredibly enhanced by your hard work, or if that previous functionality has been removed.

    Right now I’m assuming my script problem is my own fault, but I cannot tell for sure what should work and what should not. What I really need to know is whether bash scripts should still work.

    Sorry to waste your time.

    Thanks , Conor.

  8. Hi Georg
    The fault was entirely down to my scripts. I won’t elaborate. Right now it’s doing everything I wanted of it, and I’m ecstatic. A thoroughly up to date pi, with radically expanded capability and plenty less bloat. Chuckle.

    I learned a great deal doing this, particularly from the mistakes I made. (Yes, it’s worth remming out bcm2835 in /etc/modules. It simplifies everything). I am in your debt, many thanks for your time. If you ever need an analogue multitrack or some ancient esoteric pro audio gear repaired, please let me know.

    Thanks again, Conor.

  9. Thanks for your offer. I do not own ancient esoteric pro audio gear. I am not esoteric in any way at all. Some people (like you) seem to think that. But maybe that’s only because they don’t know anything about me at all 😉

  10. Georg – Brilliant – Thank You! I wanted to get the Wolfson card working to be able to use Pi Musicbox. Followed your instructions and everything worked first time.

    I do get a couple of error messages when a stream starts:

    arizona spi0.1: FLL1: Timed out waiting for a lock
    bcm2708-i2s.0: I2S SYNC error!

    but neither seem to cause any problem as everything seems to play OK as does software volume control from Musicbox.

    Thanks again for such comprehensive instructions.

  11. Hi,
    I had downloaded newest raspbian from raspberry website. Should I follow the above steps so that my gstreamer should work if I want to execute it from sudo.

  12. Don’t use sudo when using gstreamer. It’s a strong security risk. Gstreamer should work with my kernel, but there is a more recent development on the rt kernel available on the Cirrus Logic Wesite for the Wolfson and Cirrus cards. Search for rt kernel or realtime kernel, please.

  13. Thanks for your reply,
    Actually I have an application in which I have to use gstreamer for receiving and sending audio on udp port and this application has to be executed at runtime i.e. whenever my piB+ boots up this application should also starts executing. Thats the reason I have to execute gstreamer using sudo. Any suggestions

  14. Hi Georg,
    Your steps is really great it helped me a lot.
    I have another query if I upgrade my board after following your steps I can see snd-raspi in alsamixer however If i upgrade it it won’t show. Why?

  15. Georg
    You mistake me , I offer that service because it is the only one I can offer , having been doing it professionally since 1984 , not because I claim to know anything about you .

    Thanks again .

  16. Hi Georg,
    Thanks for your reply,
    kernel it shows after uname -r is: 3.12.33-rt47-georg.
    However, after few hours or so if I check alsamixer it shows bcm2835 ALSA not snd_rpi_wsp. I checked the kernel version it is still 3.12.33-rt47-georg. I have to delete all files in /boot related georg and follow the first step. Then it shows snd_rpi_wsp.
    Why it is behaving like this.
    I am using 2014-12-24-wheezy-raspbian.img
    Kindly help me out

  17. O.k. Sorry for that misunderstanding. But I really do not have anything to do with esoteric things in particular or in common.

  18. aplay -l
    should say

    Card 0: sndrpiwsp [snd_rpi_wsp], device 0: WM5102 AiFi wm5102-aif1-0 []
    Subdevices: 1/1
    Subdevice #0: subdevice #0

    otherwise there is something wrong with your setup. Please check if the kernel modules for bcm2835 ALSA are started at boot. If so, disable them by adding
    snd-bcm2835 to /etc/modprobe.d/raspi-blacklist.conf

  19. Good morning Georg.
    I have been using the Moode 1.8 player and installed the ‚patch‘ for wolfson on RPi 1 provided by your kind self.
    The system works wonderfully.
    The recent Moode is 2.0 and the default kernel is 3.18.
    Kindly advise whether the same patch would work with Moode 2.0.
    Thank you very much.

  20. Nvm! I got the scripts! Thanks fo such an excellent job! Everything’s working as intended 🙂

  21. Just open a shell and type it in as root. It will autoconfigure the card so you can plug in your headphone into the black 3.5 mm jack (4-pole) for a headset/boom mic combination.
    After that you should be able to listen to your desired sound 🙂
    This answer came too late but is inteded for those who have the same question.

  22. Hi Georg!
    I’ve just installed the new kernel and everything works, so congratulations!
    But I installed it because of the realtime thing, I made a code to equalize audio and when I make an aplay|arecord from DMIC there is the same delay that there was in the other kernel, do I have to do something else?
    Thanks!

  23. Thanks for answering.
    I just made an app using Qt Creator where I change the values of the EQs using terminal instructions like „amixer -Dhw:0 cset name=’EQ1…“.

    This is the config I have:

    amixer -Dhw:0 cset name=’LHPF1 Input 1′ AIF1RX1
    amixer -Dhw:0 cset name=’LHPF1 Mode‘ 0
    amixer -Dhw:0 cset name=’LHPF1 Coefficients‘ 243,26
    amixer -Dhw:0 cset name=’LHPF3 Input 1′ AIF1RX1
    amixer -Dhw:0 cset name=’LHPF3 Mode‘ 1
    amixer -Dhw:0 cset name=’LHPF3 Coefficients‘ 243,26

    amixer -Dhw:0 cset name=’LHPF2 Input 1′ AIF1RX2
    amixer -Dhw:0 cset name=’LHPF2 Mode‘ 0
    amixer -Dhw:0 cset name=’LHPF2 Coefficients‘ 243,26
    amixer -Dhw:0 cset name=’LHPF4 Input 1′ AIF1RX2
    amixer -Dhw:0 cset name=’LHPF4 Mode‘ 1
    amixer -Dhw:0 cset name=’LHPF4 Coefficients‘ 243,26

    amixer -Dhw:0 cset name=’EQ1 Input 1′ LHPF1
    amixer -Dhw:0 cset name=’EQ2 Input 1′ LHPF2
    amixer -Dhw:0 cset name=’EQ3 Input 1′ LHPF3
    amixer -Dhw:0 cset name=’EQ4 Input 1′ LHPF4

    #amixer -Dhw:0 cset name=’EQ3 Input 1 Volume‘ 24
    #amixer -Dhw:0 cset name=’EQ4 Input 1 Volume‘ 24

    amixer -Dhw:0 cset name=’HPOUT2L Input 1′ EQ1
    amixer -Dhw:0 cset name=’HPOUT2L Input 2′ EQ3
    amixer -Dhw:0 cset name=’HPOUT2R Input 1′ EQ2
    amixer -Dhw:0 cset name=’HPOUT2R Input 2′ EQ4

    I use the Line out for the headphones and the DMIC like input and when I want to start I do:

    system(„arecord -Dhw:0 -r 44100 -c 2 -f S32_LE | aplay -Dhw:0 -r 44100 -c 2 -f S32_LE &“);

    I can hear everything equalized but with an almost one second delay.

    Thanks!

  24. Hi Alejandro,

    maybe
    ecasound -B:rtlowlatency -b:128 -f:s32_le,2,44100 -i:alsahw,0,0 -o:alsa,join
    does the trick (untested).
    To get his running you have to install it with
    sudo apt-get install ecasound first.
    Please report here if it works.

  25. Thanks Georg,
    I installed the ecasound, after launched the $ ecasound -B:rt….
    And an error appeared!

    **************************************************************************
    * ecasound v2.9.0 (C) 1997-2012 Kai Vehmanen and others
    **************************************************************************
    (eca-chainsetup-parser) Buffering mode ‚rtlowlatency‘ selected.
    (eca-chainsetup-parser) Setting buffersize to (samples) 128.
    (eca-chainsetup) Chainsetup „untitled-chainsetup“
    (eca-chainsetup) „rtlowlatency“ buffering mode selected.
    (eca-chainsetup) Opened input „alsahw“, mode „read“. Format: s32_le,
    … channels 2, srate 44100, interleaved.
    ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM join
    ERROR: Connecting chainsetup failed: „Enabling chainsetup: AUDIOIO-ALSA:
    … Unable to open ALSA-device for playback; error: No such file or
    … directory“

    After this I tried to execute my code and it worked like before.
    Thanks

  26. The problem is that some other program/process seems to be using the alsa audio I/O already.
    … Unable to open ALSA-device for playback; error:
    So, first of all you should find out which process (program) is doing that with
    lsof /dev/snd/*
    or
    fuser -v /dev/snd/*
    I could swear it is pulse audio. Stop pulse audio with
    sudo killall pulseaudio
    or remove it completely with
    sudo killall pulseaudio
    sudo apt-get purge pulseaudio pulseaudio-utils gstreamer0.10-pulseaudio libpulse-browse0 paman pavumeter pavucontrol
    sudo mv /etc/asound.conf /etc/asound.conf-bak
    rm ~/.pulse-cookie
    rm -r ~/.pulse


    Reboot and try again.

  27. Thanks for your time Georg.

    Nothing of that worked. With lsof… and fuser… nothing appeared, and I dont have pulse audio installed.
    I just installed the Raspberry Pi Debian Wheezy image 2015-02-16 you said and followed your instructions.
    If you realise, it says „error: No such file or directory“I dont know if thats important.
    Now I am playing with ecasound but with no success.
    Thaks

  28. Worked! I changed the line
    ecasound -B:rtlowlatency -b:128 -f:s32_le,2,44100 -i:alsahw,0,0 -o:alsa,join
    for
    ecasound -B:rtlowlatency -b:128 -f:s32_le,2,44100 -i:alsahw,0,0 -o:alsahw,0,0,join
    and now I am enjoying a perfect real time system!
    Thank you so much!!

  29. Hi, I write this little GUI utility to interconnect input/output devices thru dynamic range controllers and low pass filters. It’s in very early stage and doesn’t load current connections of alsamixer, but you could connect the out of the DMICs to LineOut, LHPF, DRC1,etc like in a mixer or patchbay by right-click and drag-n-drop or by selecting in their own menu.

    https://github.com/MrLinDowsMac/wolfson-patchbay-mixer

  30. Thanks for your time Georg, I really appreciate it.
    I owe you a beer, if you come to Spain you know 😉

  31. @Ian Nájar
    Some time ago I already found your sources on github but never downloaded nor tested it. But it seems to be a really good aproach to make things easy for people that are not so familiar with command line tools. Personally I prefer command line tools because they are scriptable and easier to use in networking environments. So, IOT (Internet Of Things) applications will grow in the near future and so I’ll stay with the alsa command line tools as they perfectly do what I want.

    Your GUI is worth a try, so this is only my personal lightweight opinion.

  32. Hi George,

    Great instructions!

    I want to use LIRC but don’t have any luck. There may be some confusion regarding using the old /etc/modules or the new dtoverlay settings in /boot/config.txt.

    I tried both but it doesn’t seem to work.

    Do you have any suggestions on how to make this work?

  33. Hi Guus,
    my holidays ended yesterday so I’ll have a look at that problem tomorrow and let you know. Maybe you can post the problem exactly with error messages to make it easier and faster for us to get a solution. But I should mention that I do NOT give any offical support for the wolfson card nor am I involved in the business of Wolfson/Cirrus Logic. It’s my spare time I use for finding solutions and I do NOT get any money in any form from anybody for this. So feel free to use another card if you think LIRC is such an important feature for you. Why is it so important for you? Let me know, please.
    With best regards
    Georg

  34. Hi George,

    Whatever you find in my wikis I do in my spare time and free of charge. The origin is the Linn community: http://www.linn.co.uk. You can also check the forum there. Linn uses quite a bit of open source software to drive their Digital Streamers. Only the firmware is proprietary. Linn equipment lasts forever and therefore a lot of „Linnies“ have older equipment that does not incorporate digital streaming. A couple of people have worked on a solution based on the Raspberry Pi. Such a streamer will typically use the mediaplayer software : https://github.com/PeteManchester/MediaPlayer

    With this software you can control the streamer using open source or proprietary control points (Linn Kinsky, Kazoo and others). It integrates well with the real Linn equipment and supports multi-room.

    I have documented a streamer in my Wiki that allows to operate older Linn (or any other equipment) using IR. The Pi issues the command for the amp: ON/OFF, Volume, Source). This type of equipment is typically used as a second system in the house.

    I am using the Wolfson card with B&W MM-1 speakers and would like to control the speakers through the Raspberry Pi. Therefore I need LIRC.

    The error message:

    When I install LIRC correctly and then issue the following commands:

    sudo /etc/init.d/lirc stop
    mode2 -d /dev/lirc0

    I get an error message saying the device does not exist.

    With

    sudo /etc/init.d/lirc start

    I get error messages saying the device is not initiating. The directory actually does not exist (but should).

    I have tried LIRC control through /etc/modules and through DeviceTree, but the device does not initiate as expected.

    I understand you are not related to Wolfson, but since you have written a simple way for me to create an RPI with a Wolfson card that I can use with mediaplayer (it works and sounds very well!), I thought you may be able to shed some light on this issue.

    I have tried the official Wolfson image but when that did not allow me to ssh into the RPi from the start, I dropped that route. I much prefer your route.

    My „threat“ to use another card was of course not pointed towards you!!! I just hope some Cirrus-Logic people read your blog 😉

    Michelangelo at Volumio may soon also come up with the base for a solution. I would like to try his next version which is supposed to have a Real Time kernel.

    Thanks for your help. There is no real hurry, just a strong interest to solve this problem.

    Best wishes, Guus

  35. Hi Guus,
    the „threat“ you mentioned is something that I didn’t relate to me personally. The problem is that I just do not have the time to investigate a problem that is described so diffuse. The three lines

    sudo /etc/init.d/lirc stop
    mode2 -d /dev/lirc0

    I get an error message saying the device does not exist.

    are something that I can start with. So I’ll try to investigate that problem tomorrow. My prefered platform is the ODROID-C1+ now. So the time I spend for Raspberry has become rare. The Odroid-C1+ has a brand new HiFi DAC now which will arrive here in some days (I hope). My current project for the Maker Faire 2015 in Berlin is waiting for further development, too. But I’ll do my best to help you to get LIRC running.

  36. Thank you so much for this!

    Anyone using X11 and having the error: Unable to open ALSA-device for playback; you need to killall lxpanel.

    Cheers~

  37. Hi Patrick,
    thanks. If you ever have problems with accessing your soundcard/ALSA-device you can check with
    lsof /dev/dsp* /dev/audio* /dev/mixer* /dev/snd/*
    which process is already accessing your audio hardware and kill this process with
    sudo kill -9 PID # OF THAT PROCESS
    e.g.
    sudo kill -9 2279

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.