Disable serial console on UART0 and use as ttyTHS0

Hello,

I am trying to figure out how to disable the serial console on UART0 and use it for communication with an external device as /dev/ttyTHS0

I can successfully use UART2 (/dev/ttyTHS1) for a GPS device and would to do the same for UART0.

I am using Jetson TX1, JetPack 3.3 and Auvidea J140 daughter board.

I have checked other threads in the forum and tried several answers but with no luck so far.

This is what I have tried.

Removed the following line from .conf file

CMDLINE_ADD="console=ttyS0,115200n8 console=tty0 OS=l4t fbcon=map:1 net.ifnames=0";

Set the follwoing lines in .dtsi

serial@70006000 {
	compatible = "nvidia,tegra114-hsuart";
	status = "okay";
};

serial@70006040 {
	compatible = "nvidia,tegra114-hsuart";
	status = "okay";
};

serial@70006200 {
	compatible = "nvidia,tegra114-hsuart";
	status = "okay";
};

serial@70006300 {
	compatible = "nvidia,tegra114-hsuart";
	status = "okay";
};

Once I rebuild the DTS and flash the device this is what I get from dmesg.

nvidia@tegra-ubuntu:~$ dmesg | grep tty
[    0.000000] Kernel command line: root=/dev/mmcblk0p1 rw rootwait androidboot.modem=none androidboot.serialno=0085030e0000001c87a5 androidboot.security=non-secure tegraid=21.1.2.0.0 ddr_die=2048M@2048M ddr_die=2048M@4096M section=256M memtype=0 vpr_resize usb_port_owner_info=0 lane_owner_info=0 emc_max_dvfs=0 touch_id=0@63 video=tegrafb no_console_suspend=1 console=ttyS0,115200n8 debug_uartport=lsport,0 earlyprintk=uart8250-32bit,0x70006000 maxcpus=4 usbcore.old_scheme_first=1 lp0_vec=0x1000@0xff2bf000 nvdumper_reserved=0xff23f000 core_edp_mv=1075 core_edp_ma=4000 tegra_fbmem=0x800000@0x92c9d000 is_hdmi_initialised=1 gpt root=/dev/mmcblk0p1 rw rootwait
[    0.503383] 70006000.serial: ttyTHS0 at MMIO 0x70006000 (irq = 320, base_baud = 0) is a TEGRA_UART
[    0.503851] 70006040.serial: ttyTHS1 at MMIO 0x70006040 (irq = 321, base_baud = 0) is a TEGRA_UART
[    0.504307] 70006200.serial: ttyTHS2 at MMIO 0x70006200 (irq = 322, base_baud = 0) is a TEGRA_UART
[    0.504752] 70006300.serial: ttyTHS3 at MMIO 0x70006300 (irq = 323, base_baud = 0) is a TEGRA_UART
[    1.465365] systemd[1]: Created slice system-getty.slice.
[    1.465972] systemd[1]: Created slice system-serial\x2dgetty.slice.

Any help is greatly appreciated.

Realize that dmesg only tells you about what the Linux kernel is doing. U-Boot also uses that UART, and this runs prior to Linux (and U-Boot can pass on its own arguments to Linux). I couldn’t tell you what the actual modifications are, but you will need to adjust U-Boot as well to tell this to not use ttyS0.

Btw, it is wrong to remove the command line “console=tty0” unless you don’t want the local text console to show any messages. The console argument for the kernel accepts both serial and local console…one does not overwrite the other, and “tty0” is not related to “ttyS0”. Other command line arguments associated with tty0 would only be removed if there is no local console, but I suspect you just want the serial UART console to be disabled and not local console logging.

Depending on release there are differences in how to install modifications, but this may be of use (adjust if there are differences with your release):
https://devtalk.nvidia.com/default/topic/1025894/jetson-tx2/uart1-acts-as-default-debug-port-on-tx2-r28-1/post/5220368/#5220368
…and note that steps to move the serial console to a new UART can simply be skipped and steps to eliminate ttyS0 UART can be followed.

Thank you very much for the prompt reply.

I will add the “console=tty0” argument back.

I had also checked the thread you mention but was unable to find some of the files mentioned.

Specifically I could not find the commands or file described in this block for the TX1

BCT changes:
file name: tegra186-mb1-bct-misc-si-l4t.cfg
****************************
cpu.nafll_b_cluster_data = 0x11F04461;
##### debug variables #####
debug.enable_log = 1;
-debug.uart_instance = 0;
+debug.uart_instance = 2;
##### sw_carveout variables #####
****************************

I will look into uBoot further and hope to find a solution.

Which release are you using (“head -n 1 /etc/nv_tegra_release”)? Note that modifying U-Boot is mandatory…even if you have eliminated interference of serial console after reaching Linux that U-Boot will not know you don’t want serial console until you set it up as such. U-Boot essentially ends its own life by overwriting itself with Linux…until that happens the port will behave in ways you do not want.