ES8336 can play sound, but the recorded file only has a noise floor

SDK 35.4.1
ES8336 is connected to I2S1 and I2C2(based on a previous project using I2S0 and I2C2)
I used the following command to record cap.wav

arecord -D hw:1,0 -f S16_LE -c 2 -r 44100 -d 5 cap.wav
Recording WAVE 'cap.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
[ 1868.770122] ------------[ cut here ]------------
[ 1868.774955] WARNING: CPU: 3 PID: 3488 at drivers/gpio/gpiolib.c:122 gpio_to_desc+0xb4/0x100
[ 1868.783865] ---[ end trace 01cc401fd835306d ]---

Before that, I also executed the following script with reference to a previous project that used I2S0

amixer -c APE cset name="ADMAIF1 Mux" "I2S4"
amixer -c APE cset name="I2S4 Mux" "ADMAIF1"
amixer -c APE cset name="ES Left Hp mixer Left DAC Switch" 1
amixer -c APE cset name="ES Right Hp mixer Right DAC Switch" 1

I changed I2S0 to I2S1 and commented out the 40-headers pinmux

diff --git a/hardware/nvidia/platform/t23x/p3768/kernel-dts/cvb/tegra234-p3767-common-audio.dtsi b/hardware/nvidia/platform/t23x/p3768/kernel-dts/cvb/tegra234-p3767-common-audio.dtsi
index 4da1a227d..d47679d56 100644
--- a/hardware/nvidia/platform/t23x/p3768/kernel-dts/cvb/tegra234-p3767-common-audio.dtsi
+++ b/hardware/nvidia/platform/t23x/p3768/kernel-dts/cvb/tegra234-p3767-common-audio.dtsi
@@ -10,7 +10,7 @@
 #include <audio/tegra186-audio-dai-links.dtsi>
 #include <audio/tegra186-audio-graph.dtsi>
 
-#define SPK_EN          TEGRA234_AON_GPIO(EE, 2) //GPIO10 #341 speaker eanble
+//#define SPK_EN          TEGRA234_AON_GPIO(EE, 2) //GPIO10 #341 speaker eanble
 
 / {
 	aconnect@2a41000 {
@@ -23,9 +23,10 @@
 		};
 	};
 
+	//i2s4
 	ahub {
 		status = "okay";
-		i2s@2901100 {
+		i2s@2901300 {
 		        status = "okay";
 		};
 	};
@@ -42,7 +43,7 @@
 		       #sound-dai-cells = <0>;
                        compatible = "everest,es8336";
                        reg = <0x10>;
-                       spk-con-gpio = <&tegra_aon_gpio SPK_EN GPIO_ACTIVE_HIGH>;
+                       //spk-con-gpio = <&tegra_aon_gpio SPK_EN GPIO_ACTIVE_HIGH>;
                        status = "okay";
                };
 
@@ -229,7 +230,7 @@
 
 // add by xiaoz
 //Specific overrides for I2S2 DAI link */
-&i2s2_to_codec {
+&i2s4_to_codec {
     link-name = "es8316-playback";
     codec {
         sound-dai = <&es8316_codec 0>;
diff --git a/hardware/nvidia/platform/t23x/p3768/kernel-dts/tegra234-sv-p3767-0000-p3509-a02.dts b/hardware/nvidia/platform/t23x/p3768/kernel-dts/tegra234-sv-p3767-0000-p3509-a02.dts
index 50a517ac4..0d95d0fa5 100644
--- a/hardware/nvidia/platform/t23x/p3768/kernel-dts/tegra234-sv-p3767-0000-p3509-a02.dts
+++ b/hardware/nvidia/platform/t23x/p3768/kernel-dts/tegra234-sv-p3767-0000-p3509-a02.dts
@@ -133,6 +133,7 @@
         };
 
         //es8316
+/*
         pinmux@2430000 {
                 status = "okay";
                 pinctrl-0 = <&audio_pinmux>;
@@ -187,5 +188,5 @@
                 };
 
         };
-
+*/
 };

Is there anything wrong and how can I debug this problem.

Hi,
As you are using I2S4 which is exposed from M.2.KEY E slot. The I2S4 pinmux and DT node should be enabled by default. Only change needed is to bind the codec with I2S4.

But am not clear on what issue are you facing. Does the I2S4 clock and data lines works. Can you provide the exact info on the problem you are facing.

+//define SPK_EN TEGRA234_AON_GPIO(EE, 2) //GPIO10 #341 speaker eanble
What is the purpose of this GPIO earlier as i see it was disabled now.

My problem is that when I played the .wav file I had recorded, I could’t hear the right recording (only noise).
I’m not able to measure the waveform because my NVME disk blocks the measurement point.
the GPIO10 was used to enable SPK, but now our custom board has no SPK design, this GPIO is used for other purpose now, So it was disabled there.

Is there a way to verify Playback and Capture separately with any Speaker connected on codec?. So we can isolate whether the issue with playback or capture. Also can you confirm during playback of any valid wavefile, the I2S signals like FS, BCLK, and DOUT are measured properly?

I test a valid wavefile , it could be well played. Does this mean it’s related to Capture? I 'm not able to measure the waveform util tomorrow.

Yes, then it should be related to capture path. As playback was working I2S clocks should also be proper. Can you check if DIN signal is proper

I measured the AUD3_RXD pin when recording





It looks like some data is sent in capture I2S DIN path. How about the capture data output, is it completely noisy or could make out some level of audio data.

As Playback was fine, mostly the Tegra I2S was working fine. If you want to validate this, connect I2S DOUT and DIN to isolate the issue from codec. So we can understand whether the noise is coming from Codec mic capture

is it completely noisy or could make out some level of audio data

I don’t know much about audio data waveforms, how can I figure out this?

connect I2S DOUT and DIN

connect these 2 pins and measure SDI again?

You can connect I2S SDOUT and SDIN signals by removing codec from it and try playback and record. The recorded file should be subjectively same as played audio without noise.

The recorded file should be subjectively same as played audio without noise.

I tried it, it’s the same.

So, this confirms the Tegra I2S is working fine. Can you check the codec HW connections for Mic path.