Jeston NX + audio Codec RT5640 cant work

Hi :
We has a issue when debug RT564,
The driver section contains rt5640. ctegra_rt5640 in the directory kernel/kernel-4.9/sound/soc.The hardware connection I2C is I2C2, and I2S is I2S1. The device tree is added according to the following steps for testing and error is found. The oscilloscope is used to measure I2S without signal output, please help to analyze.
1, device tree TEGRA194-AUDIO-P3668. DTSI modification:
i2c@3160000 {
rt5640: rt5640@1c {
compatible = “realtek,rt5640”;
reg = <0x1c>;
interrupt-parent = <&tegra_main_gpio>;
interrupts = <&tegra_main_gpio TEGRA194_MAIN_GPIO(Q, 5) IRQ_TYPE_EDGE_FALLING>;
realtek,ldo1-en-gpios =
<&tegra_main_gpio TEGRA194_MAIN_GPIO(R, 0) GPIO_ACTIVE_HIGH>;
sel_jd_source = <3>;
status = “okay”;
tegra_sound: sound {
status = “okay”;
compatible = “nvidia,tegra-audio-t186ref-mobile-rt565x”;
nvidia,model = “jetson-xaviernx-ape”;
clocks = <&bpmp_clks TEGRA194_CLK_PLLA>,
<&bpmp_clks TEGRA194_CLK_PLLA_OUT0>,
<&bpmp_clks TEGRA194_CLK_AUD_MCLK>;
clock-names = “pll_a”, “pll_a_out0”, “extern1”;
assigned-clocks = <&bpmp_clks TEGRA194_CLK_PLLA_OUT0>,
<&bpmp_clks TEGRA194_CLK_AUD_MCLK>;
assigned-clock-parents = <&bpmp_clks TEGRA194_CLK_PLLA>,
<&bpmp_clks TEGRA194_CLK_PLLA_OUT0>;

            nvidia,audio-routing =
                    "x Headphone Jack", "x HPOL",
                    "x Headphone Jack", "x HPOR",
                    "x Int Spk", "x SPORP",
                    "x Int Spk", "x SPORN",
                    "x Int Spk", "x SPOLP",
                    "x Int Spk", "x SPOLN",
                    "x IN1P", "x Mic Jack",
                    "x IN1P", "x MICBIAS1",
                    "x IN2P", "x Int Mic",
                    "x IN2P", "x MICBIAS1",
                    "x IN3P", "x Int Mic",
                    "x IN3P", "x MICBIAS1";
            mclk-fs = <256>;
            nvidia,dai-link-3 {
                    name-prefix = "x";
                    cpu-dai = <&tegra_i2s3>;
                    cpu-dai-name = "I2S3";
                    link-name = "rt5640_playback";
                    codec-dai = <&rt5640>;
                    codec-dai-name = "rt5640-aif1";

                    format = "i2s";
                    bit-format = "s16_le";
                    bclk_ratio = <0>;
                    srate = <48000>;
                    num-channel = <2>;
                    status = "okay";

            hdr40_snd_link_i2s: nvidia,dai-link-5 {
                    name-prefix = "x";


2:use: speaker-test -c2 -twav -D plughw:CARD=jetsonxaviernxa,DEV=0
An error appears:
Time per period = 0.056267

0 - Front Left

1 - Front Right

Write error: -32,Broken pipe

Time per period = 0.056780

0 - Front Left
Oscilloscope measures I2S without signal output, please help to see how to add audio module of NX platform?


The first thing that you need to check is that the pinmux for the I2S pins are configured correctly. Are you using the Jetson Xavier NX devkit or the Jetson Xavier NX module with another board?

You can check the pinmux by executing the following …

$ sudo grep dap3 /sys/kernel/debug/tegra_pinctrl_reg
Bank: 0 Reg: 0x02431048 Val: 0x00000440 -> dap3_fs_pt4
Bank: 0 Reg: 0x02431050 Val: 0x00000450 -> dap3_din_pt3
Bank: 0 Reg: 0x02431058 Val: 0x00000400 -> dap3_dout_pt2
Bank: 0 Reg: 0x02431060 Val: 0x00000440 -> dap3_sclk_pt1

You should see the above.

If that looks good then please refer to this thread.


Hi Jon:
We use our customize carrier board, pinmux looks good, hardware port is I2S1,
what port we need set on software? I2S3?


Looking at the pinmux spreadsheet you will see that I2S1 on the module maps to DAP3 on the Tegra SoC and so yes I2S3 is the correct interface.


hi Jon:
got it,will try this one,thanks