1 2 3 4 5 382 Replies Latest reply on Apr 27, 2019 4:36 PM by richardash1981 Go to original post
      • 30. Re: New reworked driver for Wolfson/Cirrus Logic audio card
        lappen

        Thanks for the fast reply.

        Now it compile, but the Reboot fail. Is there a chance to find the Problem or I have to set OSMC new?

         

        Edit:

        So I try to install the driver several times with OSMC 12.2016 and cirrus driver 4.9.0 and 4.4.14.

        Everytime the same. After a reboot OSMC surface can't start. Over SSH I have connection the Kernel is refresht to 4.9.0 and aplay -l say the driver is installed. I think the file system is corrupted because I can't do sudo apt-get update or install something after install cirrus driver. I found the system is in read only mode and boot is corrupted.

        So I try:

        fsck -y /boot

        but no improvement. Have Some a Idea what I do wrong at installation?

        • 31. Re: New reworked driver for Wolfson/Cirrus Logic audio card
          kjciszewski

          OK, I got the never driver running using the 4.9.0 kernal on an RPI 3 with a Cirrus Audio card.

           

          I have script Lbio8.sh that runs a loop through--

           

          ./Playback_to_Lineout.sh

           

          ./Record_from_Linein.sh

           

          arecord -Dhw:1 -r 8000 -c 2 -f S32_LE | aplay -Dhw:1 -r 8000 -c 2 -f S32_LE

           

           

          when I run it I get

           

          pi@raspberrypi:~/cirrus $ ./Lbio8.sh

          Recording WAVE 'stdin' : Signed 32 bit Little Endian, Rate 8000 Hz, Stereo

          Warning: rate is not accurate (requested = 8000Hz, got = 32000Hz)

                   please, try the plug plugin

          Playing WAVE 'stdin' : Signed 32 bit Little Endian, Rate 32000 Hz, Stereo

           

          However, the script works, inputs and outputs the audio.  The audio seems to have a bit of a hiss.

           

          This script worked with previous drivers for the first Wolfson Audio Card and also the CIrrus audio card (the second card, with the 40 pin interface), and there was no indication of problems with it recognizing the 8000 Hz sampling rate.

           

          Any thoughts?

          • 32. Re: New reworked driver for Wolfson/Cirrus Logic audio card
            hiassoft

            Hi Kenneth!

            pi@raspberrypi:~/cirrus $ ./Lbio8.sh

            Recording WAVE 'stdin' : Signed 32 bit Little Endian, Rate 8000 Hz, Stereo

            Warning: rate is not accurate (requested = 8000Hz, got = 32000Hz)

            please, try the plug plugin

            Playing WAVE 'stdin' : Signed 32 bit Little Endian, Rate 32000 Hz, Stereo

            There are 2 things to keep in mind:

             

            The reworked driver contains a new control "Min Sample Rate": Reset_paths.sh sets it to "off" (allowing samplerates of 8kHz and above), Playback_to_SPDIF.sh and Record_from_SPDIF.sh set it to "32kHz". The default (if you called neither scripts) is 32kHz so that explains why using 8kHz doesn't work.

             

            Just call Reset_paths.sh (and after that the record and playback scripts) or manually change the Min Sample Rate control:

            amixer cset name="Min Sample Rate" "off"
            

            BTW: There's also a "Max Sample Rate" control but none of the config scripts touches that and it defaults to "off". The purpose of these controls is to limit the rates for SPDIF input/output. SPDIF has a minimum limit of 32kHz and some DACs may have an upper limit of 48, 96 or 192 kHz.

             

            The other thing is that on recent Raspbian installations there's an .asoundrc file in /home/pi that sets the default device to hw:0. I'm not sure why or when this was added, but it's rather odd - the ALSA default is usually plughw:0 which allows samplerate, format, channel, ... conversion.

             

            So, better remove /home/pi/.asoundrc and ALSA should work again as expected.

             

            so long,

             

            Hias

            1 of 1 people found this helpful
            • 33. Re: New reworked driver for Wolfson/Cirrus Logic audio card
              kjciszewski

              Thanks for that--I added Reset_paths.sh to my Lbio8.sh script, and the sample rate issue went away.

               

              There still seems to be a lot of white noise (hiss) in the audio that I don't remember from the earlier RPIs, audio cards and drivers, so I'll have to look into that.

               

              The default hw:0 thing was the original ALSA default, as I understand it, going way back. Ragnar Jensen's driver changed that to hw:1, as I recall (that as 3.12.33+, I think).

               

              It's interesting how different driver versions do things like add a minimum sample rate control, but I don't remember seeing that documented anywhere.

               

              I appreciate all of your hard work on this driver rework, without it we'd probably have nothing for RPI 3--the original powers that be didn't keep up very well the the Wolfson and CIrrus audio cards drivers relative to the changing RPI models.

               

              That said, one of the issues with all of this is some kind of documentation of changes and special features--unless I missed that somewhere.

               

              Thanks again.

               

              Have you heard if the Cirrus audio card will continue to be produced?  I saw one suppliers site that said it is no longer manufactured, while another said it would ship once supplies were restocked.

              1 of 1 people found this helpful
              • 34. Re: New reworked driver for Wolfson/Cirrus Logic audio card
                hiassoft

                I'm not familiar with OSMC but you could try looking in /var/log/syslog and/or the outputs of "dmesg", "journalctl -a" and "systemctl status" to get some more info what failed.

                 

                BTW: have you tried using a different SD card? If you see some filesystem corruption it could be caused by a defective card - this is happens quite often, unfortunately.

                 

                so long,

                 

                Hias

                1 of 1 people found this helpful
                • 35. Re: New reworked driver for Wolfson/Cirrus Logic audio card
                  hiassoft

                  Hi Kenneth!

                   

                  I haven't noticed any noise/hiss issues so far. Try to check the cabling first, if it doesn't help please test with the old 4.4 kernel and see if it makes a difference.

                   

                  I've added the minimum/maximum samplerate controls to make it easier to interface with S/PDIF DACs and ADCs. And I also added controls to get/set the S/PDIF channel status bits (conforming to the ALSA IEC958 standard) both for transmission and reception, plus a few other read-only controls (all having "IEC958" at the beginning of the name) to check the internal S/PDIF receiver status registers - so users/application can detect if S/PDIF reception is OK.

                   

                  My plan is to document these new features later on my website, but number one priority for me was to get the new driver out to the public and get some feedback. If something's unclear or you need more info, just ask here!

                   

                  so long,

                   

                  Hias

                  1 of 1 people found this helpful
                  • 36. Re: New reworked driver for Wolfson/Cirrus Logic audio card
                    lappen

                    Thanks Hias for the commands to check.

                    - $ cat /var/log/syslog is empty

                    - $ dmesg is a to long for output but a Interessting Line is :

                    2.126616] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.

                    and

                    2.920504] systemd[1]: Cannot add dependency job for unit display-manager.service, ignoring: Unit display-manager.service failed to load: No such file or directory.

                    - $ systemctl status say: osmc    State: degraded ...

                    - $ journalctl -a say: no jounal files found

                     

                    After that I found the command: $ systemctl list-units --failed

                    Output:

                    ● systemd-hostnamed.service   loaded failed failed Hostname Service

                    ● systemd-random-seed.service loaded failed failed Load/Save Random Seed

                    ● systemd-update-utmp.service loaded failed failed Update UTMP about System Boot/Shutdown

                     

                    Than I try to restart the Hostname with: $ sudo service systemd-hostnamed.service restart

                    Output:

                    Failed to restart systemd-hostnamed.service.service: Unit systemd-hostnamed.service.service failed to load: No such file or directory.

                     

                    and the status of the service ( $ sudo systemctl status  systemd-hostnamed.service ) say the Problem which we isolate at start:

                     

                    systemd-hostnamed.service - Hostname Service

                       Loaded: loaded (/lib/systemd/system/systemd-hostnamed.service; static)

                       Active: failed (Result: resources)

                         Docs: man:systemd-hostnamed.service(8)

                               man:hostname(5)

                               man:machine-info(5)

                               http://www.freedesktop.org/wiki/Software/systemd/hostnamed

                     

                    Jan 11 00:03:17 osmc systemd[1]: Starting Hostname Service...

                    Jan 11 00:03:17 osmc systemd[1]: systemd-hostnamed.service failed to run 'start' task: Read-only file system

                    Jan 11 00:03:17 osmc systemd[1]: Failed to start Hostname Service.

                    Jan 11 00:03:17 osmc systemd[1]: Unit systemd-hostnamed.service entered failed state.

                     

                    The Filesystem is read only mounted. So I try allready a second sd card but with the same result.

                    How can I prevent that the card mounted with read only?

                    • 37. Re: New reworked driver for Wolfson/Cirrus Logic audio card
                      hiassoft

                      Jan 11 00:03:17 osmc systemd[1]: Starting Hostname Service...

                      Jan 11 00:03:17 osmc systemd[1]: systemd-hostnamed.service failed to run 'start' task: Read-only file system

                      Jan 11 00:03:17 osmc systemd[1]: Failed to start Hostname Service.

                      Jan 11 00:03:17 osmc systemd[1]: Unit systemd-hostnamed.service entered failed state.

                       

                      The Filesystem is read only mounted. So I try allready a second sd card but with the same result.

                      How can I prevent that the card mounted with read only?

                      I had a quick look at the OSMC sources and it looks like it uses a custom kernel build with an initramfs to setup stuff immediately after boot.

                      https://github.com/osmc/osmc/tree/master/package/kernel-osmc

                       

                      So simply swapping out the kernel won't work, you'd have to build your own kernel with the same setup like OSMC needs (initramfs etc), eg by adapting the OSMC kernel build to use the sources from my github repo.

                       

                      so long,

                       

                      Hias

                      1 of 1 people found this helpful
                      • 38. Re: New reworked driver for Wolfson/Cirrus Logic audio card
                        lappen

                        Thanks for look in.

                        How I have to do this. Must I bring the source code of osmc and yours together and compile it or can I Install osmc and modify yours with favorite osmc settings to recompile it. Sorry for the questions but rpi and kernel compilition is new for me.

                        Thanks for the support.

                        • 39. Re: New reworked driver for Wolfson/Cirrus Logic audio card
                          hiassoft

                          How I have to do this. Must I bring the source code of osmc and yours together and compile it or can I Install osmc and modify yours with favorite osmc settings to recompile it. Sorry for the questions but rpi and kernel compilition is new for me.

                          Thanks for the support.

                          It depends. If the initrd is stored as a separate file and the kernel matches the configuration of OSMC's kernel it may be as simple as unpacking the initrd, replacing the kernel modules inside that with the updated ones from the precompiled kernel, repacking the initrd and copying it to /boot - similar to what I tested with volumio:

                          Re: Driver fixes and updates to kernel 3.18.16 and 4.0.5

                           

                          If the initrd/initramfs is included in the kernel image or if OSMC needs some special kernel configs/patches it'll be a lot more complicated. Then you need to have a closer look at the OSMC build system, probably change a bunch of files/settings and recompile the kernel. If you never did this before this can be quite challenging and you'd better ask on the OSMC forums about the build system details.

                           

                          Or you can just use LibreELEC instead of OSMC, my LibreELEC builds work out of the box with the cirrus card

                          https://forum.libreelec.tv/thread-3387.html

                           

                          so long,

                           

                          Hias

                          1 of 1 people found this helpful
                          • 40. Re: New reworked driver for Wolfson/Cirrus Logic audio card
                            kjciszewski

                            I have a Raspberry PI 2, so I ran version 3.18.9-v7+ using my Lbio8.sh script, and compared that to running version v.9.0-v7+ (your new driver) on the RP 2.  The there is virtually no "hiss" noise out of 3.18.9-v7+, while there is considerable noise coming out of V.9.0-v7+.

                             

                            It may be that there was some audio compensation/.filtering in the earlier version that cut back on the "hiss" noise--the WM5102 has a lot capabilities like filtering that might have been involved.  I'm not sure.  However, the difference is noticeable as soon as the Lbio8.sh script is loaded and the screen tells us that both the record and play functions are running.  With V.9.0-v7+, when the Lbio8.sh script is started, the noise occurs immediately, and when the Lbio8.sh script is killed,  the noise goes away.  Running version 3.18.9-v7+ does not produce the same level of noise.  This noise is loud enough to be audible even with a signal being input and looped through (I use a pocket music player that plays music files from a memory card)--I start the script, wait and listen to the output noise level, then start playing a music file.

                            • 41. Re: New reworked driver for Wolfson/Cirrus Logic audio card
                              hiassoft

                              I have a Raspberry PI 2, so I ran version 3.18.9-v7+ using my Lbio8.sh script, and compared that to running version v.9.0-v7+ (your new driver) on the RP 2. The there is virtually no "hiss" noise out of 3.18.9-v7+, while there is considerable noise coming out of V.9.0-v7+.

                               

                              It may be that there was some audio compensation/.filtering in the earlier version that cut back on the "hiss" noise--the WM5102 has a lot capabilities like filtering that might have been involved. I'm not sure. However, the difference is noticeable as soon as the Lbio8.sh script is loaded and the screen tells us that both the record and play functions are running. With V.9.0-v7+, when the Lbio8.sh script is started, the noise occurs immediately, and when the Lbio8.sh script is killed, the noise goes away. Running version 3.18.9-v7+ does not produce the same level of noise. This noise is loud enough to be audible even with a signal being input and looped through (I use a pocket music player that plays music files from a memory card)--I start the script, wait and listen to the output noise level, then start playing a music file.

                              Could you please post the Lbio8.sh script? Also post how you configure the card, i.e. which Playback/Listen scripts you are running. BTW: when setting up the card it's a good idea to run Reset_paths first.

                               

                              Which inputs and outputs are you using?

                               

                              so long,

                               

                              Hias

                              • 42. Re: New reworked driver for Wolfson/Cirrus Logic audio card
                                kjciszewski

                                I'm using the line in (pink) and line out (green) jacks on the CIrrus Logic audio card.

                                 

                                ----> Lbio8.sh for v.4.9.0-v7+ is

                                 

                                ./Reset_paths.sh

                                 

                                ./Playback_to_Lineout.sh

                                 

                                ./Record_from_Linein.sh

                                 

                                arecord -Dhw:1 -r 8000 -c 2 -f S32_LE | aplay -Dhw:1 -r 8000 -c 2 -f S32_LE

                                 

                                ----> Lbio8.sh for version 3.18.9-v7+ is

                                 

                                ./Playback_to_Lineout.sh

                                 

                                ./Record_from_Linein.sh

                                 

                                arecord -Dhw:1 -r 8000 -c 2 -f S32_LE | aplay -Dhw:1 -r 8000 -c 2 -f S32_LE

                                 

                                No one said it was necessary to reset paths with the earlier driver.  I have done that in the past manually at times, but never noticed any difference.

                                 

                                The playback/listen scripts for v.4.9.0-v7+ are the new ones you provided.

                                 

                                The playback/listen scripts for version 3.18.9-v7+  are

                                 

                                ----->  Record_from_Linein.sh

                                 

                                #!/bin/bash

                                 

                                # $1 added to support 1st line argument. i.e. "./Record_from_linein.sh -q" will stop all the control information being displayed on screen

                                 

                                #Record from onboard Line Input to AP

                                # +8dB input PGA gain

                                amixer $1 -Dhw:sndrpiwsp cset name='IN3L Volume' 8

                                amixer $1 -Dhw:sndrpiwsp cset name='IN3R Volume' 8

                                 

                                # better THD in normal mode vs lower noise floor in high performance

                                amixer $1 -Dhw:sndrpiwsp cset name='IN3 High Performance Switch' on

                                # Configure the input path for 0dB Gain,  HPF with a low cut off for DC removal

                                amixer $1 -Dhw:sndrpiwsp cset name='IN3L Digital Volume' 128

                                amixer $1 -Dhw:sndrpiwsp cset name='IN3R Digital Volume' 128

                                amixer $1 -Dhw:sndrpiwsp cset name='LHPF1 Input 1' IN3L

                                amixer $1 -Dhw:sndrpiwsp cset name='LHPF2 Input 1' IN3R

                                amixer $1 -Dhw:sndrpiwsp cset name='LHPF1 Mode' High-pass

                                amixer $1 -Dhw:sndrpiwsp cset name='LHPF2 Mode' High-pass

                                amixer $1 -Dhw:sndrpiwsp cset name='LHPF1 Coefficients' 240,3

                                amixer $1 -Dhw:sndrpiwsp cset name='LHPF2 Coefficients' 240,3

                                # Configure the Audio Interface and volume 0dB

                                amixer $1 -Dhw:sndrpiwsp cset name='AIF1TX1 Input 1' LHPF1

                                amixer $1 -Dhw:sndrpiwsp cset name='AIF1TX1 Input 1 Volume' 32

                                amixer $1 -Dhw:sndrpiwsp cset name='AIF1TX2 Input 1' LHPF2

                                amixer $1 -Dhw:sndrpiwsp cset name='AIF1TX2 Input 1 Volume' 32

                                 

                                 

                                # The following command should be used to test

                                # arecord -Dhw:sndrpiwsp -r 44100 -c 2 -f S32_LE <file>

                                 

                                ----->  Playback_to_Lineout.sh

                                 

                                #!/bin/bash

                                 

                                # $1 added to support 1st line argument. i.e. "./Playback_to_Lineout.sh -q" will stop all the control information being displayed on screen

                                 

                                #Playback from AP to Line Output, default gain 0dB

                                 

                                # Clear the HPOUT2 Input 1 and 2  mixers. This will ensure no previous paths are connected to the HPOUT2.

                                # This doesn't include Inputs 3 and 4.

                                amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2L Input 1' None

                                amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2R Input 1' None

                                amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2L Input 2' None

                                amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2R Input 2' None

                                # Setup HPOUT2 input path and volume

                                amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2L Input 1' AIF1RX1

                                amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2L Input 1 Volume' 32

                                amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2R Input 1' AIF1RX2

                                amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2R Input 1 Volume' 32

                                # Unmute HPOUT2 Output

                                amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2 Digital Switch' on

                                 

                                 

                                # The following command can be used to test

                                # aplay -Dhw:sndrpiwsp -r 44100 -c 2 -f S32_LE <file>

                                1 of 1 people found this helpful
                                • 43. Re: New reworked driver for Wolfson/Cirrus Logic audio card
                                  hiassoft

                                  Hi Kenneth,

                                   

                                  thanks a lot for the info! I could reproduce the issue, it looks like it comes from the micbias disable fix (the original driver was buggy in this respect and had micbias always enabled on line-in). I think I might have a solution but need to run some more tests first.

                                   

                                  As a workaround could you try using "Record_from_Linein_Micbias.sh" instead of "Record_from_Linein.sh" and see if the noise disappears? That'll setup the card as with the original drivers/mixer scripts.

                                   

                                  BTW: When you want to monitor a signal from an input it'd be better to use a samplerate of 44100 instead of 8000, that improves quality a lot. You could also use the listen script "Cirrus_listen.sh line line", that'll route line-in to line-out inside of the chip (no need for arecord | aplay) - in that case the driver will use whatever samplerate has last been used (default after powerup is 44100 Hz).

                                   

                                  Ah, and always using Reset_paths.sh is not strictly necessary, but it's a good thing to do before testing so the card is in a known state and I have a chance to reproduce issues - there are tons of stuff that could be set wrong and cause all kinds of problems.

                                   

                                  so long,

                                   

                                  Hias

                                  1 of 1 people found this helpful
                                  • 44. Re: New reworked driver for Wolfson/Cirrus Logic audio card
                                    kjciszewski

                                    Thanks for taking the time to work on this.

                                     

                                    I use 8000 Hz because of an interest voice intercom over IP, something I'm still working on. It's kind of a common sample rate used for digital voice communication. Finding a suitable ethernet interface to use is still a challenge.

                                    1 2 3 4 5