Jetson UART TX/RX talk with Raspberry Pi TX/RX

I am trying to get my Jetson Orin Nano with Dev Kit to talk to my Raspberry Pi 5 via pinout UART.

The connections:
GND-> GND
Jetson TX (pin 8) → Raspberry Pi RX (pin 10)
Jetson RX (pin 10)- > Raspberry Pi TX (pin 8)

My Raspberry Pi works with sending messages. Here is my Pi code:

import serial
import time

serial_port = ‘/dev/serial0’ # Use ‘/dev/serial0’ for Raspberry Pi’s UART
baud_rate = 115200

ser = serial.Serial(serial_port, baud_rate)

try:
while True:
message = “Hello from Raspberry Pi!”
ser.write(message.encode(‘utf-8’)) # Send the message
print(f"Sent: {message}")
time.sleep(2)
except KeyboardInterrupt:
print(“Exiting…”)
finally:
ser.close()

My Jetson Orin Nano code:
import serial

serial_port = ‘/dev/ttyTHS1’
baud_rate = 115200

ser = serial.Serial(serial_port, baud_rate)

try:
while True:
# Read data from the serial port
if ser.in_waiting > 0:
incoming_message = ser.readline().decode(‘utf-8’).strip()
print(f"Received: {incoming_message}")
except KeyboardInterrupt:
print(“Exiting…”)
finally:
ser.close()

The reason I use ‘/dev/ttyTHS1’ as my serial port is because JetsonHacks used it in his tutorial (https://jetsonhacks.com/2019/10/10/jetson-nano-uart/) however I don’t think its working because if I run the Jetson Nano python code with that port, it always says "serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyTHS1: [Errno 2] No such file or directory: ‘/dev/ttyTHS1’

Any advice on how to get the right port and make the 2 boards able to send messages back and forth? I appreciate any help.

Hi pshawwee,

What’s the Jetpack version you are using for Orin Nano devkit?

Please share the full dmesg and device tree for further check.

1 Like

I will add that the specific ttyTHS# or ttyS# changes depending on which type of Jetson. This also might change depending on whether this is a developer’s kit versus if it uses a third party carrier board. More specifically, you’ve posted this in the Nano forum, but that article is from the Orin Nano. This is the progression of Nanos:

  1. Original “Nano” (which is a form factor for a TX1).
  2. TX2.
  3. Xavier.
  4. Orin.

The latter “Orin” is far different than a regular (old) Nano. Are you really using an older Nano, or is it a newer Orin Nano?

1 Like

Newer Orin Nano 8gb

jetson1@jetson3-desktop:~$ sudo apt-cache show nvidia-jetpack
Package: nvidia-jetpack
Version: 5.1.4-b17
Architecture: arm64
Maintainer: NVIDIA Corporation
Installed-Size: 194
Depends: nvidia-jetpack-runtime (= 5.1.4-b17), nvidia-jetpack-dev (= 5.1.4-b17)
Homepage: Jetson - Embedded AI Computing Platform | NVIDIA Developer
Priority: standard
Section: metapackages
Filename: pool/main/n/nvidia-jetpack/nvidia-jetpack_5.1.4-b17_arm64.deb
Size: 29298
SHA256: 5439dabb8d7a097c215602f7cd11773e4745c5e7d5841d9a0a2551a58b82883e
SHA1: b0c2faa6a9d14e056e394625a11a1a8ed8780327
MD5sum: 05fc4b73de35fd33a535fb887c1947ee
Description: NVIDIA Jetpack Meta Package
Description-md5: ad1462289bdbc54909ae109d1d32c0a8

jetson1@jetson3-desktop:~$ sudo dmesg | grep -i tty
[ 0.000000] Kernel command line: root=PARTUUID=0aefb4b9-f2f5-4409-b2f4-0699b48e6896 rw rootwait rootfstype=ext4 mminit_loglevel=4 console=ttyTCU0,115200 firmware_class.path=/etc/firmware fbcon=map:0 net.ifnames=0 nospectre_bhb
[ 0.234463] 31d0000.serial: ttyAMA0 at MMIO 0x31d0000 (irq = 65, base_baud = 0) is a SBSA
[ 2.080379] printk: console [ttyTCU0] enabled
[ 5.094502] 3100000.serial: ttyTHS0 at MMIO 0x3100000 (irq = 17, base_baud = 0) is a TEGRA_UART
[ 5.109204] 3130000.serial: ttyTHS3 at MMIO 0x3130000 (irq = 63, base_baud = 0) is a TEGRA_UART
[ 5.123965] 3140000.serial: ttyTHS4 at MMIO 0x3140000 (irq = 64, base_baud = 0) is a TEGRA_UART
[ 11.704951] systemd[1]: Created slice system-serial\x2dgetty.slice.


(raspberry pi is plugged into power, not shown in photo my mistake)

For JP5.1.4(R35.6.0), you can refer to Jetson/L4T/peripheral/ - eLinux.org for the UART mapping.
Please use /dev/ttyTHS0 in your case with using PIN8 and PIN10 of 40-pins header.

1 Like

Ok I changed the serial port to /dev/ttyTHS0, but to no avail

jetson1@jetson4:~/Documents$ python3 receive.py
Serial port closed.
Traceback (most recent call last):
File “/home/jetson1/.local/lib/python3.10/site-packages/serial/serialposix.py”, line 322, in open
self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
FileNotFoundError: [Errno 2] No such file or directory: ‘/dev/ttyTHS0’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/jetson1/Documents/receive.py”, line 9, in
ser = serial.Serial(serial_port, baud_rate)
File “/home/jetson1/.local/lib/python3.10/site-packages/serial/serialutil.py”, line 244, in init
self.open()
File “/home/jetson1/.local/lib/python3.10/site-packages/serial/serialposix.py”, line 325, in open
raise SerialException(msg.errno, “could not open port {}: {}”.format(self._port, msg))
serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyTHS0: [Errno 2] No such file or directory: ‘/dev/ttyTHS0’
jetson1@jetson4:~/Documents$ ls /dev/ttyTHS*
/dev/ttyTHS1 /dev/ttyTHS2
jetson1@jetson4:~/Documents$ ls /dev/ttyS*
/dev/ttyS0 /dev/ttyS1 /dev/ttyS2 /dev/ttyS3
jetson1@jetson4:~/Documents$

Here is my Jetson code to receive from Raspberry Pi again, all the setup is the same as in photo
import serial

serial_port = ‘/dev/ttyTHS0’
baud_rate = 115200

try:
ser = serial.Serial(serial_port, baud_rate)
print(f"Listening on {serial_port} at {baud_rate} baud…“)
while True:
if ser.in_waiting > 0:
incoming_message = ser.readline().decode(‘utf-8’).strip()
print(f"Received: {incoming_message}”)
except KeyboardInterrupt:
print(“Exiting…”)
finally:
if ‘ser’ in locals() and ser.is_open:
ser.close()
print(“Serial port closed.”)

Any advice? thanks again

Do you mean /dev/ttyTHS0 can not be found on your devkit?

How could it show in dmesg but not exist in sysfs?

Please share your full dmesg and device tree again for further check.
You can run the following command to get the device tree configuration from your board.

$ sudo dtc -I fs -O dts -o extracted_proc.dts /proc/device-tree

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.