UART1 acts as default debug port on TX2, R28.1

Hi,

I would like to re-direct console output from UART0 to UART1.
And I would like to use UART1 as debug port after entering linux kernel.
What I did is modifying :

serial@c280000 {
compatible = “nvidia, tegra20-uart”, “nvidia,tegra186-hsuart”;
status = “okay”;
};

Then the system is crashed.
Here are the log :

[ 0.477696] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[ 0.479642] console [ttyS0] disabled
[ 0.479690] 3100000.serial: ttyS0 at MMIO 0x3100000 (irq = 37, base_baud = 25500000) is a Tegra
[ 2.551340] console [ttyS0] enabled
[ 2.552482] c280000.serial: ttyS2 at MMIO 0xc280000 (irq = 39, base_baud = 2400000) is a Tegra
[ 2.553544] Console: switching to colour frame buffer device 80x30
[ 2.727254] CPU3: SError detected, daif=1c0, spsr=0x600000c5, mpidr=80000101, esr=bf40c000
[ 2.727257] CPU5: SError detected, daif=1c0, spsr=0x600000c5, mpidr=80000103, esr=bf40c000
[ 2.727260] CPU4: SError detected, daif=140, spsr=0x40000045, mpidr=80000102, esr=bf40c000
[ 2.727263] CPU0: SError detected, daif=140, spsr=0x40000045, mpidr=80000100, esr=bf40c000
[ 2.795545] tegradc 15200000.nvdisplay: fb registered
[ 14.306920] random: nonblocking pool is initialized
[ 23.734894] INFO: rcu_preempt detected stalls on CPUs/tasks:
[ 23.741989] 1-…: (1 GPs behind) idle=525/140000000000000/0 softirq=38/38 fqs=5241
[ 23.752672] (detected by 0, t=5256 jiffies, g=-284, c=-285, q=9)
[ 23.760156] Task dump for CPU 1:
[ 23.764750] swapper/0 R running task 0 1 0 0x00000002
[ 23.773224] Call trace:
[ 23.777024] [] __switch_to+0xa4/0xb0
[ 23.783526] [] textbuf.33279+0x0/0x3e0
[ 24.050893] Watchdog detected hard LOCKUP on cpu 1
[ 24.055554] ------------[ cut here ]------------
[ 24.062946] WARNING: at ffffffc00013ca74 [verbose debug info unavailable]
[ 24.071064] Modules linked in:
[ 24.075425]
[ 24.078163] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.38 #44
[ 24.085435] Hardware name: quill (DT)
[ 24.090327] task: ffffffc0012fcec0 ti: ffffffc0012ec000 task.ti: ffffffc0012ec000
[ 24.100260] PC is at watchdog_timer_fn+0x230/0x33c
[ 24.106264] LR is at watchdog_timer_fn+0x230/0x33c
[ 24.112206] pc : [] lr : [] pstate: 600001c5
[ 24.121873] sp : ffffffc0012efad0
[ 24.126302] x29: ffffffc0012efad0 x28: 0000000000000001
[ 24.132785] x27: ffffffc0012f4b28 x26: ffffffc1f5cf6260
[ 24.139246] x25: ffffffc0012c32c0 x24: ffffffc0012efdb0
[ 24.145665] x23: 0000000000000000 x22: 0000000000000000
[ 24.152024] x21: ffffffc0012f4000 x20: ffffffc0012c3000
[ 24.158379] x19: ffffffc0012c3248 x18: 0000000000000008
[ 24.164710] x17: 0000000000000008 x16: ffffffc000bc3a60
[ 24.171010] x15: ffffffc000bc3a60 x14: 0000000000000008
[ 24.177322] x13: ffffffc1ece92360 x12: 0000000000000001
[ 24.183610] x11: 00000000ffffffff x10: 0000000000aaaaaa
[ 24.189876] x9 : 000000000000017a x8 : 0000000000000002
[ 24.196120] x7 : ffffffc00130c2a8 x6 : 0000000000000035
[ 24.202372] x5 : 0000000000000000 x4 : 0000000000000000
[ 24.208590] x3 : 0000000000000000 x2 : 0000000000010001
[ 24.214744] x1 : ffffffc0012ec000 x0 : 0000000000000026
[ 24.220895]
[ 24.223169] —[ end trace a76c7021980d6b16 ]—
[ 24.228574] Call trace:
[ 24.231771] [] watchdog_timer_fn+0x230/0x33c
[ 24.238364] [] __hrtimer_run_queues+0x140/0x350
[ 24.245212] [] hrtimer_interrupt+0x9c/0x1e0
[ 24.251739] [] tegra186_timer_isr+0x24/0x30
[ 24.258238] [] handle_irq_event_percpu+0x84/0x290
[ 24.265234] [] handle_irq_event+0x44/0x74
[ 24.271568] [] handle_fasteoi_irq+0xb4/0x188
[ 24.278124] [] generic_handle_irq+0x24/0x38
[ 24.284588] [] __handle_domain_irq+0x60/0xb4
[ 24.291153] [] gic_handle_irq+0x5c/0xb4
[ 24.297280] [] el1_irq+0x80/0xf8
[ 24.302796] [] default_idle_call+0x1c/0x2c
[ 24.309195] [] cpu_startup_entry+0x1bc/0x340
[ 24.315769] [] rest_init+0x84/0x8c
[ 24.321492] [] start_kernel+0x39c/0x3b0
[ 24.327668] [<0000000080bb9000>] 0x80bb9000

Please advise.

Is it correct to assume this serial console output starts upon Linux kernel load, and that there is no output from the boot loader?

