Jetson xavier NX SPI2 pinmux issue

we want to use the node /dev/spi2.0, after i use the pinmux command:
busybox devmem 0x0243d008 32 0x440
busybox devmem 0x0243d060 32 0x440
busybox devmem 0x0243d048 32 0x444
busybox devmem 0x0243d018 32 0x448
busybox devmem 0x0243d028 32 0x448

the spi interface can transfer data. Now i want to know how to modify device tree file to output the pinmux?

Regards
zhaocuiqin

In the tegra194-p3668-all-p3509-0000-hdr40.dts, I just add pin13 、pin16、pin18、pin22、pin37

nvidia,function = “spi3”;

after recompile and flash the dtb, reboot it . I check the pinmux is invalid.

Regards,
zhaocuiqin

hello zhaocuiqin,

there’re pin muxing you could have modification, please download pinmux spreadsheets to have customization.
see developer guide, MB1 Configuration Changes for reference,
thanks

Hi JerryChang,
I Manual modify Linux_for_Tegra/bootloader/t186ref/BCT/ tegra19x-mb1-pinmux-p3668-a01.cfg
pinmux.0x02212200 = 0x00000001; # CONFIG Y0
pinmux.0x0243d048 = 0x00000444; # GPIO spi3_sck_py0
pinmux.0x02212220 = 0x00000001; # CONFIG Y1
pinmux.0x0243d008 = 0x00000440; # GPIO spi3_miso_py1
pinmux.0x02212240 = 0x00000001; # CONFIG Y2
pinmux.0x0243d060 = 0x00000440; # GPIO spi3_mosi_py2
pinmux.0x02212260 = 0x00000001; # CONFIG Y3
pinmux.0x0243d018 = 0x00000448; # GPIO spi3_cs0_py3
pinmux.0x02212280 = 0x00000001; # CONFIG Y4
pinmux.0x0243d028 = 0x00000448; # GPIO spi3_cs1_py4

Then update the system, using the command:
./flash.sh -r jetson-xavier-nx-devkit-emmc mmcblk0p1

reboot it, verifying the value still is 0x55 " busybox devmem 0x0243d008"
Could you give me some advise on this ? Thanks

Zhaocuiqin

hello zhaocuiqin,

please customize it through pinmux spreadsheets, you’ll also have device tree definition as following,

			spi3_sck_py0 {
				nvidia,pins = "spi3_sck_py0";
				nvidia,function = "spi3";
				nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
				nvidia,tristate = <TEGRA_PIN_ENABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
				nvidia,io-high-voltage = <TEGRA_PIN_DISABLE>;
				nvidia,lpdr = <TEGRA_PIN_DISABLE>;
			};

			spi3_miso_py1 {
				nvidia,pins = "spi3_miso_py1";
				nvidia,function = "spi3";
				nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
				nvidia,tristate = <TEGRA_PIN_ENABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
				nvidia,io-high-voltage = <TEGRA_PIN_DISABLE>;
				nvidia,lpdr = <TEGRA_PIN_DISABLE>;
			};
...

