element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Cirrus Logic Audio Card working on the Raspberry Pi 2
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 165 replies
  • Subscribers 715 subscribers
  • Views 26896 views
  • Users 0 members are here
  • wolfson
  • raspberry
  • audio
  • pi
  • cirrus
  • raspberry_pi
  • rpi2
  • raspeberry_pi_accessories
  • pi2
Related

Cirrus Logic Audio Card working on the Raspberry Pi 2

e14 Contributor
e14 Contributor over 11 years ago

Hi all!

 

As you might know, Cirrus Logic's main kernel source branch recently switched to 3.18.

My first thought was "Hmm, that means the Cirrus Logic card could finally work on the RPi2..."

I have built a couple of 3.18 kernels for my B+ and RPi2 and I have managed to get both models to produce sound image

 

It's still early days, i.e. there are possibly bugs and glitches to fix, but for those of you who would like to try it out I've made an image file that you can download here:

https://drive.google.com/file/d/0BzIaxMH3N5O1cmJ1bFhMcG1hc0E/view?usp=sharing

The file is a 1.3 GB zip. Uncompressed size is 3.1 GB, so it fits comfortably on a 4 GB card.


The image is based on the standard 2015-02-16-raspbian-wheezy image from the Foundation that you flash to a SD card for a fresh install.

I have only added my kernels and set up the configuration files to get the card going.

It should work on the older B model  with a Wolfson Audio Card too, but I haven't tested that yet.

 

Have fun!

--

