BeagleBone Black Audio Cape Buffer Overruns

I'm currently struggling with the BeagleBone Audio cape on a BeagleBone black. I keep getting ALSA buffer xruns when capturing audio. Has anyone successfully done any recording using the audio cape and if so how did they do it?

I am currently running 3.13-rc7 mainline and I was experiencing the same behaviour on 3.8. Recording to a uSD card is worst, then eMMC and I have even seen buffer overruns when recording directly to tmpfs once or twice. I am worried that it may be a problem with the audio driver, or something is blocking interrupts for too long and the interrupt to empty the ALSA buffer is being missed.

Does anyone have any input?

Cheers,

The best “temporary solution” that worked for me was using SoX for recording audio (instead of the “arecord” command). I get just a few buffer overruns, once in a while…
But, definitely, this is not a solution. It would be nice if someone could clarify this issue.

Regards,

Ezequiel

Thanks Ezequiel, I'm currently chasing this down at a kernel driver level so will update if I manage to get anywhere. Good (?) to hear that I'm not the only one with problems.

I managed to fix my issues by hacking the buffer size of the driver in
the kernel. There is something still not quite right with the
implementation as the max_buffer_bytes seems to be calculated wrong
somewhere, but I can't seem to find where.

So, if you are interested in helping fix your buffer xrun problems I
would suggest changing the buffer_bytes_max value of the
snd_pcm_hardware capture struct in sound/soc/davinci/davinci-pcm.c,
256*1024 will give you 64K of buffer, rather than the current 32K.

Cheers,

I think the dma transfers that are happening due to writing to the uSD/eMMC are causing high latency in the IRQ's, which therefore stops data being pulled out of the buffer and as such overrunning.

I think there are a couple of factors to it in all honesty and this is just a quick fix, but to really fix it I think whatever IRQ is hogging the scheduler needs to be fixed.

I mentioned in my email the file that I was hacking in order to increase the buffer:

sound/soc/davinci/davinci-pcm.c

Which is part of the kernel. I am using 3.13, but i expect it will apply to 3.8 or whatever you are running too.

Cheers,