TX2 I2S Sound is not work on Speaker

Hi All

I have question with tx2 sound setting .
but i have some of problems.

  1. speaker is not work

amixer -c 1 sset ‘I2S1 Mux’ ‘ADMAI1’
is works well .

but My goal is GPIO → i2s2 → TX2 → I2S1 → codec → speaker.
amixer -c 1 sset ‘I2S1 Mux’ ‘I2S2’

i setted like this and data is coming and check by scope. but speaker is not work.
but I2S_SIN data is work and pass to audio codec but I2S LRCLK freq 67,20 khz… but i tried setting 48khz
i think that i need more setting but i cant find what is.
but recording is works

  1. record issue
amixer -c 1 sset "ADMAIF2 Mux" "I2S2"  
arecord -D hw:1,1 -f S16_LE -t wav  -r 48000 test.wav

recording noisy and signal is weird and I2S LRCLK freq 67,20 khz but input singal is 48k.
what should i do?

  1. spdif-dit-1’srate is tried to set 44.1k can i change to 48k?
> 		rt565x_dai_link: nvidia,dai-link-1 {
> 			 link-name = "alc5633-playback"; 
> 			cpu-dai = <&tegra_i2s1>;
> 			codec-dai = <&alc5633_codec>; 
> 			cpu-dai-name = "I2S1";
> 			codec-dai-name = "alc5633-hifi"; 
> 			format = "i2s";
> 			bit-format = "s16_le";
> 			srate = <48000>;
> 			num-channel = <2>;	
> 			ignore_suspend;
> 			name-prefix = "x";
> 			status = "okay";
> 		};
> 
> 		nvidia,dai-link-2 {
> 			link-name = "spdif-dit-1";
> 			cpu-dai = <&tegra_i2s2>;
> 			cpu-dai-name = "I2S2";
> 			codec-dai = <&spdif_dit1>; 
> 			codec-dai-name = "dit-hifi";
> 			format = "i2s";
> 			bit-format = "s16_le";
> 			srate = <48000>;
> 			num-channel = <2>;	
> 			ignore_suspend;
> 			name-prefix = "y";
> 			status = "okay";
> 		};

DT setted 48k but something change that

ref : [ How to receiving Audio input data through GPIO on TX2 ]

Our team will investigate this issue to have suggestion.

dear kayccc
i have another question … can i force to enable I2S1?
because I2S2 record is works but speaker sound doesnt work.
i testing sound command and it is can hear something.

amixer -c 1 sset "I2S1 Mux" "I2S2"  

gst-launch-1.0 -e audiotestsrc wave=silence ! ‘audio/x-raw, format=S16LE, rate=48000, channels=2’ ! queue ! alsasink device=hw:1,1

i think that audio route or widget, dapm setting has problem.
signal is coming but codec or audio route is not enabled.

amixer_controls.txt (53.1 KB)

audio trace : alsa_trace.txt (60.4 KB)

Hi nkw3000,

Thanks,
Sharad

Hi sharadg
I checked your points but i found something problem with I2S0 SOUT and I2S1 SDIN signals from tx2 pins.
JP ver is 4.4

I2S0 SOUT (to codec) signal’s width is more 2 time larger than I2S1 SDIN signals (input) .
but I2S0_LRCLK and I2S1 is same.

amixer -c 1 sset 'I2S1 Mux' 'ADMAIF1'
amixer -c 1 sset 'ADMAIF2 Mux' 'I2S2'
gst-launch-1.0 alsasrc device=hw:1,1 ! 'audio/x-raw, format=S16LE, rate=48000, channels=1' ! queue ! alsasink device=hw:1,0 

gst-launch-1.0 alsasrc device=hw:1,1 ! ‘audio/x-raw, format=S16LE, rate=48000, channels=2’ ! queue ! alsasink device=hw:1,0 sync=false


I2S2 SDIN (input) signals input signal output have to same this


I2S1 SOUT (output to codec) output… is changed


CLK singals are same

… I2S SRCLK SDIN , SDOUT clks are 1.5 mhz and same too

and MCLK is 9.6 Mhz clk_summary has same value too

Hi nkw3000,

Please confirm if I2S1 and I2S2 are working fine individually before trying I2S2->I2S1 usecase
i.e
1)If recorded data is clean in I2S2->ADMAIF2 usecase
amixer -c 1 sset “ADMAIF2 Mux” “I2S2”
arecord -D hw:1,1 -f S16_LE -t wav -r 48000 test.wav
BCLK, LRCK should be ~1536000 and ~48000 respectively for the given usecase

2)If playback data with appropriate codec mixer settings in addition to below path setup is working fine
amixer -c 1 sset ‘I2S1 Mux’ ‘ADMAIF1’
aplay -D hw:1,0 some_48k_16LE_stereo.wav
NOTE: MCLK for ALC5633 should be 256fs or 384fs i.e 12.28 MHz or 18.432MHZ as per datasheet.
Individual playback would have failed if MCLK is not set as per datasheet guideline. Please correct this and see if it helps.
BCLK, AUD_MCLK, LRCK should be ~1536000, ~12288000 and ~48000 respectively for the given usecase

3)If both are working fine individually, I2S2->I2S1 usecase can be attempted. Ensure that both i2s are configured for similar audio parameters in DT.

Apart from providing status of each of the above usecase, provide the clock summary (cat /sys/kernel/debug/clk/clk_summary)
and rates observed @ BCLK, LRCK and AUD_MCLK during 1) playback alone and 2) capture alone and 3) during I2S2->I2S1 usecase to check this further