Hi JerryChang,
1、Could you tell me how to modify tegra19x-mb1-pinmux-p3668-a01.cfg through pinmux spreadsheets? I modify it by editing it directly.
2、modify the device tree , I see the tegra194-p3668-all-p3509-0000-hdr40.dts included the pin:
pin13 {
nvidia,pins = “spi3_sck_py0”;
nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
nvidia,tristate = <TEGRA_PIN_DISABLE>;
nvidia,enable-input = <TEGRA_PIN_ENABLE>;
nvidia,io-high-voltage = <TEGRA_PIN_DISABLE>;
nvidia,lpdr = <TEGRA_PIN_DISABLE>;
nvidia,function = “spi3”;
I only add the last line nvidia,function = “spi3”;
Which file i should add the spi3_sck_py0、spi3_miso_py1 to?Thanks

hello zhaocuiqin,

you should select the Customer Usage in pinmux spreadsheets to modify the configuration,
after that, please click the Generate DT File button on the top-right to generate the dtsi files which include the settings.
there’s script file, pinmux-dts2cfg.py to converts pinmux, gpio and pad dts file into the board configuration file.
please check $OUT/Linux_for_Tegra/kernel/pinmux/t186/README.txt for the usage.
thanks

hi JerryChang,
In the Jetson_Xavier_NX_Pinmux_Configuration_Template_v1.06, i click the button"Generate DT File" to output tegra19x-jetson_xavier_nx_module-pinmux.dtsi :
spi3_sck_py0 {
nvidia,pins = “spi3_sck_py0”;
nvidia,function = “rsvd1”;
nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
nvidia,tristate = <TEGRA_PIN_ENABLE>;
nvidia,enable-input = <TEGRA_PIN_ENABLE>;
nvidia,io-high-voltage = <TEGRA_PIN_DISABLE>;
nvidia,lpdr = <TEGRA_PIN_DISABLE>;
};

		spi3_miso_py1 {
			nvidia,pins = "spi3_miso_py1";
			nvidia,function = "rsvd1";
			nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
			nvidia,tristate = <TEGRA_PIN_ENABLE>;
			nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			nvidia,io-high-voltage = <TEGRA_PIN_DISABLE>;
			nvidia,lpdr = <TEGRA_PIN_DISABLE>;
		};

nvidia,function = “rsvd1”; this is not nvidia,function = “spi3”; Which one i should modify Jetson_Xavier_NX_Pinmux_Configuration_Template_v1.06?

Regards,
zhaocuiqin

i mentioned the customer Usage is spi1 function already.
image

I would suggest to use jetson-io to configure it.
Below is generate by jetson-io

	pinmux@2430000 {
		pinctrl-0 = <0x179>;
		pinctrl-names = "default";
		compatible = "nvidia,tegra194-pinmux";
		reg = <0x0 0x2430000 0x0 0x17000 0x0 0xc300000 0x0 0x4000>;
		#gpio-range-cells = <0x3>;
		status = "okay";
		linux,phandle = <0xab>;
		phandle = <0xab>;

		header-40pin-pinmux {
			phandle = <0x179>;
			linux,phandle = <0x179>;

			pin37 {
				nvidia,lpdr = <0x0>;
				nvidia,io-high-voltage = <0x0>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x1>;
				nvidia,pins = "spi3_mosi_py2";
				nvidia,function = "spi3";
			};

			pin28 {
				nvidia,lpdr = <0x1>;
				nvidia,io-high-voltage = <0x1>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x0>;
				nvidia,pins = "gen2_i2c_scl_pcc7";
				nvidia,function = "i2c2";
			};

			pin27 {
				nvidia,lpdr = <0x1>;
				nvidia,io-high-voltage = <0x1>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x0>;
				nvidia,pins = "gen2_i2c_sda_pdd0";
				nvidia,function = "i2c2";
			};

			pin26 {
				nvidia,lpdr = <0x0>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x2>;
				nvidia,pins = "spi1_cs1_pz7";
				nvidia,function = "spi1";
			};

			pin24 {
				nvidia,lpdr = <0x0>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x2>;
				nvidia,pins = "spi1_cs0_pz6";
				nvidia,function = "spi1";
			};

			pin23 {
				nvidia,lpdr = <0x0>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x1>;
				nvidia,pins = "spi1_sck_pz3";
				nvidia,function = "spi1";
			};

			pin22 {
				nvidia,lpdr = <0x0>;
				nvidia,io-high-voltage = <0x0>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x1>;
				nvidia,pins = "spi3_miso_py1";
				nvidia,function = "spi3";
			};

			pin21 {
				nvidia,lpdr = <0x0>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x1>;
				nvidia,pins = "spi1_miso_pz4";
				nvidia,function = "spi1";
			};

			pin19 {
				nvidia,lpdr = <0x0>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x1>;
				nvidia,pins = "spi1_mosi_pz5";
				nvidia,function = "spi1";
			};

			pin18 {
				nvidia,lpdr = <0x0>;
				nvidia,io-high-voltage = <0x0>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x2>;
				nvidia,pins = "spi3_cs0_py3";
				nvidia,function = "spi3";
			};

			pin16 {
				nvidia,lpdr = <0x0>;
				nvidia,io-high-voltage = <0x0>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x2>;
				nvidia,pins = "spi3_cs1_py4";
				nvidia,function = "spi3";
			};

			pin13 {
				nvidia,lpdr = <0x0>;
				nvidia,io-high-voltage = <0x0>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x1>;
				nvidia,pins = "spi3_sck_py0";
				nvidia,function = "spi3";
			};

			pin10 {
				nvidia,lpdr = <0x0>;
				nvidia,io-high-voltage = <0x0>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x1>;
				nvidia,pull = <0x2>;
				nvidia,pins = "uart1_rx_pr3";
				nvidia,function = "uarta";
			};

			pin8 {
				nvidia,lpdr = <0x0>;
				nvidia,io-high-voltage = <0x0>;
				nvidia,enable-input = <0x0>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x0>;
				nvidia,pins = "uart1_tx_pr2";
				nvidia,function = "uarta";
			};
		};

Hi ShaneCCC,

I configure the pinmux spreadsheets like :


I get the tegra19x-mb1-pinmux-p3668-a01.cfg file pinmux.0x0243d008 = 0x00000444;
Now I want pinmux.0x0243d008 = 0x00000440;
Which one parameter i should modify in pinmux spredsheets?

Regards,

Any reason must using spreadsheets? If you know the value why just modify the cfg file.

I need to modify the pinmux in uboot stage.

Then I think you can just modify the cfg file manually for it.

I have modified cfg manually, it is invalid.

What do you mean invalid?

manually modified the cfg , then flash it reboot. The configure is invalid

If modify manually don’t take effect I don’t think it could be valid by using spreadsheet.
Do you read the configure after boot to ubuntu? If that you still need modify the device tree to avoid override by kernel driver.