Normally serial console is run from both U-Boot, and then from Linux. The default naming notation is used for both: “ttyS0” (or generically “ttyS#”). If you boot Linux without any modifications, then you’ll see that ttyS0 is the named serial console even on kernel command line.

What might not be so obvious is that NVIDIA provides a serial UART driver on its own hardware which has DMA available, and that these use the “/dev/ttyTHS#” naming scheme, not the “ttyS#” scheme. It’s just conjecture, but there may be issues with first driving the port when there is some sort of DMA version still present. Without modification my TX2 shows I have “ttyTHS1” through “ttyTHS3”. “ttyS0” is present, “ttyTHS0” is absent. Perhaps you will need to adjust so that this serial UART runs only as “ttyS1” and make sure “ttyTHS1” does not exist. It’s my guess that there is a driver conflict and removal of the DMA version on ttyS1/ttyTHS1 will fix it. I do not know what the specific adjustment would be, but I expect it to be somewhere in the device tree.

Hi,
Thanks for your reply.
I did search in DTS but I cannot find anything relates to define ttyS# or ttyTHS#.
I found if I define

serial@c280000 {
compatible = “nvidia, tegra20-uart”, “nvidia,tegra186-hsuart”;
status = “okay”;
};

then system will try to create ‘ttyS2’ for me but then it’s gone.
The crashed parts of the code is in the function, uart_configure_port() in serial_core.c :

spin_lock_irqsave(&port->lock, flags);
port->ops->set_mctrl(port, port->mctrl & TIOCM_DTR);
spin_unlock_irqrestore(&port->lock, flags);

Can uartc be created as a console output ?

The driver which loads for that serial@ port will determine what the naming convention is after Linux is running. Not using DMA will be a requirement of use as a serial console since this is handed off from U-Boot and U-Boot does not have the DMA-aware driver. Whether changes to run without DMA can occur via just device tree I don’t know…there may be other configuration change as well.

The challenge is that first U-Boot must use the new port (and initialize it), then the Linux kernel must use this port without DMA. If the port is running without DMA, then a kernel argument can change the serial console to use this new UART.

Can someone here give the changes or requirements under Linux to force a non-DMA driver for a specific UART port such that it is suitable for an alternate serial console? The “ttyTHS#” naming should disappear, and only a “ttyS#” naming convention should show up for this case.

Hi, linuxdev,
Thanks for your reply.

As linuxdev mentioned, ttyTHS2 must be used as ttyS2.
I found if I make it to be ttyS2, the system will be crashed.

Can anyone help ?

Regards,

Tonie

Please help…

hello Tonie,

we’re going to check this internally.
will get back to you, thanks

Thanks…

hello Tonie,

please read the p2771-0000.conf.common, the default settings is

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

you should modify the configuration in the device tree at below path,

R28.1/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3310-1000-a00-00-base.dts

also, please check this wiki page to update the DTB partition,
https://elinux.org/Jetson/TX2_DTB

Hi, JerryChang,

I did modify these two files to :

  1. CMDLINE_ADD=“console=ttyS2,115200n8 console=tty2 OS=l4t fbcon=map:0 net.ifnames=0”;
    or
    “console=ttyTHS2,115200n8 console=tty0/1/2/3 OS=l4t fbcon=map:0 net.ifnames=0”;

  2. bartargs = "console=ttyS2/THS2, 115200.

All of these settings are failed. (I tried to use ttyTHS2 because UART1 goes to ttyTHS2).

All ttyTHS designations will fail in U-Boot since this requires a different driver than a ttyS designation. The DMA-capable drivers (ttyTHS designation) only become available after the Linux kernel loads.

Once in the Linux kernel, if serial console had used ttyS1, it may imply you have to specifically avoid using ttyTHS1 (or ttyS2/ttyTHS2). Continuity of service for the port when transitioning from U-Boot to Linux would be the reason this is required.

hello Tonie,

could you please check and share the kernel messages.
please check whether UART port# has verified or not, thanks

dmesg | grep -i THS

Hello Tonie,
It looks like you are trying to get console logs on UART2, please make below changes to get console logs on uart2:

  1. To get mb1/bootloader message:
    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

  1. To get kernel logs:
    dts changes:
    serial@3100000 {
  •           compatible = "nvidia,tegra20-uart", "nvidia,tegra186-hsuart";
    
  •           compatible = "nvidia,tegra186-hsuart";
              console-port;
              sqa-automation-port;
              status = "okay";
    

@@ -53,7 +53,7 @@
};

    serial@c280000 {
  •           compatible = "nvidia,tegra186-hsuart";
    
  •           compatible = "nvidia,tegra20-uart", "nvidia,tegra186-hsuart";
              status = "okay";
      };
    
  1. Add ttyS2 in kernel-command line:

-CMDLINE_ADD=“console=ttyS0,115200n8 console=tty1 OS=l4t fbcon=map:0 net.ifnames=0”;
+CMDLINE_ADD=“console=ttyS2,115200n8 console=tty1 OS=l4t fbcon=map:0 net.ifnames=0”;

  1. Connect Serial port to UART2 to get console logs.

Hello jburman,

In the step 4 you mentioned to connect serial port to UART2 to get console logs, as in default UART0 is used, I wonder how is the connection of UART0. I am using developer kit and also Auvidea J130. The tty console is with the keyboard and mouse through a USB port. It seems UART0 is not direct connect to the tty. Is it possible to use UART0 for other use (under OS Ubuntu 16.04)? Thanks

Hi tao.wang,

If that’s still an issue, please file a new topic.

Thanks