Using SPI and GPIO PWM on Jetson Nano EMMC

Hi all

I’m trying to make a device tree assembly that will allow me to use SPI1 with CS0, and I want to redefine CS1 to use GPIO (PWM)
Without setting GPIO (PWM) everything works
Here is my setup for working with SPI:

			 spi1_mosi_pc0 {
				 nvidia,pins = "spi1_mosi_pc0";
				 nvidia,function = "spi1";
				 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
				 nvidia,tristate = <TEGRA_PIN_DISABLE>;
				 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			 };
 
			 spi1_miso_pc1 {
				 nvidia,pins = "spi1_miso_pc1";
				 nvidia,function = "spi1";
				 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
				 nvidia,tristate = <TEGRA_PIN_DISABLE>;
				 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			 };
 
			 spi1_sck_pc2 {
				 nvidia,pins = "spi1_sck_pc2";
				 nvidia,function = "spi1";
				 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
				 nvidia,tristate = <TEGRA_PIN_DISABLE>;
				 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			 };
 
			 spi1_cs0_pc3 {
				 nvidia,pins = "spi1_cs0_pc3";
				 nvidia,function = "spi1";
				 nvidia,pull = <TEGRA_PIN_PULL_UP>;
				 nvidia,tristate = <TEGRA_PIN_DISABLE>;
				 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			 };
 
			 spi1_cs1_pc4 {
				 nvidia,pins = "spi1_cs1_pc4";
				 nvidia,function = "spi1";
				 nvidia,pull = <TEGRA_PIN_PULL_UP>;
				 nvidia,tristate = <TEGRA_PIN_DISABLE>;
				 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			 };
#include <dt-bindings/gpio/tegra-gpio.h>

/ {
	gpio: gpio@6000d000 {
		gpio-init-names = "default";
		gpio-init-0 = <&gpio_default>;

		gpio_default: default {
			gpio-hog;
			function;
			gpios = <
				TEGRA_GPIO(C, 0) 0 
				TEGRA_GPIO(C, 1) 0 
				TEGRA_GPIO(C, 2) 0 
				TEGRA_GPIO(C, 3) 0
				TEGRA_GPIO(C, 4) 0
			>;
			gpio-input = <
				TEGRA_GPIO(BB, 0)
				TEGRA_GPIO(B, 4)
				TEGRA_GPIO(B, 5)
				TEGRA_GPIO(B, 6)
				TEGRA_GPIO(B, 7)
				TEGRA_GPIO(DD, 0)
				TEGRA_GPIO(E, 6)
				TEGRA_GPIO(S, 5)
				TEGRA_GPIO(A, 5)
				TEGRA_GPIO(X, 4)
				TEGRA_GPIO(X, 5)
				TEGRA_GPIO(X, 6)
				TEGRA_GPIO(Y, 1)
				TEGRA_GPIO(Y, 2)
				TEGRA_GPIO(V, 0)
				TEGRA_GPIO(V, 1)
				TEGRA_GPIO(Z, 0)
				TEGRA_GPIO(Z, 2)
				TEGRA_GPIO(G, 2)
				TEGRA_GPIO(G, 3)
				TEGRA_GPIO(H, 2)
				TEGRA_GPIO(H, 5)
				TEGRA_GPIO(H, 6)
				TEGRA_GPIO(I, 1)
				TEGRA_GPIO(CC, 4)
				>;
			gpio-output-low = <
				TEGRA_GPIO(S, 7)
				TEGRA_GPIO(T, 0)
				TEGRA_GPIO(Z, 3)
				TEGRA_GPIO(H, 0)
				TEGRA_GPIO(H, 3)
				TEGRA_GPIO(H, 4)
				TEGRA_GPIO(H, 7)
				TEGRA_GPIO(I, 0)
				TEGRA_GPIO(I, 2)
				>;
			gpio-output-high = <
				TEGRA_GPIO(A, 6)
				TEGRA_GPIO(X, 3)
				TEGRA_GPIO(CC, 7)
				>;
		};
	};
};

what do I need to do so that I can use pin c4 as gpio?

Hi ihor.sh1nkarenk000,

Are you using the devkit or custom board for Jetson Nano eMMC?
What’s your Jetpack version in use?

It seems you don’t need to configure for the above configurations.

I would suggest you configuring the pinmux through pinmux spreadsheet instead of modifying them in dts file.

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