Deploy TX2 System on RealTimes TX2 Carrier

Deploy TX2 System on RealTimes TX2 Carrier

TX2 Carrier RTSO9003 from the RealTimes in China has the same function of Orbitty Carrier ASG003 for NVIDIA® Jetson™ TX2 & Jetson™ TX1 from the Connect Tech Inc. in America actually, which is designed to match the NVIDIA® Jetson™ TX2 or Jetson™ TX1 module form factor.

The Orbitty’s design includes 1x USB 3.0, 1x USB 2.0 OTG, 1x HDMI, 1x GbE, 1x microSD, 2x 3.3V UART, I2C, and 4x GPIO is deal for robotics and unmanned applications or any small form factor rugged environment. and the Carrier RTSO9003 we used includes 2x USB 3.0, 1x USB 2.0 OTG, 1x HDMI, 1x GbE, 1x microSD, 2x 3.3V UART, I2C, and 4x GPIO.

If you want to buy Orbitty Carrier ASG003, you have to send the email to the sales mail box and then the pay for one carrier ASG003 is $174+$98(Shipping cost from FedEx International Economy) = $272.00. Besides, you have to wait the FedEx delivery for a week or more. But if you buy a RTSO9003 for the Jetson TX2 in China, the price is RMB1500 and you will get one Carrier tomorrow as soon as possible by SF Express.

It’s simple and easy for us to get the thin carrier like RTSO9003 for Jetson TX2 module.But there are some things you have to be careful about the carrier application.

Where are the 2x 3.3V UART ?

The UART is hidden in J1 Com. It’s hard to find that without reading the notes. We need the UART to communicate with the robot control and the first thing is to check the UART is useable or not. Only the UART1 is designed for the communication.

Re-Flash the TX2 Operating System with the Carrier RTSO9003

The carrier driver for RTSO9003 is different from the original carrier for the Jetson TX2. The bad thing is the JetPack 3.2 (release in March,2018) is not suitable for the carrier RTSO9003 until now (April,2018), besides the driver for the carrier is customization so we have to flash the system with RTSO9003 carrier driver.

  • Linux operating system( ubuntu 14.04 system must 64-bit ) or virtual machine with Linux operating system.
  • The system with at least 16 GB of free disk space.

1. Download the L4T Jetson TX2 Driver Package and L4T Sample Root File System.  The version number is 28.1 which you have to be careful about . The size of Tegra186_Linux_R28.1.0_aarch64.tbz2 (L4T Jetson TX2 Driver Package) is about 98.1MB. The size of Tegra_Linux_Sample-Root-Filesystem_R28.1.0_aarch64.tbz2 (L4TSample Root File Package) is about 925.3MB. The website maybe need the Nvidia account login in.

2. Put the two JetPack package into the new directory (~/RealTimes/) on the host ubuntu system not Jetson TX2, and then open into the terminal to unzip the first file ” Tegra186_Linux_R28.1.0_aarch64.tbz2 “:

$ sudo tar -vxjf Tegra186_Linux_R28.1.0_aarch64.tbz2

3. we will see the new directory (~/RealTimes/Linux_for_Tegra) and then enter the directory(~/RealTimes/Linux_for_Tegra/roofs) to unzip the another file ” Tegra_Linux_Sample-Root-Filesystem_R28.1.0_aarch64.tbz2 ” with the command below :

$ sudo tar -jxpf ../../Tegra_Linux_Sample-Root-Filesystem_R28.1.0_aarch64.tbz2

4. we return back to the upper directory(~/RealTimes/Linux_for_Tegra/) to run this command to apply the binaries:

$ sudo ./

5. Then we will setup the RTSO9003 carrier driver into the system. Download the driver Realtimes-L4T-V202 from the RealTimes website. The size of Realtimes-L4T-V202 is 93Kb.

6. Unzip the file with the same level directory(~/RealTimes/) as the directory Linux_for_Tegra, and then enter the directory(~/RealTimes/Realtimes-L4T-V202) to run this command:

$ sudo ./

7. Then we need the TX2 System turn into the Recovery Mode and connect with the host ubuntu system.
8. Switch of the carrier board RTSO9003 and remove the AC adapter from the power port.
9. Connect the Recovery USB to an USB Port on the Host computer via the Micro-B USB cable.
10. Connect the power adapter to the carrier board RTSO9003.
11. Press the power button once to boot up the system. While pressing the Recovery Button, use a pin to press and release Reset Button once. Finally, release the Recovery Button.
12. Run “lsusb” from the Host computer to check if the Jetson TX2 has entered the Recovery Mode successfully. The Jetson TX2 has entered Recovery Mode successfully if “NVIDIA Crop.”is displayed on the screen, and then push the enter button into the main terminal. If no such text is displayed, repeat steps 8 to 12.
13. If the connection is successful, and we enter the directory(~/RealTimes/Linux_for_Tegra/) to run the command below to reflash the system on Jetson TX2:

