TLV320ADCX140 with Jetson Nano

Hello,

I tried to interface the Texas Instrument TLV320ADC6140 on JetsonNano to record a TDM stream of 4 channels (32 bits 48kHz).
The kernel driver of this ADC was developed under kernel > 5.X, so I modified the tlv320adcx140 driver to be compatible with jetson nano kernel. You will find the driver sources attached.

I recompiled the jetson kernel and I didn’t get any errors.

I also modified the device tree of the jetson nano to:

  • Configure the pin muxing
  • Enable I2S and I2C on jetson nano board
  • Attach audio codec to correct I2S and I2C ports
    You will also find attached the device tree “tegra210-porg-p3448-common.dtsi” (please take a look to “tegra_sound” and “hdr40_i2c1” paragraphs).

Next, I reflash the jetson nano SD card and I can see with dmesg command that the codec is correctly registered and I2C communication with the ADC is working.
When I run alsamixer, I can see all the codec kcontrol parameters.

Then I tried to configure I2S using amixer by typing these commands :
>amixer -c tegrasndt210ref cset name =”I2S4 Mux” “ADMAIF1”
>amixer -c tegrasndt210ref cset name =”I2S4 fsync width” 0
>amixer -c tegrasndt210ref cset name =”I2S4 codec master mode” “cbs-cfs”
>amixer -c tegrasndt210ref cset name =”I2S4 codec frame mode” “dsp-a”

When I run the command :>arecord -D hw:tegrasndt210ref,0 -r 48000 -c 4 -f S32_LE test.wav, I do not see any clock coming out of the jetson nano and I have the following error :
arecord: pcm_read:2103: read error: Input/output error

I think it’s a routing problem but the configuration of ALSA in the Jetson nano environment is complicated and poorly documented.
Do you have an idea?
Thank you.
tlv320adcx140.h (4.2 KB)
tegra210-porg-p3448-common.dtsi (22.0 KB)
tlv320adcx140.c (32.7 KB)

Hi Dorian,

If the audio path is not configured correctly, then it is possible that the DAPM widget for the I2S will not be turned on and so you will not see the clocks running. I see ADMAIF Mux is not set correctly and also codec routing.

For capturing audio, map the I2S4 interface to the ADMAIF1 interface with below command.

amixer -c tegrasndt210ref cset name=“ADMAIF1 Mux” “I2S4”
amixer -c tegrasndt210ref cset name=“I2S4 fsync width” 0
amixer -c tegrasndt210ref cset name= “I2S4 codec master mode” “cbs-cfs”
amixer -c tegrasndt210ref cset name=“I2S4 codec frame mode” “dsp-a”

And then record on ADMAIF1 …
arecord -D hw:tegrasndt210ref,0 -r 48000 -c 4 -f S32_LE test.wav

amixer -c tegrasndt210ref cset name=“I2S4 Mux” “ADMAIF1” is for playback path;

About routing, could you please use below routing; also refer to TLV320ADCx140 audio adc with TX2 - #31 by jonathanh

nvidia,audio-routing =
"x MIC1P”, “x Mic”,
“x MIC2P”, “x Mic”,
“x MIC3P”, “x Mic”,
“x MIC4P”, “x Mic”,
“x Capture”, “x CH1_ADC”,
“x Capture”, “x CH2_ADC”,
“x Capture”, “x CH3_ADC”,
“x Capture”, “x CH4_ADC”;

Regards,
Ramesh

Hello Ramesh,

Thank you for your answer.
I modified the device tree according your recommandations, you’ll find the modified device tree attached.

I no longer have any errors when i launch “arecord” command. A WAV file is created but is NULL.
There is still no clock either.

Do you know why the clocks are not generated?
Maybe can it be a GPIO configuration problem?
Thank you.

Best regards,
Dorian LE RENARD.
tegra210-porg-p3448-common.dtsi (22.1 KB)

Hi Dorian,
Could you please confirm the I2S4 pin mux configuration sets correctly?

sudo grep dap4 /sys/kernel/debug/tegra_pinctrl_reg

Expected values:
Bank: 1 Reg: 0x70003144 Val: 0x00000044 → dap4_fs_pj4
Bank: 1 Reg: 0x70003148 Val: 0x00000044 → dap4_din_pj5
Bank: 1 Reg: 0x7000314c Val: 0x00000004 → dap4_dout_pj6
Bank: 1 Reg: 0x70003150 Val: 0x00000044 → dap4_sclk_pj7

Please also refer to configure I2S4 pin mux settings: Audio codec in Jeston nano - #6 by mkumard

Hello Dramesh,

I confirm that the I2S4 pinmux configuration is set correctly :

Bank: 1 Reg: 0x70003144 Val: 0x00000044 → dap4_fs_pj4
Bank: 1 Reg: 0x70003148 Val: 0x00000054 → dap4_din_pj5
Bank: 1 Reg: 0x7000314c Val: 0x00000044 → dap4_dout_pj6
Bank: 1 Reg: 0x70003150 Val: 0x00000044 → dap4_sclk_pj7

We resolved our problem. The jetson nano produces now clocks (FSYNC and BCLK) and I2S is working.

We finally get to make the i2S work by modifying register values in U-Boot, as described in this post (Audio I2S on 40 Pin Connector - #17 by jonathanh).

We try now to configure correctly the device tree to avoid manually entering the U-Boot each time we boot up.

We modified the pinmux file “tegra210-porg-pinmux-p3448-0000-b00.dtsi” and now it’s OK for these registers:

# mw 0x70003144 0x6044
# mw 0x70003148 0x6044
# mw 0x7000314c 0x6044
# mw 0x70003150 0x6044

But for the last register GPIO_CNF (0x6000d204), it keep always the value 0xF0 and we have to modify it manually.

We found a temporary solution by changing the U-Boot environment variable “bootcmd” :

setenv bootcmd 'mw 0x6000d204 0; run distro_bootcmd'  
saveenv

This solution doesn’t seem very good for me.
Without recompiling the u-boot, is there another solution to change the register value? (Using device tree for example)

Thank you in advance.
Best regards,
Dorian LE RENARD.

Hi Dorian,
You can use Jetson-IO tool to configure I2S4 pinmux with below command

$ sudo /opt/nvidia/jetson-io/config-by-function.py -o dtb i2s4
$ sudo reboot

Details on this tool can be from [here]( NVIDIA Jetson Linux Driver Package Software Features : Hardware Setup | NVIDIA Docs

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