Sorry, you need to enable JavaScript to visit this website.

I2S Audio linux reference design

Unsolved
17 posts / 0 new
metinburak_'s picture
metinburak_
Junior(1)
I2S Audio linux reference design

Hi,

Could somebody found an I2S (not HDMI) reference design and kernel w driver for the onboard audio codec adau1761 for linux?
The analog devices reference design's design tree source comments out the I2S device. Digilent reference design uses the HDMI device and the xillybus reference design is buggy that, rebooting make the onboard sound codec randomly out of order.

Is there someone using the I2S audio codec with Linux without problem?

Thanks in advance.

eli's picture
eli
Junior(1)
Hello,

Hello,

The problem with sound support in Xillinux is related to pulseaudio, which sometimes doesn't start properly. This will hopefully be fixed in the next Xillinux release by launching pulseaudio at a later stage in the boot process. The exact reason for this issue is unknown. Pulseaudio is known for its somewhat unexpected behavior.

In the meanwhile, I see two alternatives:

1. Disable pulseaudio altogether, and use /dev/xillybus_audio directly for receiving and sending raw sound samples @ 48 KHz sample rate. As a matter of fact, most WAV files will play well just by cat'ting them to /dev/xillybus_audio.

2. Restart pulseaudio with pulseaudio -k and then pulseaudio -D when it fails to expose real sounds interfaces.

I hope this helps.

Eli

metinburak_'s picture
metinburak_
Junior(1)
xillinux

Hi Eli,
Is the release date of new Xillinux decided?

Can you suggest the edit about the pulseaudio's starting point in the initial script?

Thank you

metinburak_'s picture
metinburak_
Junior(1)
/dev/xillybus_audio

catting a wav file to /dev/sillybus_audio works but when i try again, it says device or resource busy. Also i can not make any adjustments of the volume and sampling rate in that way.

eli's picture
eli
Junior(1)
Hi,

Hi,

The sound interface is somewhat neglected in Xillinux, because very few, if anyone, seem to have used it as a critical feature, which is why the issue you're facing hasn't been investigated.

Let's start with "device or resource busy" when trying to open /dev/xillybus_audio. This simply means that some other process has the device file open in that direction.

Regarding the pulseaudio issue -- as I mentioned earlier, the exact reason for this is not verified, but I suspect that the problem is that sometimes the /dev/xillybus_audio device file hasn't been created when the upstart script for the sound device runs.

This is why I don't suggest waiting for the next release of Xillinux -- this hasn't been investigated well enough to ensure that the problem has been solved.

The current upstart script, /etc/init/zedboard-sound.conf, says:

start on filesystem

task

script
/usr/bin/pulseaudio -D || true
exec /usr/local/bin/zedboard_sound_setup.pl
end script

The problem seems to be that the "filesystem" event is triggered off before /dev/xillybus_audio exists (sometimes?). This can be solved in two ways:

(1) Delete /etc/init/zedboard-sound.conf, and explicitly start pulseaudio and zedboard_sound_setup.pl before running your target application.
(2) Make sure that the device file exists before starting pulseaudio, e.g. change the init script to

script
while [ ! -c /dev/xillybus_audio ] ; do sleep 1 ; done
/usr/bin/pulseaudio -D || true
exec /usr/local/bin/zedboard_sound_setup.pl
end script

I hope this gets you going.
Eli

metinburak_'s picture
metinburak_
Junior(1)
Sound script

I deleted /etc/init/zedboard-sound.conf, and explicitly started pulseaudio and zedboard_sound_setup.pl and got the error failed to program the soundchip timeout

metinburak_'s picture
metinburak_
Junior(1)
pulseaudio -k and pulseaudio -D || false

Hi,

When the sound card is out of order at startup, without deleting the /etc/init/zedboard-sound.conf, i manually killed and started the pulse audio 2 times, then
# alsamixer -D pulse
gives the sound device and the aplay works. I will try this several times and tell the results here.

(By the way, I changed the pulseaudio script's priority in the rc 0X files, from S50 to S98. But it didn't work alone.)

eli's picture
eli
Junior(1)
Hi,

Hi,

I can't see any reason why zedboard_sound_setup.pl would fail. If this repeats itself, please detail exactly what you did.

I would suggest removing all pulseaudio related files in the rc.d subdirectories (i.e. S50pulseaudio and such). I'm under the impression that they aren't executed anyhow, and if they are, it's not helpful. It's the upstart script that should bring up the sound interface.

Also, if you choose to manually start pulseaudio, I'd suggest removing the upstart file as well, rather than killing pulseaudio. Even though I have quite some experience with killing that process (on my desktop in particular) I'm not sure it's good practice for a production system.

As a side note, I'd point out that you can use

pacmd list-sinks

to tell if Pulseaudio detected Xillybus audio. So it's possible to write a little shell script that checks if everything is fine, and if not, restart pulseaudio and try again (hopefully with a short sleep and maybe a count limit to prevent this from going crazy). Not the most elegant solution, but if everything else fails...

metinburak_'s picture
metinburak_
Junior(1)
rc.local

A script in the rc.local killing and starting pulseaudio 2 times subsequently with 2 seconds sleeps between makes everything fine.

eli's picture
eli
Junior(1)
Hi,

Hi,

Glad to hear that you found a way to make it work. Did you try any of my other suggestions? Did they fail?

Just for my own curiosity...

Eli

metinburak_'s picture
metinburak_
Junior(1)
suggestions

The script was based on your suggestion that the problem was about pulseaudio and you may fix it in the latter xillinux distribution by changing the init stage of the pulseaudio. In case, I just killed the pulseaudio and restarted it in the /etc/rc.local file then it never crashed again.

Thank you very much.

metinburak_'s picture
metinburak_
Junior(1)
Crash

After subsequent reboots, the system crashed in the way that it plays a wav file but no sound is heard from speakers, despite the sound card is seen by alsamixer

metinburak_'s picture
metinburak_
Junior(1)
Also by cat .wav > /dev

Also by cat .wav > /dev/xillybus_audio no sound is heard

metinburak_'s picture
metinburak_
Junior(1)
exec /usr/local/bin/zedboard

exec /usr/local/bin/zedboard_sound_setup.pl

returns failed to program the sound chip (timeout)

When i change the sleep valuein the first if fork() == 0;

it also terminates with timeout

So I cannot program the sound chip explicitly

metinburak_'s picture
metinburak_
Junior(1)
cat .wav > /dev/xillybus_audio

cat .wav > /dev/xillybus_audio also doesn't hear any sound

eli's picture
eli
Junior(1)
Hi,

Hi,

There's apparently a problem with the programming of the chip. There is a possible issue with the state machine, which was fixed for the next release of Xillinux, but given that noone ever complained about this before, there was no hurry to update the distribution with this fix. Your complaint is the first indication that the theoretical problem may have an impact.

I'm sending you a patch separately.

Thanks for your patience.
Eli

metinburak_'s picture
metinburak_
Junior(1)
patch

The patch is working,

Thank you very much.