DSBOX-N2 Serial Communication Interfaces Tutorial

DSBOX-N2 Serial Communication Interfaces Tutorial

Jetson Nano

20 February 2021
WHAT YOU WILL LEARN?

1) The pinout of I/O connector

2) Installing GtkTerm

3) Testing the serial communication interfaces


ENVIRONMENT

Hardware: DSBOX-N2

OS: JetPack 4.5 (L4T-32.5)




This blog post can suitable for:

• DSBOARD-NX2 Carrier Board with NVIDIA® Jetson™ Nano™ SOM

• DSBOX-N2 with NVIDIA® Jetson™ Nano™


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



The pinout of I/O connector


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


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




Testing the serial communication interfaces 


RS232 Test


To test RS232 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 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 muxing on your device to use Serial Port as RS232. To do this open new terminal then type these commands below.



sudo echo 168 > /sys/class/gpio/export
sudo echo 216 > /sys/class/gpio/export
sudo echo out > /sys/class/gpio/gpio168/direction
sudo echo out > /sys/class/gpio/gpio216/direction
sudo echo 0 > /sys/class/gpio/gpio168/value
sudo echo 0 > /sys/class/gpio/gpio216/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/ttyTHS1 -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 muxing on your device to use Serial Port as RS422. To do this open new terminal then type these commands below.



sudo echo 168 > /sys/class/gpio/export
sudo echo 216 > /sys/class/gpio/export
sudo echo out > /sys/class/gpio/gpio168/direction
sudo echo out > /sys/class/gpio/gpio216/direction
sudo echo 0 > /sys/class/gpio/gpio168/value
sudo echo 1 > /sys/class/gpio/gpio216/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/ttyTHS1 -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 muxing on your device to use Serial Port as RS485. To do this open new terminal then type these commands below.



sudo echo 64 > /sys/class/gpio/export
sudo echo 168 > /sys/class/gpio/export
sudo echo 216 > /sys/class/gpio/export
sudo echo out > /sys/class/gpio/gpio64/direction
sudo echo out > /sys/class/gpio/gpio168/direction
sudo echo out > /sys/class/gpio/gpio216/direction
sudo echo 1 > /sys/class/gpio/gpio168/value
sudo echo 1 > /sys/class/gpio/gpio216/value



To Write Data



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


To Read Data



sudo echo 0 > /sys/class/gpio/gpio64/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/ttyTHS1 -s 115200 -w RS485

Thank you for reading our blog post. 


English