How to use UART4 which pinmux with WIFI/BT?

Hi,everyone!
I encounter a problem when I develop my own carrier board: I want to use UART4 port which pinmux with WIFI/BT. The default setting is connect to WIFI/BT, but how to mux these pin to normal uart?

Hi Richardzhr,

Please take a look at Jetson TX2 OEM product Design Gudie page 54. UART4 signal is controlled by multiplexer with QSPI_IO3 signal.

Please set QSPI_IO3 to LOW and it will switch to normal UART.

Thank you for ur reply. I want to know how to change the qspi_io3 pin to low. Shall I use pinmux template to set the pin or I can change the pin in my applicaton code?

This behavior should be done in device tree. I think you should use the pinmux template.

Can you give me more detail advice? I don’t find any option in pinmux template. Can I edit some existing dtsi file to set the qspi_io3 pin?

Hi Richardzhr,

According to the pinmux template, QSPI_IO3 is a GPIO (GPIO3_PR_.04). Then, you can find “TEGRA_MAIN_GPIO(R, 4)” in the device tree.

@WayneWWW
Thank you very much. Now I find how to change the QSPI_IO3 from high to low.
Use “Jetson-TX2-Generic-Customer-Pinmux-Template.xlsm” ,find the line 203, change the value AS column at: driven 1 ----> driven 0. And gerenate DT file. Then I can find

#include <dt-bindings/gpio/tegra-gpio.h>

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

		gpio_default: default {
			gpio-input = <
				TEGRA_GPIO(B, 5)
				TEGRA_GPIO(C, 0)
				TEGRA_GPIO(J, 5)
				TEGRA_GPIO(M, 5)
				TEGRA_GPIO(I, 4)
				TEGRA_GPIO(I, 6)
				TEGRA_GPIO(I, 7)
				TEGRA_GPIO(FF, 1)
				TEGRA_GPIO(FF, 2)
				TEGRA_GPIO(FF, 3)
				TEGRA_GPIO(FF, 4)
				TEGRA_GPIO(FF, 0)
				TEGRA_GPIO(X, 7)
				TEGRA_GPIO(Y, 0)
				TEGRA_GPIO(Y, 1)
				TEGRA_GPIO(Y, 2)
				TEGRA_GPIO(Y, 5)
				TEGRA_GPIO(Y, 6)
				TEGRA_GPIO(V, 0)
				TEGRA_GPIO(AA, 2)
				TEGRA_GPIO(AA, 3)
				TEGRA_GPIO(AA, 4)
				TEGRA_GPIO(AA, 5)
				TEGRA_GPIO(AA, 7)
				TEGRA_GPIO(R, 5)
				TEGRA_GPIO(P, 4)
				TEGRA_GPIO(P, 5)
				>;
			gpio-output-low = <
				TEGRA_GPIO(B, 6)
				TEGRA_GPIO(J, 6)
				TEGRA_GPIO(M, 4)
				TEGRA_GPIO(I, 5)
				TEGRA_GPIO(N, 0)
				TEGRA_GPIO(N, 2)
				TEGRA_GPIO(U, 3)
				TEGRA_GPIO(S, 3)
				TEGRA_GPIO(X, 6)
				TEGRA_GPIO(Y, 4)
				TEGRA_GPIO(L, 4)
				TEGRA_GPIO(L, 5)
				TEGRA_GPIO(H, 4)
				TEGRA_GPIO(H, 5)
				TEGRA_GPIO(H, 6)
				TEGRA_GPIO(V, 5)
				TEGRA_GPIO(AA, 6)
				TEGRA_GPIO(R, 1)
				TEGRA_GPIO(R, 2)
				TEGRA_GPIO(R, 0)
				TEGRA_GPIO(R, 4)
				TEGRA_GPIO(P, 3)
				TEGRA_GPIO(P, 6)
				TEGRA_GPIO(BB, 0)
				TEGRA_GPIO(BB, 1)
				>;
			gpio-output-high = <
				TEGRA_GPIO(B, 4)
				TEGRA_GPIO(R, 3)
				>;
		};
	};
};

But how to use the line 59 to existing dsti file? Someone can give me some advice?
I don’t want to do complex work which driver user guide mentioned!

