Serial Port Communication using .net Core on NVIDIA JETSON NANO/Xavier NX/NX2 TX Modules.

Serial Port Communication using .net Core on NVIDIA JETSON NANO/Xavier NX/NX2 TX Modules.

Jetson Nano | Jetson TX2 NX | Jetson Xavier NX

01 April 2021

1- How to create a new console Application using VS Code 

2- How to install extension packages using dotnet framework on console window 

3- How to read and send values from using serial port communication.on C#


Hardware: DSBOARD-NX2 and MOXA USB to Serial RS232 adapter

OS: JetPack 4.5 (L4T-32.5)

Power Mode: MAXN

In this article, we will explain how to use Serial communication with .net Core on ARM64 which has an operating system as Ubuntu 18.04 for NVIDIA Jetson Nano/Xavier NX modules.

For this application, we will be using our custom carrier board Forecr DSBOARD-NX2 carrier board. You can find detailed information about DSBOARD-NX2 from the link below;

Also, we will be using MOXA USB to serial RS232 adaptor for serial communication. You can find the drivers for this adapter from the link below;

After, we have finished the installation process, let’s create a sample C# serial port application using a VS code. We need to create a new console app with the following command:

Next, we should install "System.IO.Ports" and "System. Threading". To do this, navigate to the Project Directory and type following command:


Now, let’s open the application with the VSCode. Then,type the following command:


Our main focus in this application will be to read a value entered from the console and send it back to the console to see the values we have entered.

We can get our port names with this method:

“String[] ports=SerialPort.GetPortNames()”;

The output will be as follows:


In this application, we use our DSBOARD-NX2 with NVIDIA Jetson Nano module, so the name of the port is “/dev/ttyTHS1”. If we use Jetson Xavier NX we should use “/dev/ttyTHS1” and for Jetson TX2 NX “/dev/ttyTHS2”.  This serial port corresponds to pins 203,205,207,209 on module pinout.

Now, we created a new serial port object with default settings and set all the properties.


Then, we create a new thread. In this thread, we can read and send serial port inputs from another PC console.


Right now you can see what we send and write as an input and output.


Finally, we close the ports we have opened before with “serialPort.Close();”


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.