$ sudo ./ rtso-9003 mmcblk0p1

Update apt-get sources link on Jetson TX2 with carrier RTSO9003

During the install process of JetPack 3.1 on the Nvidia Jetson TX2 device with the carrier RTSO9003, the same problem we faces is that the software source updates maybe slowly or with errors. So we have to change the source of software (apt-get) differ from other ubuntu 16.04 system before the next step on the carrier RTSO9003. The list I used is ok for my test.

deb xenial main restricted universe multiverse
deb xenial-updates main restricted universe multiverse
deb xenial-security main restricted universe multiverse
deb-src xenial main restricted universe multiverse
deb-src xenial-updates main restricted universe multiverse
deb-src xenial-security main restricted universe multiverse

Then run the apt-get update command to refresh the software source.

$ sudo apt-get update

Transport the packages into the new Jetson TX2 system

1. Download the JetPack package “JetPack 3.1 with L4T R28.1 “. The size of image is about 35.5MB. The website maybe need the Nvidia account login in.
2. Put the JetPack package into the new directory (~/JetsonTX2/), and then open into the terminal:

2.1. If the authority is needed, please run the command below:

$ chmod +x ./

2.1. If the authority is ok, please run the command below:

$ sudo ./

3. Click the Next to continue the JetPack 3.1 Installation, and we use the default directory to save the download software package.

4. We choose the Jetson TX2 Development Environment to control the components manager.

5. View the components manager, the first thing is we have to install the all things on the host ubuntu system for the best. The important software packages for the framework we must be installed are as list. The Jetpack 3.1 will setup the CUDA8.0, cuDNN6.0 and TensorRT 2.1, which is suitable for the framework.

6. After all the packages is installed on the Jetson TX2 system. we will setup the OpenCV 3.4.1.

Install Packages Before Setup the OpenCV 3.4.1

After the new Jetson TX2 System is ok for the next step, we have to installize some software packages on the system.

$ sudo apt-get install build-essential
$ sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
$ sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
$ sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev liblapacke-dev
$ sudo apt-get install libxvidcore-dev libx264-dev
$ sudo apt-get install libatlas-base-dev gfortran
$ sudo apt-get install ffmpeg
  # qt and qtcreator tools
$ sudo apt-get install qt5-default qtcreator -y
  # boost library
$ sudo apt-get install --no-install-recommends libboost-all-dev -y
  # openblas library
$ sudo apt-get install libatlas-base-dev -y

Install Eigen 3.3.4 Before Setup the OpenCV 3.4.1

Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms.

1. Download the Eigen 3.3.4 package ““. The size of image is about 3.05MB.
2. unzip the Eigen 3.3.4 package and there are two ways to use the Eigen packages.
3. One way: You can use right away the headers in the Eigen/ subdirectory. In order to install, just copy this Eigen/ subdirectory to your favorite location. If you also want the unsupported features, copy the unsupported/ subdirectory too.
4. Another way : enter this directory with the command:

$ cd ~/Downloads/eigen-eigen-5a0156e40feb
$ mkdir release
$ cd release
$ cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local/ ..
$ sudo make install

Install OpenCV3.4.1

OpenCV (Open Source Computer Vision Library) is released under a BSD license and hence it’s free for both academic and commercial use. It has C++, Python and Java interfaces and supports Windows, Linux, Mac OS, iOS and Android. OpenCV was designed for computational efficiency and with a strong focus on real-time applications. Written in optimized C/C++, the library can take advantage of multi-core processing. Enabled with OpenCL, it can take advantage of the hardware acceleration of the underlying heterogeneous compute platform.

1. Download the OpenCV3.4.1 package ““. The size of image is about 91.04MB.
2. unzip the OpenCV3.4.1 package and then enter this directory with the command:

$ cd ~/Downloads/opencv-3.4.1
$ mkdir release
$ cd release
$ sudo make -j8
$ sudo make install

3. All the process costs about 50 minutes depends on the machine you used, the OpenCV will be installed at the directory /usr/local .when we run cmake command, we will see the details as list:

