Other Parts Discussed in Thread: TLV320AIC3106
Hello TI Team!
I'm trying to get a low latency audio demo working on the SK-AM62x (GP) using Processor-SDK-Linux-RT (version 9.0.0.3). I have written a userspace application with ALSA that captures 3.5mm mic audio from a connected headset and plays back that same audio (we'll eventually be processing this audio - this is just for a proof-of-concept). This is using the SK-AM62x onboard 3.5mm connector and TLV320AIC3106 CODEC. Unfortunately, while this works for a period of time, as currently configured it will always result in a kernel error from the McASP driver regarding a transmit buffer underflow that seems to be unrecoverable.
Some application specific details:
- The playback and capture threads are pthreads with a scheduler policy of SCHED_FIFO and a task priority of 80. The capture thread stores the audio into a buffer and the playback thread writes the stored buffer – right now, there is no audio processing in these threads, so they are not computationally-intensive.
- The playback and capture PCM parameters are: 1 channel, 48000 sample rate, signed 16-bit samples and the period time is 5 ms (period size in frames = 240, buffer size in frames = period size * 2 = 480).
As I said, we are going for low latency, thus the small period time. At this time, I believe our questions are:
- With the current McASP kernel driver, is there a minimum period time that is supported? We see that 1 ms is not but no error is thrown with 5 ms and as I said this will work as currently configured for up to 23 hours.
- Are there other considerations to prevent a transmit buffer underflow, such as a higher thread priority than 80?
- This last question is more about recovery than the actual problem - is there any way to recover the McASP driver once it gets into this state? It seems calls to snd_pcm_prepare() correctly place the ALSA handle in the SND_PCM_STATE_PREPARED (instead of SND_PCM_STATE_XRUN), but further attempts to write to that handle fail and produce the same McASP kernel error printout.
Thanks so much for your help!