Welcome to JetCobot repository
6.External device serial communication
External device serial port communication
1. Preparation
This section tests the serial port's self-transmitting and receiving functions of Jetson Nano. The serial port device number of Jetson Orin NX and Jetson Orin Nano motherboards needs to be modified to /dev/ttyTHS0.
From the figure below, you can see that the TXD and RXD pins of the serial port of JETSON NANO correspond to physical pins 8 and 10 respectively.

Wiring: JETSON NANO pin 8 (TXD) → JETSON NANO pin 10 (RXD)

2. Use the routine to test the serial port function
Download a serial port communication case from github. The source code and explanation can be viewed at this github link
xxxxxxxxxxgit clone https://github.com/JetsonHacksNano/UARTDemo
Enter the folder
xxxxxxxxxxcd UARTDemo
If you do not plan to use the serial console on the UART, you should disable the serial console (it depends on your choice):
xxxxxxxxxxsystemctl stop nvgettysystemctl disable nvgettyudevadm trigger
Install serial module
xxxxxxxxxxsudo apt-get install python3-serial
Enter the terminal to run the program:
xxxxxxxxxxsudo python3 uart_example.py

After running, you can see that Jetson Nano sends the characters in "NVIDIA Jetson Nano Developer Kit\r\n" in a loop and displays them on the terminal.

If you are using Jetson Orin NX and Jetson Orin Nano motherboards, you need to change the serial port device number to /dev/ttyTHS0, and you can communicate normally after running the program.

2. Test using Linux serial port assistant
- Run the following command
xxxxxxxxxxsudo apt install cutecomsudo cutecom
You can see cutecom is open Generally, no settings are required, just click open to use it, then enter text through InPUT, and press Enter to send the content. The effect is as shown in the figure:

3. Notes
If you use the USB to TTL module to communicate between the computer and nano, pay attention to the following points
- The Dupont line cannot be too long, otherwise it will cause garbled characters
- The situation where you can only receive but not send is caused by insufficient voltage. Connect the 5V port of the USB to TTL module to the 5V of the nano
- If the line is reasonable, but garbled characters appear, check whether the baud rate, parity check, and stop bit are consistent
- Other situations: https://blog.csdn.net/lxj362343/article/details/89646731