AnsweredAssumed Answered

ALSA buffer underruns with adau1761 and axi-i2s

Question asked by dmarcosgon on Apr 17, 2015
Latest reply on Apr 17, 2015 by larsc

Hello,

 

We're trying to use the iio-fm demodulator example application with a RF FMC card (our design but based on fmcomms1) connected to a zedboard, and we want to output the demodulated audio via zedboard's adau1761 codec. We're compiling the kernel from analog's git xcomm-zynq branch just adding some RF related drivers required for our card and we're using the linaro distribution provided for fmcomms cards.

 

We already tried this some time ago and it worked just as expected without problems. Now we've updated to the latest kernel and we get bad sound related to continuous ALSA underruns. We just run the iio-fm app piped to aplay configured with the correct samplerate and format. It only works relatively well (only 2-3 underruns at the start and then all goes ok) if we either increase aplay's buffer size to about 10 seconds or if we force aplay interrupts to happen much faster than usual. If we try with a wav file instead of fm demodulator we also get underruns that can be solved by increasing buffer size or interrupt rate.

 

It's strangre because if we try to play a 30-seconds wav file we hear "accelerated" audio between underruns that happen very fast and the whole playback process only takes about 3 seconds. We think it's not something related to bad format because when we increase the buffer size with the same format configuration it just works and plays all 30 seconds with great quality. We've also checked audio clocks to be 12.288MHz and they're spot-on

 

If we output the audio through HDMI with aplay using ADV7511's axi-spdif interface everything works OK. We've also tried with a different and much simpler  i2s codec (TI's PCM1754) connected to an axi-i2s core and we get the same behaviour, underruns all the time.

So I think the problem might be related to some recent kernel update that somehow interferes with axi-i2s core and that somehow makes linux unable to handle interrupts on time or something like that. I've read that people experienced a similar problem after a relatively recent update with raspberry-pi and they narrowed it down to be something related to cpu throttling, but the symptoms here are a bit different from theirs.

 

Any clue?

Last time we tried this and worked 100% fine with no underruns was about 6 months ago.

Outcomes