Enable audio(I2S) on Jetson nano emmc(p3448-0002) with Jetson carrier board(p3450)

I succeeded in enabling audio on the Jetson nano dev module(p3448-0000) with an above carrier board. I used jetson_io.py for enabling, but the Jetson nano module(p3448-0002) is not working with jetson_io.py.
On jetson_io.py, I enabled I2S4 on 40 pin header config. (12 - i2s4b_sclk, 35 - i2s4b_fs, 38 - i2s4b_din).

For now on Jetson nano emmc(p3448-0002)
I edited pinmux dtsi file “tegra210-porg-pinmux-p3448-0002-XXX.dtsi” to

            dap4_din_pj5 {
				nvidia,pins = "dap4_din_pj5";
				nvidia,function = "i2s4b";
				nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			};

			dap4_dout_pj6 {
				nvidia,pins = "dap4_dout_pj6";
				nvidia,function = "i2s4b";
				nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			};

			dap4_fs_pj4 {
				nvidia,pins = "dap4_fs_pj4";
				nvidia,function = "i2s4b";
				nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			};

			dap4_sclk_pj7 {
				nvidia,pins = "dap4_sclk_pj7";
				nvidia,function = "i2s4b";
				nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			};

And also, I edited tegra210-porg-gpio-p3448-0002-XXX.dtsi file.

				TEGRA_GPIO(Z, 2)
				// TEGRA_GPIO(J, 5)
				// TEGRA_GPIO(J, 6)
				// TEGRA_GPIO(J, 4)
				// TEGRA_GPIO(J, 7)
				TEGRA_GPIO(G, 2)

So, I got these results by checking pin control registers and gpio

sudo grep dap4 /sys/kernel/debug/tegra_pinctrl_reg
Bank: 1 Reg: 0x70003144 Val: 0x00000044 -> dap4_fs_pj4
Bank: 1 Reg: 0x70003148 Val: 0x00000044 -> dap4_din_pj5
Bank: 1 Reg: 0x7000314c Val: 0x00000044 -> dap4_dout_pj6
Bank: 1 Reg: 0x70003150 Val: 0x00000044 -> dap4_sclk_pj7

sudo cat /sys/kernel/debug/tegra_gpio
Name:Bank:Port CNF OE OUT IN INT_STA INT_ENB INT_LVL
 A: 0:0 64 40 40 04 00 00 000000
 B: 0:1 f0 00 00 00 00 00 000000
 C: 0:2 1f 00 00 18 00 00 000000
 D: 0:3 00 00 00 00 00 00 000000
 E: 1:0 44 04 04 04 00 00 000000
 F: 1:1 00 00 00 00 00 00 000000
 G: 1:2 0c 00 00 00 00 00 000000
 H: 1:3 fd 99 80 60 00 00 000000
 I: 2:0 07 07 03 00 00 00 000000
 J: 2:1 f0 00 00 00 00 00 000000
 K: 2:2 00 00 00 00 00 00 000000
 L: 2:3 00 00 00 00 00 00 000000
 M: 3:0 00 00 00 00 00 00 000000
 N: 3:1 00 00 00 00 00 00 000000
 O: 3:2 00 00 00 00 00 00 000000
 P: 3:3 00 00 00 00 00 00 000000
 Q: 4:0 00 00 00 00 00 00 000000
 R: 4:1 00 00 00 00 00 00 000000
 S: 4:2 a0 80 00 20 00 00 000000
 T: 4:3 01 01 00 00 00 00 000000
 U: 5:0 00 00 00 00 00 00 000000
 V: 5:1 03 00 00 02 00 00 000000
 W: 5:2 00 00 00 00 00 00 000000
 X: 5:3 78 08 08 70 00 60 606000
 Y: 6:0 06 00 00 06 00 00 000000
 Z: 6:1 0f 08 00 05 00 04 040400
