RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Waveshare WM8960 HAT - Retropie compatibility?

    Scheduled Pinned Locked Moved Help and Support
    wm8960 amp
    13 Posts 2 Posters 1.7k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mituM
      mitu Global Moderator
      last edited by mitu

      If you're running a recent Raspberry Pi OS version, then you shouldn't need any additional driver.
      You haven't mentioned what's your RetroPie version and which image did you used, but if you start with the latest RetroPie image you'll need to update your kernel and included packages, then just add

      dtparam=i2s=on
      dtoverlay=i2s-mmap
      dtoverlay=wm8960-soundcard
      

      to your /boot/config.txt.

      StonedEdgeS 1 Reply Last reply Reply Quote 0
      • StonedEdgeS
        StonedEdge @mitu
        last edited by StonedEdge

        @mitu Hi, thanks for your reply and sorry for the bump in the other post. I'll post my config.txt below, but this is the order of operations I've had to take to install the amplifier drivers. Without running sudo-apt get dist-upgrade, I get the following error on a freshly flashed image:

        DKMS: add completed.
        Error! echo
        Your kernel headers for kernel 5.4.51-v7l+ cannot be found at
        /lib/modules/5.4.51-v7l+/build or /lib/modules/5.4.51-v7l+/source.
        Created symlink /etc/systemd/system/sysinit.target.wants/wm8960-soundcard.service → /lib/systemd/system/wm8960-soundcard.service.
        Job for wm8960-soundcard.service failed because the control process exited with error code.
        See "systemctl status wm8960-soundcard.service" and "journalctl -xe" for details.
        

        I'm using a CM4 running the latest RetroPie image available here, which I believe runs on the kernel 5.4.72-v71:
        https://retropie.org.uk/download/

        Order of operations taken to get the drivers installed. I have the amplifier connected to the I2C0 bus, so I had to change the target bus to i2c0 in the dtoverlay & recompile the DTBO file by executing the following command in terminal:

         sudo dtc -@ -I dts -O dtb -o wm8960-soundcard.dtbo wm8960-soundcard.dts
        sudo cp wm8960-soundcard.dtbo /boot/overlays/  
        
        1. sudo apt-get install raspberrypi-kernel-headers --> sudo apt-get dist-upgrade --> sudo apt-get update --> sudo rpi-update
        2. git clone https://github.com/waveshare/WM8960-Audio-HAT
        3. cd WM8960-Audio-HAT
        4. sudo nano wm8960-soundcard.dts
        5. Change target = <&i2c1>; to <&i2c0>; --> save file before install
        6. sudo ./install.sh
        7. sudo reboot
        8. sudo i2cdetect -y 0 --> 1a appears (slave device)
        9. sudo aplay -l (wm8960-soundcard appears)
        10. Turn up speaker volume, turn on PCM channels (left and right)
        11. Access configuration menu in RetroPie
        12. Moving up and down the menus is extremely laggy, sometimes causing a bus error or just flat out freezing.

        Here's my config.txt for good measure:

        # uncomment if hdmi display is not detected and composite is being output
        hdmi_force_hotplug=1
        
        # uncomment to force a specific HDMI mode (here we are forcing 800x480!)
        hdmi_group=2
        hdmi_mode=87
        hdmi_cvt=800 480 60 6 0 0 0
        
        # uncomment to force a HDMI mode rather than DVI. This can make audio work in
        # DMT (computer monitor) modes
        hdmi_drive=1
        
        # uncomment to increase signal to HDMI, if you have interference, blanking, or
        # no display
        #config_hdmi_boost=4
        
        # uncomment for composite PAL
        #sdtv_mode=2
        
        #uncomment to overclock the arm. 700 MHz is the default.
        #arm_freq=800
        
        # for more options see http://elinux.org/RPi_config.txt
        
        # Uncomment some or all of these to enable the optional hardware interfaces
        dtparam=i2c_arm=on
        dtparam=i2s=on
        dtparam=spi=on
        dtoverlay=i2s-mmap
        dtoverlay=i2c0,pins_44_45
        dtoverlay=wm8960-soundcard
        
        # Uncomment this to enable infrared communication.
        #dtoverlay=gpio-ir,gpio_pin=17
        #dtoverlay=gpio-ir-tx,gpio_pin=18
        
        # Additional overlays and parameters are documented /boot/overlays/README
        
        # Enable audio (loads snd_bcm2835)
        dtparam=audio=on
        
        [pi4]
        # Enable DRM VC4 V3D driver on top of the dispmanx display stack
        dtoverlay=vc4-fkms-v3d
        max_framebuffer=2
        

        Let me reiterate that sound does indeed work in the configuration menu, I can hear the clicks of moving up and down the menus, albeit it laggy, sometimes the inputs skip a few lines and move the cursor up randomly up and down when I push up on the DPAD, for example. I'm not sure what is causing the bus error, but here is a couple of pictures of the errors flagged:

        https://i.imgur.com/oTj2Bxk.jpg

        Check out my build logs below:
        Wii SPii (Wii in a GBA SP Shell)
        https://bitbuilt.net/forums/index.php?threads/the-wii-spii.3347/
        Retro Lite CM4
        https://bitbuilt.net/forums/index.php?threads/retro-lite-cm4-a-stonededge-and-dmcke5-collaboration.3934/

        StonedEdgeS 1 Reply Last reply Reply Quote 0
        • StonedEdgeS
          StonedEdge @StonedEdge
          last edited by StonedEdge

          @stonededge said in Waveshare WM8960 HAT - Retropie compatibility?:

          @mitu Hi, thanks for your reply and sorry for the bump in the other post. I'll post my config.txt below, but this is the order of operations I've had to take to install the amplifier drivers. Without running sudo-apt get dist-upgrade, I get the following error on a freshly flashed image:

          DKMS: add completed.
          Error! echo
          Your kernel headers for kernel 5.4.51-v7l+ cannot be found at
          /lib/modules/5.4.51-v7l+/build or /lib/modules/5.4.51-v7l+/source.
          Created symlink /etc/systemd/system/sysinit.target.wants/wm8960-soundcard.service → /lib/systemd/system/wm8960-soundcard.service.
          Job for wm8960-soundcard.service failed because the control process exited with error code.
          See "systemctl status wm8960-soundcard.service" and "journalctl -xe" for details.
          

          I'm using a CM4 running the latest RetroPie image available here, which I believe runs on the kernel 4.5.71+-v71:
          https://retropie.org.uk/download/

          Order of operations taken to get the drivers installed. I have the amplifier connected to the I2C0 bus, so I had to change the target bus to i2c0 in the dtoverlay & recompile the DTBO file by executing the following command in terminal:

           sudo dtc -@ -I dts -O dtb -o wm8960-soundcard.dtbo wm8960-soundcard.dts
          sudo cp wm8960-soundcard.dtbo /boot/overlays/  
          
          1. sudo apt-get install raspberrypi-kernel-headers --> sudo apt-get dist-upgrade --> sudo apt-get update --> sudo rpi-update
          2. git clone https://github.com/waveshare/WM8960-Audio-HAT (firmware available here - https://github.com/waveshare/WM8960-Audio-HAT)
          3. cd WM8960-Audio-HAT
          4. sudo nano wm8960-soundcard.dts
          5. Change target = <&i2c1>; to <&i2c0>; --> save file before install
          6. sudo ./install.sh
          7. sudo reboot
          8. sudo i2cdetect -y 0 --> 1a appears (slave device)
          9. sudo aplay -l (wm8960-soundcard appears)
          10. Turn up speaker volume, turn on PCM channels (left and right)
          11. Access configuration menu in RetroPie
          12. Moving up and down the menus is extremely laggy, sometimes causing a bus error or just flat out freezing.

          Here's my config.txt for good measure:

          # uncomment if hdmi display is not detected and composite is being output
          hdmi_force_hotplug=1
          
          # uncomment to force a specific HDMI mode (here we are forcing 800x480!)
          hdmi_group=2
          hdmi_mode=87
          hdmi_cvt=800 480 60 6 0 0 0
          
          # uncomment to force a HDMI mode rather than DVI. This can make audio work in
          # DMT (computer monitor) modes
          hdmi_drive=1
          
          # uncomment to increase signal to HDMI, if you have interference, blanking, or
          # no display
          #config_hdmi_boost=4
          
          # uncomment for composite PAL
          #sdtv_mode=2
          
          #uncomment to overclock the arm. 700 MHz is the default.
          #arm_freq=800
          
          # for more options see http://elinux.org/RPi_config.txt
          
          # Uncomment some or all of these to enable the optional hardware interfaces
          dtparam=i2c_arm=on
          dtparam=i2s=on
          dtparam=spi=on
          dtoverlay=i2s-mmap
          dtoverlay=i2c0,pins_44_45
          dtoverlay=wm8960-soundcard
          
          # Uncomment this to enable infrared communication.
          #dtoverlay=gpio-ir,gpio_pin=17
          #dtoverlay=gpio-ir-tx,gpio_pin=18
          
          # Additional overlays and parameters are documented /boot/overlays/README
          
          # Enable audio (loads snd_bcm2835)
          dtparam=audio=on
          
          [pi4]
          # Enable DRM VC4 V3D driver on top of the dispmanx display stack
          dtoverlay=vc4-fkms-v3d
          max_framebuffer=2
          

          I'm also on Discord if it would be easier to chat there too. I'm keen to get this amp working, but considering switching out to something more compatible with RetroPie if I need to for my console build. Hopefully I was clear enough with the above! I don't think having it on i2c0 bus instead of i2c1 would cause any issues, but maybe I'm not recompiling the dtbo correctly.

          Check out my build logs below:
          Wii SPii (Wii in a GBA SP Shell)
          https://bitbuilt.net/forums/index.php?threads/the-wii-spii.3347/
          Retro Lite CM4
          https://bitbuilt.net/forums/index.php?threads/retro-lite-cm4-a-stonededge-and-dmcke5-collaboration.3934/

          1 Reply Last reply Reply Quote 0
          • mituM
            mitu Global Moderator
            last edited by

            @stonededge said in Waveshare WM8960 HAT - Retropie compatibility?:

            I'm using a CM4 running the latest RetroPie image available here, which I believe runs on the kernel 5.4.72-v71:

            Yes, but if you update your Raspberry Pi OS (and RetroPie setup script), you'll get the latest RPI kernel which should support the hat natively, without an additional driver, or this is how I read the following changes:

            • https://github.com/raspberrypi/linux/pull/4039
            • https://github.com/raspberrypi/linux/issues/4454

            I'm not familiar with the device tree overlays and I don't know if the driver provided by Waveshare still works with the latest RPI, so if you get any errors during installation, you'd be better asking the Waveshare project's issue page.

            StonedEdgeS 1 Reply Last reply Reply Quote 1
            • StonedEdgeS
              StonedEdge @mitu
              last edited by

              @mitu said in Waveshare WM8960 HAT - Retropie compatibility?:

              @stonededge said in Waveshare WM8960 HAT - Retropie compatibility?:

              I'm using a CM4 running the latest RetroPie image available here, which I believe runs on the kernel 5.4.72-v71:

              Yes, but if you update your Raspberry Pi OS (and RetroPie setup script), you'll get the latest RPI kernel which should support the hat natively, without an additional driver.

              The best way to update is with sudo apt-update and sudo apt full-upgrade?

              Check out my build logs below:
              Wii SPii (Wii in a GBA SP Shell)
              https://bitbuilt.net/forums/index.php?threads/the-wii-spii.3347/
              Retro Lite CM4
              https://bitbuilt.net/forums/index.php?threads/retro-lite-cm4-a-stonededge-and-dmcke5-collaboration.3934/

              mituM 1 Reply Last reply Reply Quote 0
              • mituM
                mitu Global Moderator @StonedEdge
                last edited by

                @stonededge said in Waveshare WM8960 HAT - Retropie compatibility?:

                The best way to update is with sudo apt-update and sudo apt full-upgrade?

                Yes, that should get you the latst kernel and firmware version.

                StonedEdgeS 1 Reply Last reply Reply Quote 1
                • StonedEdgeS
                  StonedEdge @mitu
                  last edited by

                  @mitu Hmm, that got the amp working but RetroPie seems to crash for me after the kernel update, also nothing works, I tried to load a PS1 game but it just spat a bunch of errors.

                  Maybe I’d have better luck installing it over the top of Raspbian Desktop? Are crashes common on the new kernel?

                  Check out my build logs below:
                  Wii SPii (Wii in a GBA SP Shell)
                  https://bitbuilt.net/forums/index.php?threads/the-wii-spii.3347/
                  Retro Lite CM4
                  https://bitbuilt.net/forums/index.php?threads/retro-lite-cm4-a-stonededge-and-dmcke5-collaboration.3934/

                  mituM 1 Reply Last reply Reply Quote 0
                  • mituM
                    mitu Global Moderator @StonedEdge
                    last edited by

                    @stonededge said in Waveshare WM8960 HAT - Retropie compatibility?:

                    Hmm, that got the amp working but RetroPie seems to crash for me after the kernel update

                    What exactly crashes ? The front-end (EmulationStation) / emulators / the setup script ?

                    StonedEdgeS 1 Reply Last reply Reply Quote 0
                    • StonedEdgeS
                      StonedEdge @mitu
                      last edited by StonedEdge

                      @mitu

                      It's a lot of stuff.

                      Clicking around in the Configuration menu for example usually leads me to this error for one. Loading a PSX game also just doesn't work, something to do with missing image. Let me see if I can get that error as well. I'm wondering if it may be better to install Raspbian Desktop --> install drivers --> install RetroPie. What do you think? I have been rebooting with sudo reboot during the installations which I don’t think would corrupt the card.

                      [img]https://i.imgur.com/i5izkBC.jpg[/img]

                      Check out my build logs below:
                      Wii SPii (Wii in a GBA SP Shell)
                      https://bitbuilt.net/forums/index.php?threads/the-wii-spii.3347/
                      Retro Lite CM4
                      https://bitbuilt.net/forums/index.php?threads/retro-lite-cm4-a-stonededge-and-dmcke5-collaboration.3934/

                      1 Reply Last reply Reply Quote 0
                      • mituM
                        mitu Global Moderator
                        last edited by

                        @stonededge said in Waveshare WM8960 HAT - Retropie compatibility?:

                        Clicking around in the Configuration menu for example usually leads me to this error for one.

                        I would suggest starting with a clean Raspberry Pi Lite / RetroPie image, don't modify any config.txt options and make sure it works without the audio HAT.

                        Loading a PSX game also just doesn't work,...

                        That could be just a wrong image for the disc, a .cue file that's not correct. A verbose log would show more details about the error - what files are not found, if the BIOS is missing, etc.

                        I'm wondering if it may be better to install Raspbian Desktop --> install drivers --> install RetroPie.

                        Running RetroPie from the desktop is not supported nor recommended. I suggest you start with either the RetroPie image (which is just a Raspberry Pi OS Lite image with RetroPie pre-installed) or to use the latest Raspberry Pi OS Lite image + updates and then install RetroPie manually.

                        1 Reply Last reply Reply Quote 0
                        • StonedEdgeS
                          StonedEdge
                          last edited by StonedEdge

                          @mitu RetroPie works entirely fine on a fresh image with no modification. My point is that when I try to install the drivers for the WM8960, I get kernel header issues on the older version of the kernel:

                          DKMS: add completed.
                          Error! echo
                          Your kernel headers for kernel 5.4.51-v7l+ cannot be found at
                          /lib/modules/5.4.51-v7l+/build or /lib/modules/5.4.51-v7l+/source.
                          Created symlink /etc/systemd/system/sysinit.target.wants/wm8960-soundcard.service → /lib/systemd/system/wm8960-soundcard.service.
                          Job for wm8960-soundcard.service failed because the control process exited with error code.
                          See "systemctl status wm8960-soundcard.service" and "journalctl -xe" for details.
                          

                          I’ve asked the software developers, but they keep telling me to upgrade to 5.10 kernel, which RetroPie seems to not work with for me anyway. Have you experienced any issues after updating to 5.10, or can we expect any update to the kernel any time soon for RetroPie?

                          Check out my build logs below:
                          Wii SPii (Wii in a GBA SP Shell)
                          https://bitbuilt.net/forums/index.php?threads/the-wii-spii.3347/
                          Retro Lite CM4
                          https://bitbuilt.net/forums/index.php?threads/retro-lite-cm4-a-stonededge-and-dmcke5-collaboration.3934/

                          mituM 1 Reply Last reply Reply Quote 0
                          • mituM
                            mitu Global Moderator @StonedEdge
                            last edited by mitu

                            My point is that when I try to install the drivers for the WM8960, I get kernel header issues on the older version of the kernel:...

                            The advice to update to the latest kernel/firmware was so that you don't have to install any drivers and just configure the HAT's overlay in config.txt. Doesn't that work ?

                            I’ve asked the software developers, but they keep telling me to upgrade to 5.10 kernel, which RetroPie seems to not work with for me anyway.

                            RetroPie always uses the same kernel as Raspberry Pi OS. Version 5.10 has been available for quite some time now and there's no inherent incompatibility or problems running it with RetroPie (well, except maybe this issue, but that shouldn't lead to a crash in RetroPie).

                            Have you experienced any issues after updating to 5.10, or can we expect any update to the kernel any time soon for RetroPie?

                            No, I haven't experienced any issues with 5.10. As said above, RetroPie uses the Raspberry Pi OS (nee Raspbian) kernel/firmware, there's no separate RetroPie kernel update.

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post

                            Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                            Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.