NVIDIA Jetson orin nx 16GB单板上的GPIO口默认电平

99 UART0_TXD UART0_TXD UART2_TX GP32_UART2_TXD unused_UART2_TX
101 UART0_RXD UART0_RXD UART2_RX GP33_UART2_RXD unused_UART2_RX

我有一个困扰很久的问题想请教各位专家。按需求,我要将原先的uart0口变更配置,作为一个模拟i2c slave设备的出口,即UART0_TXD作为模拟I2C slave设备的SDA,UART0_RXD作为模拟I2C slave设备的SCL,我已经修改了pinmux配置(tegra234-mb1-bct-pinmux-p3767-dp-a03.dtsi)如下(,uart2_tx_px4和uart2_rx_px5的配置从pinmux_default: common中迁移到drive_default: drive中):

	drive_default: drive {
		uart2_tx_px4 {
			nvidia,pins = "uart2_tx_px4";
			nvidia,function = "rsvd1";
			nvidia,pull = <TEGRA_PIN_PULL_UP>;
			nvidia,tristate = <TEGRA_PIN_DISABLE>;
			nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			nvidia,open-drain = <TEGRA_PIN_ENABLE>;
			nvidia,io-high-voltage = <TEGRA_PIN_DISABLE>;
			nvidia,lpdr = <TEGRA_PIN_DISABLE>;
		};

		uart2_rx_px5 {
			nvidia,pins = "uart2_rx_px5";
			nvidia,function = "rsvd1";
			nvidia,pull = <TEGRA_PIN_PULL_UP>;
			nvidia,tristate = <TEGRA_PIN_DISABLE>;
			nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			nvidia,open-drain = <TEGRA_PIN_ENABLE>;
			nvidia,io-high-voltage = <TEGRA_PIN_DISABLE>;
			nvidia,lpdr = <TEGRA_PIN_DISABLE>;
		};
	};

并在tegra234-mb1-bct-gpio-p3767-dp-a03.dtsi中的gpio-input和gpio-output-high配置中新增了TEGRA234_MAIN_GPIO(X, 4)和TEGRA234_MAIN_GPIO(X, 5)。进入系统后,查询相关配置寄存器的值=如下:
root@localhost:/mnt/appdata/i2c_slave# busybox devmem 0x0243d050
0x00000049
root@localhost:/mnt/appdata/i2c_slave# busybox devmem 0x0243d058
0x00000049
但问题在于我每次加载I2C slave驱动代码后,SDA即变为默认低电平,但SCL保持高电平,即
gpio-466 (PX.04 |i2c-sda ) in lo
gpio-467 (PX.05 |i2c-scl ) in hi IRQ
驱动代码上对于GPIO的初始化是一致的,查看dmesg日志为:
[ 69.980206] I2C Slave driver initializing…
[ 69.980261] SDA before gpio_request: HI
[ 69.980266] SCL before gpio_request: HI
[ 69.980345] SDA after gpio_request: HI
[ 69.980371] SDA after gpio_direction_input: LO
[ 69.980392] SCL after gpio_request: HI
[ 69.980410] SCL after gpio_direction_input: HI
[ 69.980547] irq: IRQ310: trimming hierarchy from :pmc@c360000
[ 69.980645] I2C Slave driver loaded (SDA:466, SCL:467)
此后SDA一直保持为低电平。事实上,如果我不在tegra234-mb1-bct-gpio-p3767-dp-a03.dtsi中设置默认值,则SDA会一直保持为低电平
这可能是什么原因导致的呢,因为我在系统中,加载驱动前一直都是可以通过echo 466 > /sys/class/gpio/export这样的系统命令配置输出高低电平的,且万用电表测量电压3.3V。但为什么系统为什么会设置SDA的默认电平为低呢,我还有什么地方需要修改呢?谢谢
gpio-466 (PX.04 |sysfs ) out hi

Hi ylssrb,

Are you using the devkit or custom board for Orin NX?
What’s the Jetpack version in use?

These 2 pins cannot be used as I2C interfaces.
Are you trying to configure them as GPIO and emulate them for I2C?
Could you use I2C interfaces instead? There’re 3 I2C interfaces available on Orin NX.

I would suggest using pinmux spreadsheet to generate both pinmux/gpio dtsi instead of modify them manually.

Please note that PX.04 may be only used as Output.
You can refer to the following thread for the similar issue.
Modify Pinmux/GPIO functions - custom Jetson Orin NX carrier - #20 by flybyya23

Hi, KevinFFF,

We are using the custom board

The Jetpack in use is JetPack_5.1.2

Yes, I’m trying to configure the 2 pins as GPIO and emulate them for I2C. I can’t use the other 3 I2C interfaces for this I2C interface is used for communication with the other board, but our hardware designers did not introduce any I2C interface, they were aware of this mistake, but it will need to be corrected in the next hardware redesign.

Well, at the beginning I did use pinmux spreadsheet to generate both pinmux/gpio dtsi , but when I found that I couldn’t achieve the expected goal, I had to manually modify and observe the results under different modifications.

I have discussed with hardware designers and other related colleagues, and it should indeed be the same issue. Thank you for your response.

One I2C interface can connect multiple I2C devices with different device address.

Pinmux spreadsheet could help you preventing configuring something wrong/invalid.
You can also compare the pinmux/gpio dtsi before and after you did the change in pinmux spreadsheet.

Okay, please use other available pins instead.

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