Can we change the debug port to a regular serial port?

Hi,all

Jetson: Orin NX devkit
OS: ubuntu 20.04
L4T: R35.50
Kernel: 5.10.192-tegra

I went to change the debug serial port from ttyAMA0 to regular serial port
I have already modified the device tree:

uarti: serial@31d0000 {
	compatible = "nvidia,tegra194-hsuart";
	iommus = <&smmu_niso0 TEGRA_SID_NISO0_GPCDMA_0>;
	dma-coherent;
	reg = <0x0 0x31d0000 0x0 0x10000>;
	reg-shift = <2>;
	interrupts = <0 TEGRA234_IRQ_UARTI 0x04>;
	nvidia,memory-clients = <14>;
	dmas = <&gpcdma 13>, <&gpcdma 13>;
	dma-names = "rx", "tx";
	clocks = <&bpmp_clks TEGRA234_CLK_UARTA>,
		<&bpmp_clks TEGRA234_CLK_PLLP_OUT0>;
	clock-names = "serial", "parent";
	resets = <&bpmp_resets TEGRA234_RESET_UARTA>;
	reset-names = "serial";
	status = "disabled";
};

But it reported an error:
[ 4.854267] serial-tegra 31d0000.serial: Adding to iommu group 2
[ 4.859841] serial-tegra 31d0000.serial: Failed to add uart port, err -22
[ 4.866214] serial-tegra: probe of 31d0000.serial failed with error -22

Do I need to do anything else?

Hi 495549035,

Do you add these by yourself?

May I know what’s your use case?
Do you connect any serial device?
If so, which pins are you connecting?

HI KevinFFF
Thank you for your response.

 1.Yes, it was added by me.
  Because I want to make 31d0000 and 3100000 the same serial port.


 2. yes of course 
 We used two serial ports and one Debug. 
 Connect:
 UART0 -> (UART0_RX_1V8.UART0_TX_1V8)
 UART1 -> (UART1_RX_1V8.UART1_TX_1V8)
 UART_Debug -> (UART2_RXD_Debug.UART2_TXD_Debug)
 
 
 ![微信图片_20240723112642|690x216](upload://b8QXKWR2SCqVZCYB4zHAmTlG5zE.png)

 
 There is another question:
 
 We tried to change the configuration during the flashing stage from:
 // uarti: serial@31d0000 {
// 	compatible = "arm,sbsa-uart";
// 	reg = <0x0 0x31d0000 0x0 0x10000>;
// 	interrupts = <0x0 TEGRA234_IRQ_UARTI 0x04>;
// 	current-speed = <115200>;
// 	status = "disabled";
// };
  to:
    uarti: serial@31d0000 {
	compatible = "nvidia,tegra194-hsuart";
	iommus = <&smmu_niso0 TEGRA_SID_NISO0_GPCDMA_0>;
	dma-coherent;
	reg = <0x0 0x31d0000 0x0 0x10000>;
	reg-shift = <2>;
	interrupts = <0 TEGRA234_IRQ_UARTI 0x04>;
	nvidia,memory-clients = <14>;
	dmas = <&gpcdma 13>, <&gpcdma 13>;
	dma-names = "rx", "tx";
	clocks = <&bpmp_clks TEGRA234_CLK_UARTA>,
		<&bpmp_clks TEGRA234_CLK_PLLP_OUT0>;
	clock-names = "serial", "parent";
	resets = <&bpmp_resets TEGRA234_RESET_UARTA>;
	reset-names = "serial";
	status = "disabled";
};

However, this modification failed even at the flashing stage;

it keeps throwing errors:
/home/amov/nVidia/Jetson_Linux_3550/Linux_for_Tegra


  •                                 *
    
  • Step 3: Start the flashing process *
  •                                 *
    

Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Waiting for target to boot-up…
Timeout
Cleaning up…

So, can the debug changed to a regular serial port?

Please refer to Jetson/L4T/peripheral/ - eLinux.org for the UART mapping in Orin NX.

Are you connecting 2 serial devices on both UART0 and UART1?
What’s your current requirement?
Why you try to enable/modify uarti?

[ 0.000000] Kernel command line: root=PARTUUID=c6cb6934-6199-4bf0-91fb-12f8cd273429 rw rootwait rootfstype=ext4 mminit_loglevel=4 console=ttyTCU0,115200 console=ttyAMA0,115200 firmware_class.path=/etc/firmware fbcon=map:0 net.ifnames=0
[ 0.283736] 31d0000.serial: ttyAMA0 at MMIO 0x31d0000 (irq = 63, base_baud = 0) is a SBSA
[ 1.451606] printk: console [ttyAMA0] enabled
[ 2.271479] printk: console [ttyTCU0] enabled
[ 9.314281] 3100000.serial: ttyTHS0 at MMIO 0x3100000 (irq = 16, base_baud = 0) is a TEGRA_UART
[ 9.330603] 3110000.serial: ttyTHS1 at MMIO 0x3110000 (irq = 60, base_baud = 0) is a TEGRA_UART
[ 9.346897] 3130000.serial: ttyTHS3 at MMIO 0x3130000 (irq = 61, base_baud = 0) is a TEGRA_UART
[ 9.363134] 3140000.serial: ttyTHS4 at MMIO 0x3140000 (irq = 62, base_baud = 0) is a TEGRA_UART
[ 12.306360] systemd[1]: Created slice system-serial\x2dgetty.slice.
[ 14.323986] usb 1-3: cp210x converter now attached to ttyUSB0

1.Because I saw that the debug is 0x31d0000, and then I looked it up in the device tree, where I found that 0x31d0000 corresponds to uarti.
2.My requirement is: to change the Debug serial port that comes with the Orin NX to a regular serial port.
3.Is this solution feasible?

That Uart is the virtual one used for the 2nd debug UART.
Please just use /dev/ttyTCU0 for debug UART.

We don’t suggest this use case since Tegra Combined Uart output the logs from several firmwares and it is not an easy work to disable all of them.
Could you use UART0 and UART1 instead and just keep Debug Uart as it is?

236 UART2_TXD UART2_TXD (DEBUG) 50k pd UC3_TXD Output Disable Disable UART #2 Transmit. Debug UART
238 UART2_RXD UART2_RXD (DEBUG) 50k pd UC3_RXD Input Disable Disable UART #2 Receive
  1. Because our project lacks UARTs, I saw in the official documentation that there are three UART interfaces in Orin, one of which is used for debugging. Therefore, we want to change this debug serial port to a regular serial port.
  2. Or are there any other serial ports available?

For Orin NX/Nano, there’re 3 Uart interfaces.
We would suggest using the module through other interface like SPI/I2C to expand more Uart interfaces.