Ragnar

  • Sign in to reply
  • Cancel
  • hystrix
    hystrix over 11 years ago

    Many thanks Ragnar - I got this working with my Pi2 using the new image. image

     

    One thing I have noticed: the red and green LEDs are illuminated on the audio card until the first recording is started. Once recording has started, the red LED goes out and stays out. Previously, with the earlier kernel version and a Pi B+I think the red LED went out once the Pi had booted.  Not that it really matters, but it's just something I noticed.

     

    Many thanks once again for taking the time to do this.

     

    Update:  I spoke too soon. Now when I boot, I get the red and green LEDs, and both stay lit, and recording is not possible.  image  Some troubleshooting required....

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • e14 Contributor
    e14 Contributor over 11 years ago in reply to e14 Contributor

    Hi Ragnar,

    so far so good, I've tested it with an old Pi and an old card. aplay -l gives:

     

    aplay -l

    **** List of PLAYBACK Hardware Devices ****

    card 0: sndrpiwsp [snd_rpi_wsp], device 0: WM5102 AiFi wm5102-aif1-0 []

      Subdevices: 1/1

      Subdevice #0: subdevice #0

    card 1: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]

      Subdevices: 8/8

      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

      Subdevice #7: subdevice #7

    card 1: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]

      Subdevices: 1/1

      Subdevice #0: subdevice #0

     

    It seems the card is loaded correctly, but I can't get any sound out of it. Alsamixer is showing a lot of output options, umuting some of the does not help! I like to use the headphone out!

     

    Any suggestions?

     

    Thanks a lot, Thomas

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • e14 Contributor
    e14 Contributor over 11 years ago in reply to e14 Contributor

    Sorry,

    /home/pi/use_case_scripts./Playback_to_Headset.sh

     

    Did the trick!

     

    All running, great! Thanks a lot!

     

    Thomas

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • e14 Contributor
    e14 Contributor over 11 years ago in reply to e14 Contributor

    One additional question:

     

    If i like to activate a sound output, it is only necessary to run one of the use case scripts once, right! If I run all use case scripts once, are all output devices enabled then, or can only one output be activated at the same time?

     

    Thanks, Thomas

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • e14 Contributor
    e14 Contributor over 11 years ago in reply to e14 Contributor

    If i like to activate a sound output, it is only necessary to run one of the use case scripts once, right?

    Yes.

    If I run all use case scripts once, are all output devices enabled then?

    Yes.

     

    Furthermore, on Raspbian, the state of the sound card(s) is saved at shutdown and restored at boot by the /etc/init.d/alsa-utils script.

    --

    Ragnar

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • e14 Contributor
    e14 Contributor over 11 years ago in reply to e14 Contributor

    Hi Ragnar,

    perfect! Thanks a lot for your quick answer! So I have only to wait for my new Wolfson card to see if everything is working with the new card and the Pi 2. If yes, I'll support the Wolfson card in SqueezePlug soon!

     

    Thanks, Thomas

     

    P.S.: Do you have a hint for the right output level for headphone and lineout? I saw that the output level is very high, compared with other devices like HiFiBerry. And how to set the right values with a  shell command?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • e14 Contributor
    e14 Contributor over 11 years ago in reply to e14 Contributor

    Yes, the levels are hot. The reference level for 0 dB on Line Out is 0 dBV (1V RMS), whereas most consumer gear is -10 dBV (0.316 V RMS).

    This script is what I use most of the time to initialize the outputs. It's just the three standard "Playback_to..." scripts copy-and-pasted together.

     

    #!/bin/bash
    
    #Playback from RPi to Headset
    amixer -q -Dhw:sndrpiwsp cset name='HPOUT1 Digital Switch' on
    # Set path gain to -6dB for safety. ie max 0.5Vrms output level.
    amixer -q -Dhw:sndrpiwsp cset name='HPOUT1 Digital Volume' 116 # 96=-16dB. Volume control in 0.5 dB steps, -64dB to +32dB. Valid values 0-191. 128=0dB.
    amixer -q -Dhw:sndrpiwsp cset name='HPOUT1L Input 1' AIF1RX1
    amixer -q -Dhw:sndrpiwsp cset name='HPOUT1L Input 1 Volume' 32 # Input gain in 1 dB steps. -32dB to +12dB. Valid values 0-48. 32=0dB.
    amixer -q -Dhw:sndrpiwsp cset name='HPOUT1R Input 1' AIF1RX2
    amixer -q -Dhw:sndrpiwsp cset name='HPOUT1R Input 1 Volume' 32
    
    
    #Playback from RPi to LineOut
    amixer -q -Dhw:sndrpiwsp cset name='HPOUT2 Digital Switch' on
    amixer -q -Dhw:sndrpiwsp cset name='HPOUT2 Digital Volume' 128 # 108 = -10dB
    amixer -q -Dhw:sndrpiwsp cset name='HPOUT2L Input 1' AIF1RX1
    amixer -q -Dhw:sndrpiwsp cset name='HPOUT2L Input 1 Volume' 32
    amixer -q -Dhw:sndrpiwsp cset name='HPOUT2R Input 1' AIF1RX2
    amixer -q -Dhw:sndrpiwsp cset name='HPOUT2R Input 1 Volume' 32
    
    #SPDIF Playback: 
    
    amixer -q -Dhw:sndrpiwsp cset name='SPDIF out Switch' on
    amixer -q -Dhw:sndrpiwsp cset name='Input Source' AIF
    amixer -q -Dhw:sndrpiwsp cset name='AIF2TX1 Input 1' AIF1RX1
    amixer -q -Dhw:sndrpiwsp cset name='AIF2TX1 Input 1 Volume' 32 # 22 = -10dB
    amixer -q -Dhw:sndrpiwsp cset name='AIF2TX2 Input 1' AIF1RX2
    amixer -q -Dhw:sndrpiwsp cset name='AIF2TX2 Input 1 Volume' 32 # 22 = -10dB

    It sets Line Out and S/PDIF Out to 0 dB, i.e no amplification nor attenuation. The rationale here is that those outputs are connected to devices which have their own volume controls. Also, my analog gear is professional stuff that can take even hotter signals.

    Headset Out is set to -6 dB, to avoid ear-shattering surprises. The actual sound level I get varies a lot depending on which headphones I use. In modern ones it's still a bit too loud for my taste, but in my old 600-ohm favorites, it's just right.

     

    So, my hint would be to take the above script and edit it to decrease levels with 10 dB on lines 6 and 15. Then, I think you'll have a good starting point.

    As you can see, the magic command to set levels is amixer using its cset option.

    --

    Ragnar

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • e14 Contributor
    e14 Contributor over 11 years ago in reply to hystrix

    One thing I have noticed: the red and green LEDs are illuminated on the audio card until the first recording is started. Once recording has started, the red LED goes out and stays out. Previously, with the earlier kernel version and a Pi B+I think the red LED went out once the Pi had booted. Not that it really matters, but it's just something I noticed.

     

    As far as I know,  the red led indicates whether the S/PDIF chip is controlled over the SPI or the I2C bus. I think I have seen some some changes there...

    --

    Ragnar

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • e14 Contributor
    e14 Contributor over 11 years ago

    Ragnar,

     

    Many thanks to you for sharing this!!! I am getting sound using my Raspberry Pi 2 on the headset but I am only getting sound output to my loud speakers via right speaker out--I get no sound at all to left speaker out.  What may I have done wrong?

     

    Thanks, again!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • notorious.dds
    notorious.dds over 11 years ago
    Okay, so I have Raspbian 3.18 installed on my Pi2 and my Cirrus Logic Audio Card connected.  Not that I think it matters, but I'm using berryboot for the bootloader.  At any rate, I downloaded the tarball with the 3.18 kernel containing the CL drivers and untarred it into the root directory.

    The contents of /boot/config.txt
    core_freq=500

    sdram_freq=500

    over_voltage=2

    arm_freq=1000

    dtparam=spi=on

    dtparam=i2c_arm=on

    dtoverlay=rpi-cirrus-wm5102-overlay

    kernel=kernel7_CL.img

    The contents of /etc/modprobe.d/raspi-blacklist.conf

    softdep arizona-spi pre: arizona-ldo1

    softdep spi-bcm2708 pre: fixed

    And when I reboot and run the following commands, the card isn't recognized and it looks like the new kernel is being used either.  What am I missing?
    pi@raspberrypi ~ $ cat /proc/sys/kernel/osrelease
    3.18.6-v7i-aufs
    pi@raspberrypi ~ $ aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
      Subdevices: 7/8
      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
      Subdevice #7: subdevice #7
    card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    pi@raspberrypi ~ $ aplay -L
    null
        Discard all samples (playback) or generate zero samples (capture)
    pulse
        PulseAudio Sound Server
    default:CARD=ALSA
        bcm2835 ALSA, bcm2835 ALSA
        Default Audio Device
    sysdefault:CARD=ALSA
        bcm2835 ALSA, bcm2835 ALSA
        Default Audio Device
    pi@raspberrypi ~ $ cat /proc/asound/cards
    0 [ALSA          ]: bcm2835 - bcm2835 ALSA
                          bcm2835 AL
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
<>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube