RT5640 does not work on Orin NX

Dear all,

I have been attempting to port the audio codec rt5640 to the Orin NX platform.
Below is the hardware schematic, where GPIO11 is connected to the GPIO1/IRQ of rt5640.

The following are the files I’ve modified:

  1. Modified the Orin NX pinmux and generated a DT file using Excel.
    The image below shows the options that have been changed in the pinmux.

    Additionally, based on this [forum post], I have set the pull parameter to TEGRA_PIN_PULL_DOWN for the
    following nodes:
    Replaced the original files with tegra234-mb1-bct-gpio-p3767-dp-a03.dtsi in /Linux_for_Tegra/bootloader and tegra234-mb1-bct-pinmux-p3767-dp-a03.dtsi in /Linux_for_Tegra/bootloader/t186ref/BCT.
    After replacing the files, I flashed the Orin NX.
    Note: Modified tegra234-mb1-bct-gpio-p3767-dp-a03.dtsi and tegra234-mb1-bct-pinmux-p3767-dp-a03.dtsi are included in the attachment.

  2. Used tegra234-p3737-audio-codec-rt5640.dtbo to overwrite the system’s dtb file.
    I made the following modifications to tegra234-p3737-audio-codec-rt5640.dtbo:
    Changed the location of rt5640 from 31e0000 to 3160000.
    Changed i2s1_dap_ep and i2s1_to_codec in fixups to i2s2_dap_ep and i2s2_to_codec.
    Note: Modified tegra234-p3737-audio-codec-rt5640.dtbo and the decompiled using dtc are included in the attachment.

  3. Configured various ALSA mixer controls using a script file, which is included in the attachment.

The following tests have been conducted on the system:

  1. Used i2cdetect to detect and confirm that rt5640 is being called by the kernel module.
  2. After overlay, snd-soc-rt5640 appears in the lsmod output.
  3. $cat /proc/asound/cards.

Best regards,

attachment :
tegra234-mb1-bct-gpio-p3767-dp-a03.dtsi (3.6 KB)
tegra234-mb1-bct-pinmux-p3767-dp-a03.dtsi (65.7 KB)
rt5640.dtbo (3.1 KB)
rt5640.dts (3.1 KB)
setHPout.sh (1.2 KB)

Hi karee002eg

You are able to register the codec and setup codec mixer controls too. Great job.
Now, can you describe about the issue you are facing ?

Hi @spujar

When I use “amixer” to modify registers, such as by executing “source setHPout.sh”,
or when I use “aplay” to play an MP3 file, like “aplay sound.mp3”,
I observe that the voltages on the I2C, I2S, and interrupt of the rt5640 do not change, as seen on the oscilloscope.

Here are the specific observations:

SCL and SDA:
Upon power-on, both SCL and SDA transition from 0 to 1 automatically.
When “amixer” commands are executed, there is no change in SCL and SDA.
When the “i2cdetect” command is executed, changes will occur in SCL and SDA

After power-on, MCLK waveform remains at a constant frequency.

While using “aplay” to play an MP3 file, there is no change in DACDAT1 and ADCDAT1.

Starting or stopping playback using “aplay” does not lead to any changes in GPIO/IRQ.

Could this be a problem caused by incorrect sound card settings?
If so, I would like to ask for your assistance in configuring the sound card.

Hi karee002eg

Sorry for the delay.

Can you share kernel logs and mention if you see any errors during amixer and aplay commands?

Do you see any error here?
Can you try by reading the control to confirm if the setting is done? For example set something and read the control back.

MCLK is supposed to get activated when playback or capture is running. So measure this when aplay is running.

Don’t use mp3 file. Use a wav file and then measure.

Possible, but need to understand what is exactly going on.

Hi @spujar

After further inspection, I found that the issue was with the codec multiplexer not being configured correctly.

After configuring it properly, the rt5640 is now able to start up normally.

Thanks again for the assistance you provided.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.