I'm working on a audio application hardware as mentioned in this post.
The hardware has multiple codecs sharing the same SAI audio lines and separated based on the offset in the Frame.
TDM mode: 256 bit frame consists of 16 channels and 16 bit data per channel.
The hardware runs with the Linux and the ALSA is configured in such a each 16 channels can be separately used to record and playback.
In this setup, I'm able to record audio clearly on each channels separately. But having two kinds of issues with playback.
Those are,
1. The audio playback is not clear, output always has distortion noise.
2. The audio playback on a channel is always generating static noise in the adjacent channel.
I took below steps to find the root cause for the noise,
1. The codec could be the source:
Made a hardware loopback (connected the codec's TX to RX) with the mic and speaker connected. There is no distortion or noise in output.
2. The ALSA plugin could be the source:
I was able to print each frame formed in the alsa user library as shown below, there is no overlap on the adjacent channel and check that the frame contains the exact value of the content of the wave file.
0000: 1D 0B 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................
0010: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................
3. The kernel ALSA PCM core could be the source:
a. The user alsa library writes the audio frames on the /dev/snd/pcmC0D0p file
b. The kernel ALSA PCM core opens the /dev/snd/pcmC0D0p file maps it to the DMA engine
Whenever I try to print the frames written on the /dev/snd/pcmC0D0p file, I'm getting kernel panic.
How to check the audio data in the kernel end before DMA picks it?
What could be the reason for the for the noise?