[Jetson Xavier NX] How to change Debug UART to general UART?

I’d like to change Debug UART to general UART with Jetson Xavier NX(JetPack 4.6.1).
Some similar topics are existing.I referenced the following topics.
I changed the device tree.

  1. bootloader/t186ref/tegra194-a02-bpmp-p3668-a00.dtb
    / {
    serial {
    - port = <3>;
    + port = <2>;
    has_input;
    - combined-uart {
    - enabled;
    - };
    };

};
2. kernel/dtb/tegra194-p3668-all-p3509-0000.dtb
serial@c280000 {
- compatible = “nvidia,tegra186-hsuart”;
+ compatible = “nvidia,tegra20-uart”;
+ clock-frequency = <0x18519600>;
iommus = <0x2 0x20>;
dma-coherent;
reg = <0x0 0xc280000 0x0 0x10000>;
reg-shift = <0x2>;
interrupts = <0x0 0x72 0x4>;
nvidia,memory-clients = <0xe>;
dmas = <0x1b 0x3 0x1b 0x3>;
dma-names = “rx”, “tx”;
clocks = <0x4 0x9d 0x4 0x66>;
clock-names = “serial”, “parent”;
resets = <0x5 0x66>;
reset-names = “serial”;
- status = “disabled”;
+ status = “okay”;
linux,phandle = <0xf1>;
phandle = <0xf1>;
};

serial@3140000 {
	compatible = "nvidia,tegra186-hsuart";
	iommus = <0x2 0x20>;
	dma-coherent;
	reg = <0x0 0x3140000 0x0 0x10000>;
	reg-shift = <0x2>;
	interrupts = <0x0 0x74 0x4>;
	nvidia,memory-clients = <0xe>;
	dmas = <0x1b 0x14 0x1b 0x14>;
	dma-names = "rx", "tx";
	clocks = <0x4 0x9f 0x4 0x66>;
	clock-names = "serial", "parent";
	resets = <0x5 0x68>;
	reset-names = "serial";
    -status = "okay";
    +status = "disabled";
	linux,phandle = <0xf3>;
	phandle = <0xf3>;
};

combined-uart {
	compatible = "nvidia,tegra186-combined-uart";
	reg = <0x0 0x3c10000 0x0 0x4 0x0 0xc168000 0x0 0x4 0x0 0x3c00000 0x0 0x1000>;
	interrupts = <0x0 0x78 0x4>;
    -status = "okay";
    +status = "disabled";
	console-port;
	combined-uart;
};

chosen {
    -bootargs = "console=ttyTCU0,115200";
    +bootargs = "console=ttyS2,115200 earlycon=uart8250,mmio32,0x0c280000";
    +stdout-path = "/serial@c280000";
	board-has-eeprom;
	nvidia,tegra-joint_xpu_rail;
};
  1. bootloader/t186ref/BCT/tegra194-mb1-bct-misc-l4t.cfg
    - enable_combined_uart = 1;
    - spe_uart_instance = 0x2;
    + enable_combined_uart = 0;
    + spe_uart_instance = 0xff;
  2. bootloader/t186ref/BCT/tegra194-mb1-bct-misc-flash.cfg
    - enable_combined_uart = 1;
    - spe_uart_instance = 2;
    + enable_combined_uart = 0;
    + spe_uart_instance = 0xff;
  3. p3668.conf.common
    -CMDLINE_ADD=“console=ttyTCU0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0”;
    +CMDLINE_ADD=“ttyTHS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0”;
    kernel_tegra194-p3668-all-p3509-0000.dts (253.2 KB)

$ dmesg | grep tty
[ 0.000000] Kernel command line: console=ttyS2,115200 earlycon=uart8250,mmio32,0x0c280000 video=tegrafb gpt rootfs.slot_suffix= tegra_fbmem=0x800000@0xa06b2000 lut_mem=0x2008@0xa06af000 usbcore.old_scheme_first=1 tegraid=19.1.2.0.0 maxcpus=6 boot.slot_suffix= boot.ratchetvalues=0.4.2 vpr_resize sdhci_tegra.en_boot_part_access=1 quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 ttyTHS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0
[ 0.000826] console [tty0] enabled
[ 1.678793] console [ttyS2] disabled
[ 1.678863] c280000.serial: ttyS2 at MMIO 0xc280000 (irq = 49, base_baud = 25500000) is a Tegra
[ 1.678916] console [ttyS2] enabled
[ 1.680457] 3100000.serial: ttyTHS0 at MMIO 0x3100000 (irq = 47, base_baud = 0) is a TEGRA_UART
[ 1.681505] 3110000.serial: ttyTHS1 at MMIO 0x3110000 (irq = 48, base_baud = 0) is a TEGRA_UART
dmesg.log (62.8 KB)

I use pyserial to check the uart. I could receive several data only. and then the following error is occurred.
The other uart is working well.We need three general uart.

$ sudo python3 uart_recieve.py
b’test’
b’test’
b’test’
b’test’
b’test’
Traceback (most recent call last):
** File “/usr/lib/python3/dist-packages/serial/serialposix.py”, line 501, in read

** 'device reports readiness to read but returned no data '**
serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
** File “uart_recieve.py”, line 17, in **
** msg = ser.readline()**
** File “/usr/lib/python3/dist-packages/serial/serialposix.py”, line 509, in read**
** raise SerialException(‘read failed: {}’.format(e))**
serial.serialutil.SerialException: read failed: device reports readiness to read but returned no data (device disconnected or multiple access on port?)

Could you give me some advice?

Thanks,

Within Linux (but perhaps not in bootloader stages, which may or may not matter), try this to temporarily change it:
sudo systemctl stop nvgetty.service

To do this permanently (although it can be enabled with the reverse):

sudo systemctl stop nvgetty.service
sudo systemctl disable nvgetty.service

Device tree arguments can effect this during boot stages which exist prior to reaching Linux. This might matter if something attached to the UART has activity during boot and causes boot to drop into a boot console, but otherwise it won’t matter. Other steps might be needed if disabling this in the bootloader matters. However, I would start by restoring your previous changes, and then performing the systemctl commands to start with.

1 Like

hello y_m1,

please refer to Topic 232547, comment #9; recap as below…

tegra186-hsuart kind of works - a /dev/ttyTHS2 is present, but cannot correctly transfer data.

may I know what’s your actual use-case,
we’ve try steps to disable combine uart, but we cannot guarantee the real use-case for transferring data as it’s not in our supported use cases/features.

Hello linuxdev, JerryhChang

Thank you for replying.
I’ve already stopped nvgetty.service and been disable.
I’ve understood /dev/ttyTHS2 is not stable and useless.

We’ve already developed custom board and need three general uarts.
It’s difficult to use FTDI USB now. If we use it, we’ll redesign the board.
ttyTHS0 and ttyTHS1 are fine.
What should I try to use other port instead of ttyTCU0?

Thanks,

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