TobiasVanDyk / RaspberryPi-GPIO-Audio

2019-2024: Audio DAC interfaced through Raspberry Pi GPIO such as i2s for two Waveshare Wolfson WM8960 Audio DAC modules with i2c control.
GNU General Public License v3.0
2 stars 2 forks source link

RetroPie Compatibility #1

Closed StonedEdge closed 8 months ago

StonedEdge commented 3 years ago

Hi there,

I noticed that you were the most recent person to update their repository regarding the WM8960, and I'm having a bit of trouble getting mine working.

I hope this is clear. I've done this from PuTTY all via WinCSP to run the install. I've downloaded RetroPie from the retropie site, and it is running on 5.4.72-v71+ before updating.

1) sudo apt-get install raspberrypi-kernel-headers --> sudo apt-get dist-upgrade --> sudo apt-get update 1a) 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>; as I have the waveshare amp connected to i2c0 bus, not i2c1 --> save file 5) sudo ./install.sh 6) sudo reboot 7) sudo i2cdetect -y 0 --> 1a appears (slave device) 8) sudo aplay -L (sound card does NOT appear)

I have the i2s lines connected to the CM4 as follows: GPIO18 (Pin 49) - BCLK GPIO19 (Pin 26) - LRCLK GPIO 20 (Pin 27) - I2S_ADC GPIO 21 (Pin 25) - I2S_DAC (Serial Data)

Everything works except when I try to play audio mp3 using mpg123 mp3.wav, there is no audio coming out of the speakers. Do you have any other ways of ensuring that the i2s lines are communicating with the Pi, without using a scope for example?

Do I need to add anything specific to my config.txt to make this work?

TobiasVanDyk commented 3 years ago

Hi

Edit: ok good I see you got it recognised by alsa here: https://www.raspberrypi.org/forums/viewtopic.php?f=44&t=316818

I am not sure how to test a setup similar to yours as I do not have a compute module.

What will help is if you post the same message (include details about which CM4 motherboard you use?), as an issue here: https://github.com/waveshare/WM8960-Audio-HAT/issues

I particular see if you can get https://github.com/dr-ni to look at your issue - he has helped me in the past

I assume you have tested the HAT with a RPi4B just to check that it does work in that setup?

------> sudo i2cdetect -y 0 --> 1a appears (slave device) ------> sudo aplay -L (sound card does NOT appear) Note1

If (suspect!) that if alsamixer (F6) or aplay -l does not show the HAT detected the problem is not with the i2s but with the register setup through i2c.

If you can modify your setup temporarily to use the same GPIO lines as the HAT would use with an RPi4B and test it with the latest Raspbian OS (May 2021 - after recent kernel update to 5.10.52), without adding Retropie. Also disconnect all other i2c peripherals and also the display you use for retropie (SPI LCD?). After that make one change at a time i.e. the i2c line changes and check if it works. Then make the i2s changes. After that try to get the same setup working with your older kernel first and then add Retropie. Does that make sense? - I guess what I am trying to say is that you must start with a working setup (it can be an RPi4B or a CM4) and then by changing one thing at a time identify the problem. This working setup could mean staring with an older kernel or the newest one - it does not matter.

Persevere - after the recent kernel 5.10.52.v71+ update my WM8960 sounds as good as my other PCM1522 DAC!

Other things to check:

What does sudo dkms status show? What are the /boot/config.txt entries for i2c and i2s-mmap and and dtoverlay=wm8960-soundcard? Check if there is a difference in raspi-config for the two i2c lines?

Note1 The email that I have received states: sudo aplay -L (sound card appears)?

TobiasVanDyk commented 8 months ago

Closed assumed to be solved by OP