Thanks

Hi, atalambedu

  1. i checked I2S1 and I2S2 indiviually
    and 'arecord -D hw:1,1 -f S16_LE -t wav -r 48000 test.wav ’ have same problem. sound is same as I2S1 waves.
    BCLK, LRCK is 1536000 and 48k

knocking door sound and it likes noisy

  1. MCLK setted 256, and both have same values.
    and i checked clocks and BCLK, AUD_MCLK, LRCK is good .

  2. /sys/kernel/debug/clk/clk_summary is i2s1, i2s2 is same and 1536000.

I think 1 is problem and i checked and changed pinctrl too but not changed.

pinmux.0x02434018 = 0x00000440; # dap2_sclk_pc1: i2s2, tristate-disable, input-enable, lpdr-disable
pinmux.0x02434008 = 0x00000400; # dap2_dout_pc2: i2s2, tristate-disable, input-disable, lpdr-disable
pinmux.0x02434000 = 0x00000458; # dap2_din_pc3: i2s2, pull-up, tristate-enable, input-enable, lpdr-disable
pinmux.0x02434010 = 0x00000440; # dap2_fs_pc4: i2s2, tristate-disable, input-enable, lpdr-disable

pinmux.0x02431040 = 0x00000440; # dap1_sclk_pj0: i2s1, tristate-disable, input-enable
pinmux.0x02431038 = 0x00000440; # dap1_dout_pj1: i2s1, tristate-disable, input-enable
pinmux.0x02431030 = 0x00000450; # dap1_din_pj2: i2s1, tristate-enable, input-enable
pinmux.0x02431028 = 0x00000440; # dap1_fs_pj3: i2s1, tristate-disable, input-enable
pinmux.0x02431020 = 0x00000400; # aud_mclk_pj4: aud, tristate-disable, input-disable

Hi nkw3000,

From above comment clocks look good. The recorded wav file (test.wav) in I2S2->ADMAIF2 path is having issue i.e noisy.
Can you elaborate on the capture path connection (i.e GPIO → I2S2) i.e the source of I2S2 (BCLK, LRCK, Data IN) lines to understand this further.

Also, play some clean file on I2S1 and confirm if its playing fine on ALC5633 codec. From previous comment, its not clear if I2S1 is working fine individually.

Thanks

Hi, atalambedu

I2S1 is good and we used that before and tested a lot. And checking 44.1 khz and 48 khz too.

GPIO line is external devices issues and they are solved now.
I checked lines of I2S2 BCLK, LRCK, Data IN signals
(R1001, R1002[not use] , R1003, R1004)
i2s1

i want to makes I2S2 Data in and I2S1 Out signals same.
noise is not problem now.

Hi nkw3000,

Thanks for confirming playback path has no issues. Suspecting that I2S2 is set in master mode (i.e cbs-cfs) where Jetson I2S2 would be generating the bitclock and might be causing misallignment.

We suggest to try capture with below setting. This will set I2S2 in slave mode so that it receives bit clock and frame clock from external device and may avoid noise in recorded audio. Ensure external blck and lrck is getting generated during the below capture
amixer -c 1 cset name==“I2S2 codec master mode” “cbm-cfm”
amixer -c 1 sset ‘ADMAIF2 Mux’ ‘I2S2’
arecord -D hw:1,1 -f S16_LE -t wav -r 48000 test.wav

Thanks

Hi atalambedu
Thanks to reply

I2S2 was setted slave modes and setted again

amixer -c 1 sset ‘I2S2 Channels’ 2
amixer -c 1 sset ‘I2S2 Sample Rate’ 48000
amixer -c 1 sset ‘I2S2 codec bit format’ 16
amixer -c 1 sset ‘I2S2 codec frame mode’ ‘i2s’
amixer -c 1 sset ‘I2S2 codec master mode’ ‘cbs-cfs’
amixer -c 1 sset ‘I2S2 input bit format’ 16
but nothing changed

and I tested your commna result is here
arecord: pcm_read:2103: read error: Input/output error

Hi nkw3000,
Above observation confirms that external LRCK/BCLK are not functional. So, let the Jetson I2S operate in master mode (cbs-cfs).

Before we send data from I2S2 to I2S1 via gst, We ned to ensure I2S2 capture is clean. In the earlier comments, you have provided circuitry for I2S2 DIN connection.
It seems to be connected to other pin. But source for this pin is not clear. What device is connected to these GPIO lines that are connected to I2S2.
Is there any datasheet for this device that records data and passes to I2S2 via the GPIO lines. Please share the detail as external configuration might be causing issue.

Thanks

Hi atalambedu
I sorry to confuse that.
GPIOs are External devices’s pin and they can be multi purpose and External device I2S signals are pass through to I2S2 pins. I already compared I2S2 SDIN signals and that is first screenshot.

Hi nkw3000,

  1. I hope I2S2 capture is clean and noise problem is not there : please confirm yes/no

  2. If yes, what is the behaviour you now get with gst command for I2S2->I2S1?

  3. What is the gst command you used

  4. Any error logs after gst command?

Please answer all 4 questions. Number the answers to queries to avoid confusion

Thanks

Hi atalambedu

i got something wrong with I2S2 capture.
I2S2’s input signal is different with normal I2S1’s signal when 48k wav is play.
so I asked hw and waiting answer.
Thanks!