Skip to content

Cart

Your cart is empty

DSBOX-TX2NX Serial Communication Interfaces Tutorial

WHAT YOU WILL LEARN?

1- The pinout of I/O connector  

2-  Installing GtkTerm 

3- Testing the serial communication interfaces 

ENVIRONMENT

Hardware: DSBOARD-TX2NX

OS: JetPack 4.5.1 (L4T-32.5.1)


This blog post can suitable for:

• NVIDIA Jetson TX2 NX SOM with DSBOARD-NX2 (Rev. 1.1) 

• DSBOX-TX2NX



In this blog post, we will test the serial communication interfaces (RS232, RS422, RS485) of DSBOX-TX2NX.



First, let's look over the IO connector. On the connector, there are 4 serial communication pins and 3 ground pins.

To test all serial communication interfaces, open new terminal and install GtkTerm program for ease of use (make sure Ethernet cable is connected). Then run GtkTerm program with arguments. On host side, you can use TeraTerm or Putty for Windows; GtkTerm for Ubuntu OS. You can install GtkTerm with this terminal command:


sudo apt install gtkterm


RS232 Test


To test RS232 functionality, we use the USB-Serial adapter. Connect that adapter to the USB port of the host PC and install its driver software if necessary. To the other side of the adapter connect your device’s RS232 pins with cross connection (Rx to Tx, Tx to Rx). You can find the hardware pins below. For ground connection, use GND_DIGITAL pin.



After proper connection, you should do pin multiplexing on your device to use Serial Port as RS232. To do this open new terminal then type these commands below.


sudo sh -c "echo 264 > /sys/class/gpio/export"
sudo sh -c "echo 396 > /sys/class/gpio/export"
sudo sh -c "echo out > /sys/class/gpio/gpio264/direction"
sudo sh -c "echo out > /sys/class/gpio/gpio396/direction"
sudo sh -c "echo 0 > /sys/class/gpio/gpio264/value"
sudo sh -c "echo 0 > /sys/class/gpio/gpio396/value"


If you are using GtkTerm on Ubuntu, run these commands below. If you have done everything correctly you could see your keyboard presses on the other machine's serial terminal.


sudo gtkterm -p /dev/ttyTHS2 -s 115200


RS422 Test


To test RS422 functionality, we used USB-Serial adapter. Connect that adapter to the USB port of the host PC and install its driver software if necessary. To the other side of the adapter connect your device’s RS422 pins with cross connection (Rx to Tx, Tx to Rx but positive to positive, negative to negative). You can find the hardware pins below. For ground connection, use GND_DIGITAL pin.



After proper connection, you should do pin multiplexing on your device to use Serial Port as RS422. To do this open new terminal, then type these commands below.


sudo sh -c "echo 264 > /sys/class/gpio/export"
sudo sh -c "echo 396 > /sys/class/gpio/export"
sudo sh -c "echo out > /sys/class/gpio/gpio264/direction"
sudo sh -c "echo out > /sys/class/gpio/gpio396/direction"
sudo sh -c "echo 0 > /sys/class/gpio/gpio264/value"
sudo sh -c "echo 1 > /sys/class/gpio/gpio396/value"


If you are using GtkTerm on Ubuntu, run these commands below. If you have done everything correctly you could see your keyboard presses on the other machine's serial terminal.


sudo gtkterm -p /dev/ttyTHS2 -s 115200


RS485 Test


To test RS485 functionality, we used USB-Serial adapter. Connect that adapter to the USB port of the host PC and install its driver software if necessary. To the other side of the adapter connect your device’s RS485 pins. You can find the hardware pins below. For ground connection, use GND_DIGITAL pin.



After proper connection, you should do pin multiplexing on your device to use Serial Port as RS485. To do this open new terminal then type these commands below.


sudo sh -c "echo 340 > /sys/class/gpio/export"
sudo sh -c "echo 264 > /sys/class/gpio/export"
sudo sh -c "echo 396 > /sys/class/gpio/export"
sudo sh -c "echo out > /sys/class/gpio/gpio340/direction"
sudo sh -c "echo out > /sys/class/gpio/gpio264/direction"
sudo sh -c "echo out > /sys/class/gpio/gpio396/direction"
sudo sh -c "echo 1 > /sys/class/gpio/gpio264/value"
sudo sh -c "echo 1 > /sys/class/gpio/gpio396/value"


To Write Data


sudo sh -c "echo 1 > /sys/class/gpio/gpio340/value"


To Read Data


sudo sh -c "echo 0 > /sys/class/gpio/gpio340/value"


If you are using GtkTerm on Ubuntu, run these commands below. If you have done everything correctly you could see your keyboard presses on the other machine's serial terminal.


sudo gtkterm -p /dev/ttyTHS2 -s 115200 -w RS485

Thank you for reading our blog post.