-- General configuration for OpenCV 3.4.1 =====================================
--   Version control:               unknown
--   Platform:
--     Timestamp:                   2018-04-13T15:41:47Z
--     Host:                        Linux 4.4.38-tegra aarch64
--     CMake:                       3.5.1
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               RELEASE
--   CPU/HW features:
--     Baseline:                    NEON FP16
--       required:                  NEON
--       disabled:                  VFPV3
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ Compiler:                /usr/bin/c++  (ver 5.4.0)
--     C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
--     C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
--     C Compiler:                  /usr/bin/cc
--     C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
--     C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
--     Linker flags (Release):      
--     Linker flags (Debug):        
--     ccache:                      NO
--     Precompiled headers:         YES
--     Extra dependencies:          dl m pthread rt /usr/lib/aarch64-linux-gnu/ /usr/lib/aarch64-linux-gnu/ /usr/lib/aarch64-linux-gnu/ cudart nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cufft -L/usr/local/cuda-8.0/lib64
--     3rdparty dependencies:
--   OpenCV modules:
--     To be built:                 calib3d core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev dnn features2d flann highgui imgcodecs imgproc java_bindings_generator ml objdetect photo python2 python_bindings_generator shape stitching superres ts video videoio videostab
--     Disabled:                    js world
--     Disabled by dependency:      -
--     Unavailable:                 java python3 viz
--     Applications:                tests perf_tests apps
--     Documentation:               NO
--     Non-free algorithms:         NO
--   GUI: 
--     QT:                          YES (ver 5.5.1)
--       QT OpenGL support:         YES (Qt5::OpenGL 5.5.1)
--     GTK+:                        NO
--     OpenGL support:              YES (/usr/lib/aarch64-linux-gnu/ /usr/lib/aarch64-linux-gnu/
--     VTK support:                 NO
--   Media I/O: 
--     ZLib:                        /usr/lib/aarch64-linux-gnu/ (ver 1.2.8)
--     JPEG:                        /usr/lib/aarch64-linux-gnu/ (ver )
--     WEBP:                        build (ver encoder: 0x020e)
--     PNG:                         /usr/lib/aarch64-linux-gnu/ (ver 1.2.54)
--     TIFF:                        /usr/lib/aarch64-linux-gnu/ (ver 42 / 4.0.6)
--     JPEG 2000:                   /usr/lib/aarch64-linux-gnu/ (ver 1.900.1)
--     OpenEXR:                     build (ver 1.7.1)
--   Video I/O:
--     DC1394:                      YES (ver 2.2.4)
--     FFMPEG:                      YES
--       avcodec:                   YES (ver 56.60.100)
--       avformat:                  YES (ver 56.40.101)
--       avutil:                    YES (ver 54.31.100)
--       swscale:                   YES (ver 3.1.101)
--       avresample:                NO
--     GStreamer:                   
--       base:                      YES (ver 1.8.3)
--       video:                     YES (ver 1.8.3)
--       app:                       YES (ver 1.8.3)
--       riff:                      YES (ver 1.8.3)
--       pbutils:                   YES (ver 1.8.3)
--     libv4l/libv4l2:              1.10.0 / 1.10.0
--     v4l/v4l2:                    linux/videodev2.h
--     gPhoto2:                     NO
--   Parallel framework:            TBB (ver 4.4 interface 9002)
--   Trace:                         YES (built-in)
--   Other third-party libraries:
--     Lapack:                      YES (/usr/lib/ /usr/lib/ /usr/lib/
--     Eigen:                       YES (ver 3.3.4)
--     Custom HAL:                  YES (carotene (ver 0.0.1))
--     Protobuf:                    build (3.5.1)
--   NVIDIA CUDA:                   YES (ver 8.0, CUFFT CUBLAS)
--     NVIDIA GPU arch:             62
--     NVIDIA PTX archs:
--   OpenCL:                        YES (no extra features)
--     Include path:                /home/nvidia/Downloads/opencv-3.4.1/3rdparty/include/opencl/1.2
--     Link libraries:              Dynamic load
--   Python 2:
--     Interpreter:                 /usr/bin/python2.7 (ver 2.7.12)
--     Libraries:                   /usr/lib/aarch64-linux-gnu/ (ver 2.7.12)
--     numpy:                       /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.11.0)
--     packages path:               lib/python2.7/dist-packages
--   Python (for build):            /usr/bin/python2.7
--   Java:                          
--     ant:                         NO
--     JNI:                         NO
--     Java wrappers:               NO
--     Java tests:                  NO
--   Matlab:                        NO
--   Install to:                    /usr/local
-- -----------------------------------------------------------------
-- Configuring done
-- Generating done
-- Build files have been written to: /home/nvidia/Downloads/opencv-3.4.1/release

5. Run the command below to check if the install process is success or not.if the command return the version number, the OpenCV is successful setup on this machine.

pkg-config --modversion opencv 

Tips and Problems:

Problem   : During the CMake process, The Error will turn out as list:

[ 36%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/opengl.cpp.o
In file included from /home/ubuntu/opencv/modules/core/src/opengl.cpp:48:0:
/usr/local/cuda-8.0/include/cuda_gl_interop.h:64:2: error: #error Please include the appropriate gl headers before including cuda_gl_interop.h
 #error Please include the appropriate gl headers before including cuda_gl_interop.h[u][/u]
modules/core/CMakeFiles/opencv_core.dir/build.make:241: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/src/opengl.cpp.o' failed
make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/src/opengl.cpp.o] Error 1

Solutions  : Please apply this patch in ‘/usr/local/cuda-8.0/include/cuda_gl_interop.h’

diff --git a/cuda_gl_interop.h b/cuda_gl_interop.h
index 0f4aa17..e8c538c 100644
--- a/cuda_gl_interop.h
+++ b/cuda_gl_interop.h
@@ -59,13 +59,13 @@

 #else /* __APPLE__ */

-#if defined(__arm__) || defined(__aarch64__)
-#ifndef GL_VERSION
-#error Please include the appropriate gl headers before including cuda_gl_interop.h
+//#if defined(__arm__) || defined(__aarch64__)
+//#ifndef GL_VERSION
+//#error Please include the appropriate gl headers before including cuda_gl_interop.h
 #include <GL/gl.h>

Install Caffe2

Caffe2 is a deep learning framework that provides an easy and straightforward way for you to experiment with deep learning and leverage community contributions of new models and algorithms. You can bring your creations to scale using the power of GPUs in the cloud or to the masses on mobile with Caffe2’s cross-platform libraries.

1. Download the Caffe2 source code from GitHub use the command list.

$ git clone --recursive && cd pytorch
$ git submodule update --init

2. According to the script /scripts/ we renew a script under the same directory “scripts” with the name “”, and the datails as list:

# Example command to build Caffe2 on Tegra X2.
# This script shows how one can build a Caffe2 binary for NVidia's TX2.
# The build script assumes that you have the most recent libraries installed
# via the JetPack toolkit available at
# and it assumes that we are starting from a fresh system after the jetpack
# installation. If you have already installed some of the dependencies, you
# may be able to skip quite a few of the apt-get installs.

CAFFE2_ROOT="$( cd "$(dirname -- "$0")"/.. ; pwd -P)"
echo "Caffe2 codebase root is: $CAFFE2_ROOT"
mkdir -p $BUILD_ROOT
echo "Build Caffe2 raspbian into: $BUILD_ROOT"

# obtain necessary dependencies
echo "Installing dependencies."
sudo apt-get install \
  libgflags-dev \
  libgoogle-glog-dev \
  libprotobuf-dev \

# obtain optional dependencies that are usually useful to have.
echo "Installing optional dependencies."
sudo apt-get install \
  libleveldb-dev \
  liblmdb-dev \
  libpython-dev \
  libsnappy-dev \
  python-numpy \
  python-pip \

# Update the pip tools
sudo pip install --upgrade pip

# Obtain python hypothesis, which Caffe2 uses for unit testing. Note that
# the one provided by apt-get is quite old so we install it via pip
sudo pip install hypothesis \

# Install the six module, which includes Python 2 and 3 compatibility utilities,
# and is required for Caffe2
sudo pip install six \

# Now, actually build the android target.
echo "Building caffe2"

# CUDA_USE_STATIC_CUDA_RUNTIME needs to be set to off so that opencv can be
# properly used. Otherwise, opencv will complain that opencv_dep_cudart cannot
# be found.
    || exit 1

sudo make install -j 8 || exit 1

3. Open the terminal in the directory “scripts” to run this command to start the caffe2 installation.

$ chmod +x
$ ./

4. Run this to see if your Caffe2 installation was successful.

$ cd ~ && python -c 'from caffe2.python import core' 2>/dev/null && echo "Success" || echo "Failure"

Tips and Problems:

Problem   : if the result return “Failure” and then put “from caffe2.python import core” in python environment we get the issue about “TypeError: __init__() got an unexpected keyword argument ‘syntax'”.
Solutions  : This is the problem about the protobuf version in python. so we have to reinstall the protobuf on the target system.

$ sudo pip uninstall protobuf
$ pip install protobuf