Thanks. The loopback works with I2S1 loopback on. I noticed that the file I played has 5.1 surround sound in it, but the recorded wav file only contain 2 channels. Any idea?
So 5.1 channels, implies that there are 6 channels. When using aplay and arecord, make sure you set the number of channels to 6. In other words, ‘-c 6’.
I am able to capture with loop back. But somehow, when I play the attached wav file that includes 5.1 surround sound as
aplay -D hw:0,8 -c 6 -f S32_LE /root/n51441.wav
I only capture 2 channels. I verified that with a scope on the I2S1’s dout; I can see that within one f-sync period, I only have one or two channels. Can you see if my control is properly configured. And see if you can play this short wav file and be able to see 6 channels.
To play multi-channel audio via the I2S interface, you need to configure the I2S for TDM mode (ie. dsp-a or dsp-b mode). This can be configured by either device-tree for the I2S interface or if you have the latest L4T release you should be able to set via …
root@nvidia:/# amixer -c 0 cset name='I2S1 fsync width' 0
amixer: Cannot find the given element from control hw:0
Also, aplay sated 6 channels:
root@nvidia:~# aplay -D hw:0,8 -c 6 -f S32_LE /root/n51441.wav
Warning: format is changed to S16_LE
Playing WAVE '/root/n51441.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Channels 6
My scope displayed clearly two “chunks” (channels) instead of 6 channels in a TDM frame on I2S1 dout line. My capture command is
arecord -D hw:0,0 -c 6 -f dat -d 70 /tmp/test-mic.wav
I checked the latest L4T rel28 for TX2 and it does not have the mixer control for ‘I2S1 fsync width’ and so yes that will not work indeed. Don’t worry about this for now.
Thanks so much. Attached is the entire device tree showing all the nvidia,dai-link properties:
So while playing the wav file
root@nvidia:~# aplay -D hw:0,8 -c 6 -f S32_LE /root/n51441.wav
Warning: format is changed to S16_LE
Playing WAVE '/root/n51441.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Channels 6
Attached is also the screen shot of the I2S1, and you can see only 2 channels are on the dout. The wav file was attached earlier in this thread. Let me know if you can find anything. Thanks again. attachment.tar.gz (4.64 MB)
Looking at the I2S configuration, it appears to be configured for 8 channels and not 6. What does the following command show …
file /root/n51441.wav
The I2S configuration shows that there are 32-bits for the frame-sync. Do you see 32-bits of data on dout? I am wondering if you are only seeing 1 channel on dout and not two.
I see 32 bits for the f-sync and I see two channels, each 16 bits. See the attached zoom-in scope shot. I confirmed that by playing a single channel wav, which only occupy half of the f-sync.
I think that the problem is mostly likely because you are using the ‘nvidia,tegra-audio-t186ref-p2382’ driver. For L4T we do all the validation with the ‘nvidia,tegra-audio-t186ref-mobile-rt565x’ machine driver. I believe that because you are using driver and you have 8 channels specified in the device-tree file it is using 8 channels (which is what I see in the I2S registers). So I recommend that you use the ‘nvidia,tegra-audio-t186ref-mobile-rt565x’ driver.
What version of L4T are you using? The frame-sync appears to be inverted which indicates that you may not have the latest L4T release for TX2 which is rel28.2. I recommend that you use this version as well.