DSBOX-NX2 (Rev. 1.1) Serial Communication Interfaces Tutorial

DSBOX-NX2 (Rev. 1.1) Serial Communication Interfaces Tutorial

Jetson Xavier NX

18 May 2021
WHAT YOU WILL LEARN?

1- The pinout of I/O connector  

2- Installing GtkTerm 

3- Testing the serial communication interfaces 

ENVIRONMENT

Hardware: DSBOX-NX2 (Rev. 1.1)

OS: Jetpack 4.5 (L4T-32.5)


First, let's look over the IO connector. On the connector, there are 4 serial communication pins and 2 digital ground pins. When using a serial communication interface, you should always double-check which ground pin you are using. Also, use a digital ground for serial communication applications.


To test all serial communication interfaces, open a new terminal and install the GtkTerm program for ease of use (make sure Ethernet cable is connected). Then run the GtkTerm program with arguments. On the 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 a 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 echo 424 > /sys/class/gpio/export
sudo echo 436 > /sys/class/gpio/export
sudo echo out > /sys/class/gpio/gpio424/direction
sudo echo out > /sys/class/gpio/gpio436/direction
sudo echo 0 > /sys/class/gpio/gpio424/value
sudo echo 0 > /sys/class/gpio/gpio436/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/ttyTHS0 -s 115200


RS422 Test


To test RS422 functionality, we used a 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 the 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 echo 424 > /sys/class/gpio/export
sudo echo 436 > /sys/class/gpio/export
sudo echo out > /sys/class/gpio/gpio424/direction
sudo echo out > /sys/class/gpio/gpio436/direction
sudo echo 0 > /sys/class/gpio/gpio424/value
sudo echo 1 > /sys/class/gpio/gpio436/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.

cansend can0 123#1122334455667788


RS485 Test


To test RS485 functionality, we used a 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 the 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 echo 267 > /sys/class/gpio/export
sudo echo 424 > /sys/class/gpio/export
sudo echo 436 > /sys/class/gpio/export
sudo echo out > /sys/class/gpio/gpio267/direction
sudo echo out > /sys/class/gpio/gpio424/direction
sudo echo out > /sys/class/gpio/gpio436/direction
sudo echo 1 > /sys/class/gpio/gpio424/value
sudo echo 1 > /sys/class/gpio/gpio436/value


To Write Data:


sudo echo 1 > /sys/class/gpio/gpio267/value


To Read Data:


sudo echo 0 > /sys/class/gpio/gpio267/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 apt install gtkterm
sudo gtkterm -p /dev/ttyTHS0 -s 115200 -w RS485

Thank you for reading our blog post. 



Türkçe