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.

image-2023041200001

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

image-2023041200002

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

Enter the folder

If you do not plan to use the serial console on the UART, you should disable the serial console (it depends on your choice):

Install serial module

Enter the terminal to run the program:

image-2023041200004

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.

image-2023041200005

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.

image-20240628190544124

2. Test using Linux serial port assistant

  1. Run the following command

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:

image-2023041200003

3. Notes

If you use the USB to TTL module to communicate between the computer and nano, pay attention to the following points

  1. The Dupont line cannot be too long, otherwise it will cause garbled characters
  2. 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
  3. If the line is reasonable, but garbled characters appear, check whether the baud rate, parity check, and stop bit are consistent
  4. Other situations: https://blog.csdn.net/lxj362343/article/details/89646731