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- Disabling the nvgetty service 

3- Testing the serial communication interfaces 

ENVIRONMENT

Hardware: DSBOX-N2

OS: Jetpack 4.5




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

 

 

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

 


RS232 Application Example


To test RS232 functionality, we used USB-Serial adapter. Connect that adapter to the USB port of the host pc and install it's driver software if necessary. To the other side of the adapter connect your DSBOX-N2 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 DSBOX-N to use Serial Port as RS232. To do this open new terminal on DSBOX-N then you can use the 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


     

    With these commands we changed communication mode as full-duplex and RS232; you can find gpio pin jobs below.

     

     

    With these commands we changed communication mode as full-duplex and RS232; you can find gpio pin jobs below.

    Lastly, 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. If you are using gtkterm on Ubuntu run gtkterm without any argument and set port parameters later. You can find DSBOX-N2 commands below.

    • sudo apt install gtkterm
    • sudo gtkterm -p /dev/ttyTHS1 -s 115200

    If you have done everything correctly you could see keyboard presses on the other machine's serial terminal.

     


    RS422 Application Example


    To test RS422 functionality, we used USB-Serial adapter. Connect that adapter to the USB port of the host pc and install it's driver software if necessary. To the other side of the adapter connect your DSBOX-N2 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 DSBOX-N2 to use Serial Port as RS422. To do this open new terminal on DSBOX-N2 then you can use the 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

       

      With these commands we changed communication mode as full-duplex and RS485; you can find gpio pin jobs below.

       

       

      Lastly, 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. If you are using gtkterm on Ubuntu run gtkterm without any argument and set port parameters later. You can find DSBOX-N2 commands below.

      • sudo apt install gtkterm
      • sudo gtkterm -p /dev/ttyTHS1 -s 115200

        If you have done everything correctly you could see your keyboard presses on the other machine's serial terminal.

        RS485 Application Example

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

         

         

        After proper connection, You should do pin muxing and make selection of data direction on DSBOX-N2 to use Serial Port as RS485. To do this open new terminal on DSBOX-N2 then you can use the 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


           

          With these commands we changed communication mode as half-duplex and RS485; you can find gpio pin jobs below.

           

           

          Lastly, 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. If you are using gtkterm on Ubuntu run gtkterm without any argument and set port parameters later. You can find DSBOX-N2 commands below.

          • sudo apt install gtkterm
          • sudo gtkterm -p /dev/ttyTHS1 -s 115200 -w RS485

             

            If you have done everything correctly you could see your keyboard presses on the other machine's serial terminal according to your data direction. You can change data direction with changing value of gpio64.



            Thank you for reading our blog post. 


            If you want to get updated on new blog posts, product launches and discounts, you can fill out the form and sign up for our newsletter. By signing up, you can reach various blog posts about AI, deep learning, machine vision, high-speed cameras, and industrial interfaces. 


            You will receive a "free shipping" code for next purchase immediately.

            English