Example of loopback communication using the two UARTs in Jetson Nano

Hi,

I’m currently developing an application in Jetson Nano that needs to use two UARTs to communicate with other two devices and I would like to:

  1. Provide an application that can be used to develop and test the communication protocol, using the two UARTs in loopback mode.
  2. Ingrate with the real devices.

Questions

  1. According to the “NVIDIA Jetson Nano Product Design Guide” the Jetson Nano has 3x UARTs. As the project I’m working is a prototype based in the DevKit, I plan to use the following two UARTs, which seem to be easy to access with dupont connectors:
  • UART1 (J50, RXD: pin 3, TXD pin 4)
  • UART2 (J41, RXD: pin 10 TXD pin 8)

This means that for the loopback setup using in development the wiring is:

UART1 RXD (J50 pin 3) — UART2 TXD (J41 pin 8)
UART1 TXD (J50 pin 4) — UART2 TXD (J41 pin 10)

Is this assignment right?

  1. I would like to disable all system output to make the UARTs exclusive to my application and -if possible- use a fixed baudrate. How is this achieved?
  2. What are the device names for these UARTs?

I’m using this simple script to test loopback connectivity:

import serial
import time
import sys

if __name__ == '__main__':
    port = sys.argv[1]    
    other = serial.Serial(port,115200)
    time.sleep(1)
    while (True):
        msg = "I am port {}\n\r".format(port)
        print("Sent: {}".format(msg))
        other.write(msg.encode())
        time.sleep(1)        
        recv_msg = other.readline() #reply
        recv_msg=str(recv_msg,'utf-8')
        print("Received in port {}: {}\n\r".format(port, recv_msg))

Terminal 1:

sudo python3 serial_test.py /dev/ttyTHS1

Terminal 2:

sudo python3 serial_test.py /dev/ttyTHS2

Problems found:

  • /dev/ttyTHS1 is connected to tty. I tried commenting:
#setsid /sbin/getty -L 115200 ttyTHS0
#setsid /sbin/getty -L 115200 ttyTHS1

in /etc/systemd/nvgetty.sh as suggested in this post and disabling the service as suggested in this other post.

Thanks in advance,

Nicolàs

Hi Nicolàs,

It seems there’s a typo about UART1 TXD (J50 pin 4) — UART2 RXD (J41 pin 10).

Could you help to provide the full serial console log?

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