AA: 6:2 00 00 00 00 00 00 000000
BB: 6:3 01 00 00 01 00 00 000000
CC: 7:0 92 80 80 02 00 12 121200
DD: 7:1 01 00 00 00 00 00 000000
EE: 7:2 00 00 00 00 00 00 000000
FF: 7:3 00 00 00 00 00 00 000000

And I failed to get audio by these commands.

alsactl init tegrasndt210ref
amixer -c tegrasndt210ref cset name='I2S4 Mux' MVC1
amixer -c tegrasndt210ref cset name='MVC1 Mux' ADMAIF1
amixer -c tegrasndt210ref cset name='MVC1 Vol' 16000

sudo mpg123 my_mp3_file.mp3

Could anyone help with my issue? Appreciate a lot any help.

Finally, I succeeded to enable audio on my module.

But, my module can play .wav files only not mp3 files. Please help me to play mp3 files. Appreciate any help.

alsa initialization command

alsactl init tegrasndt210ref
amixer -c tegrasndt210ref cset name='I2S4 Mux' MVC1
amixer -c tegrasndt210ref cset name='MVC1 Mux' ADMAIF1
amixer -c tegrasndt210ref cset name='MVC1 Vol' 10000

.mp3 files command

sudo mpg123 mp3_file.mp3

.wav files command

sudo aplay -D hw:tegrasndt210ref,0 wav_file.wav

I was able to play mp3 files, but I need to know how to set gpio cnf value to 0 from dtsi.

I succeeded to change pinmux register values from dtsi file. But it is hard to find how to change gpio cnf on dtsi file.

Is there anyone know how to change gpio cnf on dtsi file?

Hi seungsoo.lee,

Can you please check if following reference help?

Thanks,
Sameer.

Hi spujar,

Thanks for your reply.

I’ve done to disable GPIO and enable SFIO! And I couldn’t disable GPIOs by only erasing TEGRA_GPIO(J, 4) … TEGRA_GPIO(J, 7) from tegra210-porg-gpio-p3448-0002-XXX.dtsi and flashed dtb files a lot of times.

I was able to disable GPIO after editing a GPIO kernel source file “drivers/gpio/gpio-tegra.c” and adding GPIO disabling codes to “tegra210-p3448-0002-p3449-0000-b00.dts” file.

220,225d219
< static void tegra_gpio_disable(struct tegra_gpio_info *tgi, int gpio)
< {
<        tegra_gpio_mask_write(tgi, GPIO_MSK_CNF(tgi, gpio), gpio, 0);
< }
< 
< 
234,235d227
< 	struct tegra_gpio_info *tgi = gpiochip_get_data(chip);
< 
238d229
< 	tegra_gpio_disable(tgi, offset);

and

gpio_default: default {
				gpio-hog;
 	   			function;
	   			gpios = <
					0x4c 0x0
 					0x4d 0x0
 					0x4e 0x0
 					0x4f 0x0
 				>;
			};

But, I want to know why only erasing GPIO codes was not working for me. I traveled all of dtsi and dts files included, but I couldn’t find any codes to enable GPIO.

Would you explain why removing “TEGRA_GPIO(J, X)” was not enough to make gpio J CNF to 0?

Hi seungsoo.lee

Can you please make sure if the DTB you are flashing has your modifications? You can attach the DTB file for reference.

Since the jetson-io tool is not working for you, please check if following reference helps. This seems to be the preferred method to update the pinmux changes.
https://docs.nvidia.com/jetson/archives/l4t-archived/l4t-3261/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/adaptation_and_bringup_nano.html#wwpID0E0RQ0HA

Thanks,
Sameer.

1 Like

Hi spujar,

Thanks for your reply.

I couldn’t use the spreadsheet because of previous work by a co-worker. I think we should use the spreadsheet for a later version and it seems the best way to control pins and gpios. Thanks for your help.

And also if there is anyone like me who can’t edit the pinmux spreadsheet anymore by previous work, please follow my previous works. It will work for you.

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