@WayneWWW
Hi, now I set the QSPI_IO3 pin to low, but how can I access the uart4 on ubuntu? I can find tty device like below :
/dev/ttyS0
/dev/ttyS1
/dev/ttyS2
/dev/ttyS3
/dev/ttyTHS1
/dev/ttyTHS2
/dev/ttyTHS3
which one I can choose?

Do you have your debug board connect to the correct pin?? The signal now comes from UAR3_TX/RX UART3_RTS/CTS.

Hi WayneWWW,

I also want to use UART3(H9, H10) as normal UART. When I checked my dtb, it look like wifi/bt is already disabled as below

gpio@2200000 {
		wifi_over_pcie {
			gpio-hog;
			gpios = <TEGRA_MAIN_GPIO(R, 4) 0>;
			output-low;
			label = "wifi-over-pcie";
			status = "disabled";
		};

But I still could not receive any data from GPS module that was plugged into UART3 (/dev/ttyTHS2). I can make sure about GPS module because it worked well with UART2 port (/dev/ttyTHS1).

Thanks
Vu Nguyen

Hi forever3000,

Under such gpio configuration, is wifi able to work? Or neither UART3 not wifi is disabled?

Hi WayneWWW,

Both of them didn’t work.

Thanks

Please set this GPIO status to okay.

gpio@2200000 {
		wifi_over_pcie {
			gpio-hog;
			gpios = <TEGRA_MAIN_GPIO(R, 4) 0>;
			output-low;
			label = "wifi-over-pcie";
			status = "okay";
		};

Hi WayneWWW,

The result was same

Please try to set the status to “okay” first and then change the gpio high/low.

Hi WayneWWW,

Now I can make it work with below configuration. However it should be UART4 (/dev/ttyTHS3) instead of UART3 (ttyTHS2) as my thought.

gpio@2200000 {
		wifi_over_pcie {
			gpio-hog;
			gpios = <TEGRA_MAIN_GPIO(R, 4) 0>;
			output-low;
			label = "wifi-over-pcie";
			/*status = "disabled";*/
			status = "okay";
		};

May I have one more question, is it possible to enable UART7 with kernel version 28.1?
According to this thread https://devtalk.nvidia.com/default/topic/1025679/jetson-tx2/how-to-enable-uart7-d8-d5-as-normal-uart-like-other-uart-uartc-c280000-/ , I have to move to 28.2 if really want to use UART7.

Thanks

Hi forever3000,

Yes, please move to rel-28.2, we have several fix there and it would be hard to pick them back to rel-28.1 one-by-one. Sorry for your inconvenience.

Hi forever3000,

I have follow these steps:
1.sudo dtc -I dtb -O dts -o 1.dts …/Linux_for_Tegra/kernel/dtb/tegra186-quill-p3310-1000-c03-00-base.dtb
2.modified 1.dts

wifi_over_pcie {
... 
/*status = "disabled"*/
status = "okay";
}

3.sudo dtc -I dts -O dtb -o …/Linux_for_Tegra/kernel/dtb/tegra186-quill-p3310-1000-c03-00-base.dtb 1.dts
4.sudo ./flash.sh -r -k kernel-dtb jetson-tx2 mmcblk0p1

But i think it didn’t switch to a normal uart, because the wifi is still work well and didn’t received any data form J21.(I think both UART1(H12,G12) and uart4(H9/H10) connected to J21)

5.then i modified 1.dts

wifi-enable {
		gpio-hog;
		gpios = <0x68 0x0>;
		/*output-high;*/
                output-low;
		line-name = "wifi-enable";
	};

It successfully disable wifi.

6.add some code in 1.dts

wifi-enable { ... }
uartd_enable {
		gpio-hog;
		gpios = <0x8c 0x0>;
		output-low;
		line-name = "uartd_enable";
	};

But uart4 still didn’t work.Did I missing some steps?How to know whether or not uart4 is work?

Thanks

Not the answer, but something you do want to do after a device tree change: Extract the running system’s device tree to see if your changes actually made it in:

dtc -I fs -O dts -o extracted.dts /proc/device-tree