Infineon / merus-audio-amp-hat-zw

MIT License
23 stars 6 forks source link

Support in piCorePlayer #4

Closed paul-1 closed 3 years ago

paul-1 commented 4 years ago

Have quite a few users that would like to use this card with piCorePlayer. Being a minimal OS, we only load what we have to. I’m getting no sound. Kernel is 4.19.122. Driver loads fine according to dmesg and lsmod. aplay -l reports the card is seen by Alsa, and all of the mixers are shown in Alsa mixer. All of the error mixers report OK.

So there must be some soft dependency somewhere? @AMuszkat Any thoughts?

I did test the board with the latest Raspberry OS, and it does work, so hardware is okay.

AMuszkat commented 4 years ago

Hi Paul,

I'll be glad to help here. Is there any way I can have acces to the image you are using? or can I compile it myself with any source code so I can have a closer look at it?

Feel free to write me to ariel.muszkat@infineon.com

Best, Ariel

paul-1 commented 4 years ago

This is our current image. https://repo.picoreplayer.org/insitu/piCorePlayer6.1.0/piCorePlayer6.1.0.zip

Here is a quick getting started: https://www.picoreplayer.org/main_getting_started.shtml

I don't have any mixers setup in the web interface, but ssh and alsamixer should all work as planned.

AMuszkat commented 4 years ago

Hi Paul,

Is it possible that I don't have access to alsamixer in piCore?

I would like to take a look at the errors labels. It takes my attention that I can not even generate audio with speaker-test.

Best, Ariel

AMuszkat commented 4 years ago

This is what I get from speaker-test

speaker-test 1.1.9

Playback device is hw:1,0 Stream parameters are 44100Hz, S32_LE, 1 channels Sine wave rate is 1000.0000Hz Playback open error: -16,Device or resource busy

is it normal? I suppose other stuff is using the I2S of the BCM?

paul-1 commented 4 years ago

Squeezelite will start by default, and will tie up the audio device. You can stop if from the web interface, or just kill the process.

alsamixer is should be availiable from a ssh or console session.

AMuszkat commented 4 years ago

is squeezelite upsampling or working at more than 48KHz of smaple rate? Currently the Merus Amp HAT supports up to 48KHz only

paul-1 commented 4 years ago

By default squeezelite does not resample. But I noticed the card did not report supported sample rates, so I was forcing squeezelite to use 48k as the max sample rate. It's an option on the squeezelite page.

AMuszkat commented 4 years ago

Hi Paul,

I was not able to find anything yet, but I suppose that it is smth around alsa resources....

paul-1 commented 4 years ago

There was a user in the LMS forums that made an observation. He mentioned the Enable pin is being left high.

https://forums.slimdevices.com/showthread.php?111787-ANNOUNCE-piCorePlayer-6-0-0&p=985144&viewfull=1#post985144

AMuszkat commented 4 years ago

Hi Paul,

Could not reproduce this last time. did you have anytime for further investigation on this?

paul-1 commented 4 years ago

I have never been able to make it work. I'm not aware of anyone on the forums getting this going either. It seems like an initialization sequence issue.

paul-1 commented 4 years ago

Finally figured out what was wrong. You cannot have the rpi SPI interface enabled with this card. That should really be in the documentation.

I have it running now.

shawaj commented 3 years ago

Nice one @paul-1 ... I was having this same issue and tearing my hair out a little bit until I chanced upon this issue! Definitely agree this should be explicitly mentioned in the docs.

image

@AMuszkat what was the reasoning behind using pin 24 / GPIO8 for the MSEL0 pin? It blocks SPI CE0 - and also means if you have the SPI interface on the Pi turned on the audio board doesn't work - could this not be wired to another pin? (also, just FYI, the pinout on the above image is reversed - it has even and odd pins on the wrong sides)

In any case, I have raised a PR here - https://github.com/raspberrypi/linux/pull/4027 - so that for any other boards using this chip they can wire the MSEL0 / MSEL1 pins to different GPIOs on the Pi.

AMuszkat commented 3 years ago

Hi @shawaj ,

This will be upgraded on hardware on the next revision of the board. For now ovverriding looks ok to me, or we can even turn off the SPI port from the overlay file.

shawaj commented 3 years ago

@AMuszkat ok sounds great. My thought on the overrides for msel0 / msel1 was that then if anyone is using the ma12070 in the future with different pins they can change that but use the same overlay.

I guess the SPI thing in the overlay could be good, but then wouldn't be needed in different/future designs. Maybe could have an override for turning SPI off - i.e. dtoverlay=merus-amp,spi-off or something like that.

What do you think?

Also, @AMuszkat is there any specific reason to have MSEL0 / 1 tied to a GPIO? Can it just be pulled up to 5v without using GPIO? Or is it required that it's a GPIO for some configuration reason?

AMuszkat commented 3 years ago

Hi @shawaj,

Turning off SPI on this specific overlay will be the solution.

Regarding MSEL0 and MSEL1, sometimes they are required to be tied to a GPIO as they define if the amplifier is in BTL / PBTL / 2.1 / 4xSE modes and you want to control the operation mode from software. For example, the merus-amp supports BTL and PBTL modes by just pulling GPIO 8., without the need of hand soldering small smd resistors. The right solution will be to move the GPIO8 to another one.

If you agree I will continue this discussion in #7 and close this issue

paul-1 commented 3 years ago

I'm fine with closing.....will tag the rpi pull requests here too.

https://github.com/raspberrypi/linux/pull/4027