How to use UART in GPIO pins?

How to use UART in the 40 GPIO pins? Or where are the pins for ttyTCU0 ttyTHS0/1/4?

There is a nice header pinout diagram here:
https://www.jetsonhacks.com/nvidia-jetson-agx-xavier-gpio-header-pinout/

These would be 3.3V TTL level. I havenā€™t looked yet to see which UART pins go to which device.

If you are referring to serial console, then this does not go to the 40-pin header. It goes to the micro-USB connector on the left as you face the 40-pin header. For that you simply need a micro-B USB cable to your host, and the host needs the FTDI serial UART driver (most Linux distributions have this by default).

Thanks. I tried to connect to another device using that UART GPIO pins. But the port didnā€™t send or receive anything. I saw the serial port description ā€œDonā€™t use as GPIOā€ from your link.Do I need to manually enable it?

The GPIO UART is ttyTHS0. And it worked at 115200.

1 Like

FYI, many pins are GPIO, and the specific function depends on device tree. Some other pins may be dedicated as a UART (special function I/O, SFIO) and not designed to be GPIO. Even cases where a pin is dedicated to a non-GPIO function there may be device tree settings related to the controller of that pin, e.g., power rails. Since it worked for you as ttyTHS0 it seems device tree is good to go.

Hi,

Iā€™m using release 32.1 on the Xavier and would like to see if itā€™s possible the bootlogs on uart, if possible to have uart console to interract with the board.

My cmdline says I have 2 consoles out of which one is the framebuffer console which works ok, and the other is ttyTCU0:

console=ttyTCU0,115200n8 console=tty0 fbcon=map:0

Iā€™ve tried connecting to gpio pins like specified here [url]https://www.jetsonhacks.com/nvidia-jetson-agx-xavier-gpio-header-pinout/[/url] but I canā€™t see anything on the serial console.

The USB debug cable does not create any ttyUSB devices either.

Iā€™m seeing these logs:
[ 0.000000] earlycon: tegra_comb_uart0 at MMIO32 0x000000000c168000 (options ā€˜ā€™)
[ 0.000000] bootconsole [tegra_comb_uart0] enabled
[ 0.015876] bootconsole [tegra_comb_uart0] disabled

Does this mean that itā€™s disabled from the dtb and thatā€™s why I donā€™t see anything on the GPIO 8 and 10 pins?

On the Jetson Nano all works well, but on the Xavier Iā€™m not figuring out what I should do to have a uart console since bootloaders are loaded.

Thank you

I havenā€™t installed R32.1 on an Xavier yet, but for the TX2 the serial console has not changed when going to R32.1. I expect the Xavier will also be the same with regards to serial console functioning without any additional effort. I did notice that R32.1 serial console fails to show shutdown messages (which is a problem if you are debugging), but otherwise it works correctly.

The Xavier differs from other Jetsons in terms of pinout. While others have you connect to header pins, the micro-USB connector (when used with a micro-B cable) exposes an FTDI serial UART. One merely connects a micro-B USB cable between a hostā€™s type-A connector and the Xavierā€™s micro-USBā€¦and if there is an FTDI driver, then it will ā€œjust workā€ (on your host youā€™d have to point your serial console program at the correct ā€œ/dev/ttyUSB#ā€). No separate USB serial UART is requiredā€¦it is built in to the Xavier.

Thanks linuxdev! The issue appears to have been from some bad cables. ttyTHS0 inside the dtb for cmdline and a better uart adapter connected to the gpios did the trick.