Change default serial console

I am trying to move UART serial console on both u-boot and Linux from the default pins (J21, pin 8 and 10) to the J17 connector (called Serial Port Header).

First I identified that UART on J21(8, 10) is UARTA located at regbase 0x70006000. In Linux it is called ttyS0. The UART at J17 is UARTC, located at 0x70006200. Default name in Linux is ttyTHS2.

For the Linux found this way of moving it, though it required a lot more try & error than it seems:

  1. Found parameter settings and changed to this:
diff --git a/arch/arm64/boot/dts/tegra210-common.dtsi b/arch/arm64/boot/dts/tegra210-common.dtsi
index 4a511df..e5e069b 100644
--- a/arch/arm64/boot/dts/tegra210-common.dtsi
+++ b/arch/arm64/boot/dts/tegra210-common.dtsi
@@ -36,7 +36,8 @@
        };
 
        serial@70006200 {
-               compatible = "nvidia,tegra114-hsuart";
+               compatible = "nvidia,tegra210-uart", "nvidia,tegra114-hsuart";
+               console-port;
                status = "okay";
        };

This renamed the ttyTHS2 -> ttyS1 and enabled console at boot level.

  1. In order to get a working console for linux, and not just kernel messages, find this file in the rootfs: /etc/init/ttyS0.conf
    Then rename it to ttyS1.conf
    and change contents to this:
# ttyS1 - getty
#
# This service maintains a getty on ttyS1

description     "Get a getty on ttyS1"

start on stopped rc RUNLEVEL=[2345] and (
        not-container or
        container CONTAINER=lxc or
        container CONTAINER=lxc-libvirt)
stop on runlevel [!2345]

respawn

exec /sbin/getty -a ubuntu -L 115200 ttyS1

This should be enough to get a working console for Linux use.


What about the U-boot console??

Well, I saw that there is a file /arch/arm/dts/tegra210-p2371-2180.dts that contains this node:

chosen {
	stdout-path = &uarta;
};

Thought it would be enough to change this to uartc, but no luck here. The initial stage still prints on the default UART. After that, no more output is produced:

...
64b[0001.041] LPDDR4 Training: Number of tables = 10
[0001.046] EMC Training (SRC-freq: 204000; DST-freq: 408000)
[0001.052] EMC Training Successful
[0001.055] EMC Training (SRC-freq: 204000; DST-freq: 665600)
[0001.061] EMC Training Successful
[0001.064] EMC Training (SRC-freq: 204000; DST-freq: 800000)
[0001.075] EMC Training Successful
[0001.078] EMC Training (SRC-freq: 204000; DST-freq: 1065600)
[0001.101] EMC Training Successful
[0001.104] EMC Training (SRC-freq: 204000; DST-freq: 1331200)
[0001.126] EMC Training Successful
[0001.129] EMC Training (SRC-freq: 204000; DST-freq: 1600000)
[0001.148] EMC Training Successful
[0001.152] Switching to 800000 KHz Success
[0001.185] LPDDR4 Training: Number of tables = 10

!!! FOLLOWING IS NOT PRINTED !!!

U-Boot 2015.07-rc2-dirty (Mar 23 2016 - 14:37:38 +0200)

TEGRA210
Model: NVIDIA P2371-2180
DRAM:  4 GiB
...

Any ideas?

Hello, amitev:
With original u-boot, have you ever tested whether uartc works or not?
I think you can first try to send some data to uartc and check whether the waveform can be generated in the pin.

br
Chenjian

Hi,

So I have tried putting data on UARTC with inux started only - and it works on ttyTHS2. Is there a way to put something on UARTC directly from U-boot?

I have not done this, but you would probably have to recompile u-boot with that setting and flash with the modified u-boot.

Saw just now that I had a typo in my 1st post, hiding the change in u-boot source code. However, changing that/recompiling/flashing it still doesn’t work :(

To emphasize, I have not looked at this in u-boot. However, there is probably more to setting up on that UART than just naming it as the output path…there may also be something like PINMUX to set up, along with things like bit rate, parity, etc (115200 8N1).

To get rid of the early messages get rid of the earlyprintK statement in the boot command line. Once you remove that and the debug_uartport-lsport statement you will see nothing on the screen until the desktop pops up. If you want no messages at boot also get rid of the console=ttySx statement leave in the console=ttyx as that is a virtual tty that feeds the flipscreens. Also get rid of /etc/init/ttySx.conf files. If you forget to do this instead of rebooting you can do sudo stop ttySx All the messages are in log files anyway so you aren’t going to loose any useful information.

Dan

Hi:
I encountered this too,
For changing default path of console out,
Is there any SOPs so far?

There was an example not long ago for a TX2 on R28.1:
https://devtalk.nvidia.com/default/topic/1025894/jetson-tx2/uart1-acts-as-default-debug-port-on-tx2-r28-1/post/5220368/#5220368

Device tree changes may differ for a TX1, but likely there won’t be any changes for R28.1 versus other R28.x versions. In the case of device tree the block containing the two “serial@” will differ in base address. Within a given device tree serial controller, the “compatible” (see the patch described in the above URL) will use the same idea of serial console not supporting the DMA driver (need to remove that driver for serial consoles), while the other UARTs do support DMA driver. U-Boot has no DMA-capable UART driver, and to preserve continuity of service during the transition from U-Boot to Linux the same driver must be kept in place.

FYI, the TX1 is a tegra210, but the TX2 is a tegra186. Although the device tree “compatible” entry shows on a TX2 as “tegra186-hsuart” (in addition to others…“compatible” is a list of possible drivers, not a list of what will be used at any given moment), I believe there is no “tegra210-hsuart”…but there is “tegra210-uart” (“tegra210-hsuart” doesn’t exist, it still uses “tegra114-hsuart” if DMA is to be used). There is a tendency for NVIDIA to reuse older working dies, and thus “tegra114-hsuart” would be used in the TX1 DMA case instead of the “tegra186-hsuart” of the TX2. The “hs” of “hsuart” tends to imply DMA-capable, and if that driver is used, then there will be a “/dev/ttyTHS*” and not just a “/dev/ttyS*”.

The UART gaining serial console use must not use the DMA-capable “ttyTHS*” (“hs” UART driver), and must instead use the older “ttyS*” (non-“hs” driver). The serial port which is no longer used for serial console can have the “hs” UART driver added back in.

THX,
it works now.
nice tutorial.

Hi chrischang0921,
I am also trying to move the console from ttyS0 (J21) to ttyTHS2 (J17) on a TX2.
Did you get this working for all bootloaders and Linux?
Could you share your exact methodolgy for achieving this?
Many thanks.

You can use the J17 connector, but you cannot use “/dev/ttyTHS2” for serial console. You have to specify “/dev/ttyS2”. The driver in U-Boot is the generic driver, the Linux “/dev/ttyS2” is the generic driver, but “/dev/ttyTHS2” is a different driver which enables DMA (both naming conventions are the same hardware, but via different software).