Microprocessors
Programs

Disabling Serial Console and Enabling UART1 (/dev/ttyTHS0) on the Jetson TX2i/Astro Carrier


Overview

By default, the Astro Carrier board (ASG001) from Connect Tech uses /dev/ttyTHS0 on the Jetson TX2i as the serial console. Note that confusingly, they call this UART0 on the serial connector J1, but it is actually UART1 on the blade connector coming off the Astro!


With Linux owning /dev/ttyTHS0, it is unavailable for user applications. After it has been freed, there is still an issue with the device tree settings that prevent it from working as a Tegra UART with DMA capability. In order to change the serial console arrangement in Linux so that the kernel logs are no longer printed on /dev/ttyTHS0, and to allow this device file to be used by the user, I had to do the following.

Step 1:

Modifiy the file ~/nvidia/nvidia_sdk/JetPack_4.3_Linux_JETSON_TX2I/Linux_for_Tegra/cti-tx2i.conf.common on the host machine by changing

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

To

CMDLINE_ADD="console=tty0 OS=l4t fbcon=map:0 net.ifnames=0";

Step 2:

Decompose the currently used device tree (by copying from the host to the Astro):


On the Host

$ cd ~/nvidia/nvidia_sdk/JetPack_4.3_Linux_JETSON_TX2I/Linux_for_Tegra/kernel/dtb
$ scp tegra186-tx2i-cti-ASG001-revG+.dtb [username]@[JetsonIP]:[Folder]

On the Tx2i

$ cd [Folder] 
dtc -I dtb -O dts -o tegra186-tx2i-cti-ASG001-revG+.dts tegra186-tx2i-cti-ASG001-revG+.dtb

Step 3:

Modify the entry for serial@3100000:

serial@3100000 {
        compatible = "nvidia,tegra186-hsuart";
        iommus = <0x11 0x20>;
        reg = <0x0 0x3100000 0x0 0x40>;
        reg-shift = <0x2>;
        interrupts = <0x0 0x70 0x4>;
        nvidia,memory-clients = <0xe>;
        dmas = <0x25 0x8 0x25 0x8>;
        dma-names = "rx", "tx";
        clocks = <0x10 0x37 0x10 0x10d>;
        clock-names = "serial", "parent";
        resets = <0x10 0x2f>;
        reset-names = "serial";
        status = "okay";
        nvidia,tolerance-low-range = <0x0>;
        nvidia,tolerance-high-range = <0x4>;
        nvidia,adjust-baud-rates = <0x1c200 0x1c200 0x64>;
        console-port;
        sqa-automation-port;
        linux,phandle = <0xd5>;
        phandle = <0xd5>;
    };

Step 4:

Recompile the device tree:


On the Tx2i

$ cd [Folder] 
$ dtc -I dts -O dtb -o tegra186-tx2i-cti-ASG001-revG+.dtb tegra186-tx2i-cti-ASG001-revG+.dts

On the Host

$ cd ~/nvidia/nvidia_sdk/JetPack_4.3_Linux_JETSON_TX2I/Linux_for_Tegra/kernel/dtb
$scp [username]@[JetsonIP]:[Folder]/tegra186-tx2i-cti-ASG001-revG+.dtb ./

Step 5:

Put the device in recovery mode (with USB cable connected). Then rebuild the device tree and flash just the device tree like so:

$ sudo ./flash.sh -k kernel-dtb cti/tx2i/astro-revG+ mmcblk0p1