Use UART Pins on Jetson Xavier NX J14

Hello,
I’m trying to connect my Pixhawk to the Xavier NX using the UART Ports on J14. I have verified that the connection works using an UART to USB adapter, but to keep all USB ports open for other hardware, I want to connect it directly to the UART Port.
I also have a Jetson TX2 where I can “cat” on “/dev/ttyTHS1” and see the output. On the Xavier it doesn’t show anything.
Does anyone have a clue what could be the problem?
Thanks in advance.

I can’t tell you any specifics based on pins of the NX, but some of the pins and labels differ on different Jetsons. The default connection setup on the NX will be speed 115200, 8N1. If you run command “ls -l /dev/ttyTHS*”, then if you see group “dialout” I would expect that the UART should be ok to use if you have the pins to connect to it. In the case of group “tty”, then you are in conflict with serial console.

Keep in mind that any ttyS# and ttyTHS# with a matching “#” number is the same hardware, but serviced by different drivers. Also be sure you access that hardware only via one driver. Mostly this is not an issue except for the serial console port.

So /dev/ttyTHS1 is in the “dialout” group, I also already disabled the nvgetty service so I don’t have any issues with other serial consoles.
So the baudrate of my connection is 80000 Bytes per seconds. Do I maybe have to set it on the Jetson?

And regarding ttyS# and ttyTHS# does that mean it doesn’t matter which I use, as long as I only use one and don’t have any conflict?

hello autonomylab.airbus,

FYI, the default baudrate settings is 115200/8n1.
you may also check L4T sources for reference,
for example,
$L4T_Sources/r32.5/Linux_for_Tegra/source/public/kernel/kernel-4.9/drivers/tty/serial/serial-tegra.c

80  /* Default UART setting when started: 115200 no parity, stop, 8 data bits */
81  #define TEGRA_UART_DEFAULT_BAUD			115200

Yes, you need to set the UARTs at both halves of the pipe to use the same specs.

FYI, if you have ttyTHS1 as dialout, you are probably ok. You’d also want to be certain that (if it exists) “/dev/ttyS1” is also dialout (same hardware, different drivers). Also, keep in mind that this is within Linux, but if you have issues during boot, then it is possible the bootloader still uses this as a serial console (just something to keep in mind).

FYI, the ttyS# uses the older traditional driver, while the ttyTHS# uses the “Tegra High Speed” driver, and takes advantage of DMA. If the UART were required during boot (prior to Linux loading, such as in the bootloader for serial console), then it would use the ttyS#. This is because the boot code has supported the traditional driver for a very long time, and porting the THS driver to bootloader code would not be worthwhile. If one is trying to get a serial boot log from boot the full run in Linux, then there would be a loss of serial console service when switching between two drivers…thus serial console traditionally sticks to the ttyS# driver at all times.

@autonomylab.airbus
Did you fix your issue?
I’m currently using Pixhawk with Xavier NX as well. Pixhawk is configured to receive a connection on Telem2 port, baudrate 500000 8N1. On the Xavier NX side, I have it connected to /dev/ttyTHS0, UART1 on the 40-pin header.
I’m also using MAVROS, which I’m able to make a connection and receive data from the Pixhawk. My issue is on sending commands from Xavier to Pixhawk. All commands I’m getting CMD: wait ack timeout .
So in short, I have the communication from Pixhawk → Xavier working, but I don’t have Xavier → Pixhawk.
A colleague was able to get the same setup working on a Jetson Nano, but moving to Xavier NX he had the same issue.
Let me know if you faced something similar.

1 Like

I am having the same issue. Connecting pixhawk telem2 to Xavier Nx on J14 UART (with 115200/8n1). This works well on Jetson Nano when using J41 UART. Whats different for Xavier NX?

Hi!
I experience the same issue: I can receive mavlink data from pixhawk on Jetson Xavier NX via UART, but cannot transmit anything.
I checked with logic analyzer and I see the mavlink packets (or something very-very similar) going from Jetson. But looks like this packet corrupted somehow or something is wrong with them.
I am (almost) sure that software work correctly, because I connected Pixhawk to Jetson via USB and connection is perfect in both ways with the same hardware. Also exactly the same software (mavproxy) work fine for Jetson to Pixhawk communication via serial on Jetson TX2.

@JerryChang Sorry for pinging, but maybe you have any ideas on that?

hello dimm.klimenkov,

please have a try with having getty running on background,
for example, $ sudo /sbin/getty -a ubuntu -L 115200 ttyTHS< **port** > &
thanks

1 Like

Hello, @JerryChang

I did that
Running sudo /sbin/getty -a ubuntu -L 115200 ttyTHS0 & and then mavproxy.py --master=/dev/ttyTHS0 --baud 115200
I didn’t observe anything special. Can you please tell what theoretically I should observe when running getty on background?

1 Like

Not an exact answer, but when serial console is running on a UART, then the group name is “tty”, but if free for use by other software, then the group name is “dialout”. One effect of a serial console controlling a serial device is a change to group tty. Incidentally, if you add your regular user to group “dialout”, then you would not need sudo for use of a UART which is group dialout. What you should probably see with the command is stopping serial console from that UART, and reverting to group dialout, but have not tested (let me know if that is what shows up).

FYI, it can be a real mess if two programs (especially when one is a console) run at the same time on the UART.

I’ve had the exact same issue as you @kunalshrivastava.iitr and @dimm.klimenkov.
After some debugging using an oscilloscope, I found that the Xavier’s use of TI TXB0108 level translators was the issue.
I inserted a buffer between the Xavier’s UART1_TX pin and the Pixhawk - and now it is working for me.

2 Likes

How did you do that?