Difference between revisions of "Toshiba TC358840 Linux driver for Jetson TX1 and TX2"

From RidgeRun Developer Connection
Jump to: navigation, search
m (Spalli moved page Toshiba TC358840 Linux driver for Tegra X1 and X2 to Toshiba TC358840 Linux driver for Jetson TX1 and TX2: NVIDIA asked us to use Jetson instead of Tegra)
m
 
(25 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<seo title="Toshiba TC358840XBG | Toshiba Linux Driver for Jetson TX1" titlemode="replace" keywords="Tegra, Jetson, TX1, TX2, TC358840, Tegra X1, Tegra X2, GStreamer, Linux SDK, Linux BSP,  Embedded Linux, Device Drivers, Nvidia, Xilinx, TI, NXP, Freescale, Embedded Linux driver development, Linux Software development, Embedded Linux SDK, Embedded Linux Application development, GStreamer Multimedia Framework." description="The Toshiba TC358840XBG bridge converts high resolution HDMI® stream to MIPI® CSI-2 TX video. Read about the Toshiba Linux driver for Jetson TX1 and TX2 today."></seo>
+
<seo title="Toshiba TC358840XBG | Toshiba Linux Driver for Jetson TX1" titlemode="replace" metakeywords="Tegra, Jetson, TX1, TX2, TC358840, Tegra X1, Tegra X2, GStreamer, Linux SDK, Linux BSP,  Embedded Linux, Device Drivers, NVIDIA, Xilinx, TI, NXP, Freescale, iMX6, iMX8, Embedded Linux driver development, Linux Software development, Embedded Linux SDK, Embedded Linux Application development, GStreamer Multimedia Framework, Toshiba TC358840, Toshiba TC358840 Linux driver, Toshiba TC358840  driver, TC358840 Linux driver, TC358840, L4T, V4L2, Toshiba TC358743, TC358743, DTB, Tegra, Toshiba TC358840 decoder, 1080p@60fps, 720p@60fps" metadescription="The Toshiba TC358840XBG bridge converts high-resolution HDMI® stream to MIPI® CSI-2 TX video. Read about the Toshiba Linux driver for Jetson TX1 and TX2 today."></seo>
  
 
<table>
 
<table>
Line 5: Line 5:
 
<td><div class="clear; float:right">__TOC__</div></td>
 
<td><div class="clear; float:right">__TOC__</div></td>
 
<td>
 
<td>
<html>
+
{{Shopping cart mpo for V4L2 camera drivers}}
<div class="ecwid ecwid-SingleProduct-v2 ecwid-SingleProduct-v2-bordered ecwid-SingleProduct-v2-centered ecwid-Product ecwid-Product-59350605" itemscope itemtype="http://schema.org/Product" data-single-product-id="59350605"><div itemprop="image"></div><div class="ecwid-title" itemprop="name"></div><div itemtype="http://schema.org/Offer" itemscope itemprop="offers"><div class="ecwid-productBrowser-price ecwid-price" itemprop="price" data-spw-price-location="button"><div itemprop="priceCurrency" content="USD"></div></div></div><div customprop="options"></div><div customprop="addtobag"></div></div><script type="text/javascript" src="https://app.ecwid.com/script.js?7804024&data_platform=singleproduct_v2" charset="utf-8"></script><script type="text/javascript">xProduct()</script>
+
<td>
</html>
+
{{NVIDIA Preferred Partner logo}}
</td>
+
<td>
<td><center>
+
<td>
{{Template:Eval SDK Download, Demo Image download and Contact Us buttons}}
+
{{GStreamer debug}}
</center></td></tr></table>
+
<td>  
 +
<center>
 +
{{ContactUs Button}}
 +
</center>
 +
</tr>
 +
</table>
 +
<br>
  
= TC358840 features =  
+
== TC358840 features ==
 
Reference: [https://toshiba.semicon-storage.com/info/docget.jsp?did=28738&prodName=TC358840XBG Toshiba TC358840 bridge chip]
 
Reference: [https://toshiba.semicon-storage.com/info/docget.jsp?did=28738&prodName=TC358840XBG Toshiba TC358840 bridge chip]
  
Line 21: Line 27:
  
 
*TC358840 supports Dual links CSI-2 (CSI0 and CSI1), each link supports 4 data lanes @ 1 Gbps/data for Video resolution up to 4K×2K / 30fps (under development)
 
*TC358840 supports Dual links CSI-2 (CSI0 and CSI1), each link supports 4 data lanes @ 1 Gbps/data for Video resolution up to 4K×2K / 30fps (under development)
<br>
 
= Build driver =
 
This driver consists in a patch to default kernel provided by Nvidia, so you must apply the patch to the kernel source code and compile it, to use the built kernel image with the supported driver. Below you will find a useful link that explains step by step, how to compile Tegra X1/X2 source code:
 
  
http://developer.ridgerun.com/wiki/index.php?title=Compiling_Tegra_X1/X2_source_code
+
== Build driver ==
 +
This driver consists of a patch to the default kernel provided by Nvidia, so you must apply the patch to the kernel source code and compile it, to use the built kernel image with the supported driver. Please refer [[Compiling_Tegra_X1/X2_source_code]] for step-by-step instruction on how to compile Tegra X1/X2 source code.
  
Also, below you will find specific instructions on how to get the kernel source code, apply the driver patch and compile it, for the different currently supported versions.  
+
Also, below you will find specific instructions on how to get the kernel source code, apply the driver patch, and compile it, for the different currently supported versions.  
  
== TX1 L4T-24.2 Kernel-3.10.96 Jetpack-3.0 version ==
+
=== TX1 L4T-24.2 Kernel-3.10.96 Jetpack-3.0 version ===
 
Let's call $DEVDIR the path where you download the kernel.
 
Let's call $DEVDIR the path where you download the kernel.
  
'''1.''' In a browser, navigate to: https://developer.nvidia.com/embedded/downloads, Locate and download the L4T Sources (L4T Sources 24.2.1 2016/11/21). Also, you can use wget command:
+
'''1.''' In a browser, navigate to https://developer.nvidia.com/embedded/downloads, Locate and download the L4T Sources (L4T Sources 24.2.1 2016/11/21). Also, you can use wget command:
  
 
  wget http://developer2.download.nvidia.com/embedded/L4T/r24_Release_v2.1/BSP/sources_r24.2.1.tbz2
 
  wget http://developer2.download.nvidia.com/embedded/L4T/r24_Release_v2.1/BSP/sources_r24.2.1.tbz2
Line 57: Line 61:
 
</pre>
 
</pre>
  
'''5.''' Compile the kernel. Specify the path to the toolchain and architecture: (see http://developer.ridgerun.com/wiki/index.php?title=Compiling_Tegra_X1_source_code#Toolchain)
+
'''5.''' Compile the kernel. Specify the path to the toolchain and architecture: [[Compiling_Jetson_TX1/TX2_source_code#Toolchain]]
 
<pre>
 
<pre>
 
export CROSS_COMPILE=/opt/linaro/gcc-linaro-5.3-2016.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
 
export CROSS_COMPILE=/opt/linaro/gcc-linaro-5.3-2016.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
Line 102: Line 106:
 
</pre>
 
</pre>
  
== TX2 L4T-28.1 Kernel-4.4.38 Jetpack-3.1 version ==
+
=== TX2 L4T-28.1 Kernel-4.4.38 Jetpack-3.1 version ===
 
'''1.''' Let's call $DEVDIR the path to "Linux for Tegra" where you have installed Jetpack 3.1.
 
'''1.''' Let's call $DEVDIR the path to "Linux for Tegra" where you have installed Jetpack 3.1.
 
<pre>
 
<pre>
Line 124: Line 128:
 
</pre>
 
</pre>
  
'''4.''' Compile the kernel. Specify the path to the toolchain and architecture: (see http://developer.ridgerun.com/wiki/index.php?title=Compiling_Tegra_X1/X2_source_code#Toolchain)
+
'''4.''' Compile the kernel. Specify the path to the toolchain and architecture: [[Compiling_Tegra_X1/X2_source_code#Toolchain]]
 
<pre>
 
<pre>
 
export CROSS_COMPILE=/opt/linaro/gcc-linaro-5.3-2016.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
 
export CROSS_COMPILE=/opt/linaro/gcc-linaro-5.3-2016.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
Line 166: Line 170:
 
Save your new configuration.
 
Save your new configuration.
  
'''8.''' Compile kernel, device tree and modules.  To speed up compilation on multiprocessor systems, use -j n, this option tells make to execute many recipes simultaneously.
+
'''8.''' Compile kernel, device tree, and modules.  To speed up compilation on multiprocessor systems, use -j n, this option tells make to execute many recipes simultaneously.
 
<pre>
 
<pre>
 
make -C sources/kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT zImage
 
make -C sources/kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT zImage
Line 174: Line 178:
 
</pre>
 
</pre>
  
'''9.'''  Save your compiled Kernel Image, modules and device tree ready to flash to /boot and /lib directories of Tegra File System  image:
+
'''9.'''  Save your compiled Kernel Image, modules, and device tree ready to flash to /boot and /lib directories of Tegra File System  image:
 
<pre>
 
<pre>
 
cp $TEGRA_KERNEL_OUT/arch/arm64/boot/Image $TEGRA_KERNEL_OUT/arch/arm64/boot/zImage $TEGRA_FS_BOOT_DIR
 
cp $TEGRA_KERNEL_OUT/arch/arm64/boot/Image $TEGRA_KERNEL_OUT/arch/arm64/boot/zImage $TEGRA_FS_BOOT_DIR
Line 202: Line 206:
 
</pre>
 
</pre>
  
== TX2 L4T-28.2 Kernel-4.4.38+ Jetpack-3.2 version ==
+
=== TX2 L4T-28.2 Kernel-4.4.38+ Jetpack-3.2 version ===
 
'''1.''' Let's call $DEVDIR the path to "Linux for Tegra" where you have installed Jetpack 3.2.
 
'''1.''' Let's call $DEVDIR the path to "Linux for Tegra" where you have installed Jetpack 3.2.
 
<pre>
 
<pre>
Line 208: Line 212:
 
</pre>
 
</pre>
  
'''2.''' Download the kernel source code
+
====Download the kernel source code ====
 +
'''2.1 RECOMMENDED'''  
 +
 
 +
Download kernel sources from the next link:
 +
 
 +
https://developer.nvidia.com/embedded/dlc/sources-r2821#Getting_kernel
 +
 
 +
Untar the sources and copy kernel_src.tbz2 to $HOME/JetPack-L4T-3.2.1/64_TX2/Linux_for_Tegra/sources
 +
<pre>
 +
tar -xf public_sources.tbz2
 +
cd public_release/
 +
cp kernel_src.tbz2 $HOME/JetPack-L4T-3.2.1/64_TX2/Linux_for_Tegra/sources
 +
cd $HOME/JetPack-L4T-3.2.1/64_TX2/Linux_for_Tegra/sources
 +
tar -xf kernel_src.tbz2
 +
</pre>
 +
 
 +
'''2.2 Option 2 '''
 
<pre>
 
<pre>
 
cd $DEVDIR/
 
cd $DEVDIR/
Line 224: Line 244:
 
</pre>
 
</pre>
  
'''4.''' Compile the kernel. Specify the path to the toolchain and architecture: (see http://developer.ridgerun.com/wiki/index.php?title=Compiling_Tegra_X1/X2_source_code#Toolchain)
+
'''4.''' Compile the kernel. Specify the path to the toolchain and architecture: [[Compiling_Tegra_X1/X2_source_code#Toolchain]]
 
<pre>
 
<pre>
 
export CROSS_COMPILE=/opt/linaro/gcc-linaro-5.3-2016.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
 
export CROSS_COMPILE=/opt/linaro/gcc-linaro-5.3-2016.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
Line 274: Line 294:
 
</pre>
 
</pre>
  
'''9.'''  Save your compiled Kernel Image, modules and device tree ready to flash to /boot and /lib directories of Tegra File System  image:
+
'''9.'''  Save your compiled Kernel Image, modules, and device tree ready to flash to /boot and /lib directories of Tegra File System  image:
 
<pre>
 
<pre>
 
cp $TEGRA_KERNEL_OUT/arch/arm64/boot/Image $TEGRA_KERNEL_OUT/arch/arm64/boot/zImage $TEGRA_FS_BOOT_DIR
 
cp $TEGRA_KERNEL_OUT/arch/arm64/boot/Image $TEGRA_KERNEL_OUT/arch/arm64/boot/zImage $TEGRA_FS_BOOT_DIR
Line 302: Line 322:
 
</pre>
 
</pre>
  
 +
==Examples==
  
=Examples=
+
===Yavta===
 
 
==Yavta==
 
 
Yavta [https://github.com/fastr/yavta (Yet Another V4L2 Test Application)] can be used for testing the driver, according to the input video resolution:
 
Yavta [https://github.com/fastr/yavta (Yet Another V4L2 Test Application)] can be used for testing the driver, according to the input video resolution:
  
Line 312: Line 331:
 
</pre>
 
</pre>
  
==v4l2-ctl ==
+
===v4l2-ctl ===
 
v4l2-ctl is an application to control video4linux drivers.
 
v4l2-ctl is an application to control video4linux drivers.
  
Line 319: Line 338:
 
</pre>
 
</pre>
  
==GStreamer==
+
===GStreamer===
 
'''Simple capture pipeline:'''
 
'''Simple capture pipeline:'''
 
<pre>
 
<pre>
 
gst-launch-1.0 v4l2src device=/dev/video1 ! 'video/x-raw,format=UYVY,width=1920,height=1080' ! perf print-arm-load=true ! fakesink async=false sync=false enable-last-sample=false
 
gst-launch-1.0 v4l2src device=/dev/video1 ! 'video/x-raw,format=UYVY,width=1920,height=1080' ! perf print-arm-load=true ! fakesink async=false sync=false enable-last-sample=false
 
</pre>
 
</pre>
'''''NOTE:''''' The "perf" element is just a performance profiling tool that gives information about the current CPU load and capture framerate. If you don't have it and are interested in get it, please contact us and we will provide it. Otherwise, just remove the "perf" element from the above pipeline, when execute it.
 
  
 +
{{Ambox
 +
|type=notice
 +
|small=left
 +
|issue='''NOTE:''' The "perf" element is just a performance profiling tool that gives information about the current CPU load and captures the framerate. If you don't have it and are interested in getting it, please contact us and we will provide it. Otherwise, just remove the "perf" element from the above pipeline, when executing it.
 +
|style=width:unset;
 +
}}
  
 
'''Capture to Display pipeline (Live preview):'''
 
'''Capture to Display pipeline (Live preview):'''
Line 337: Line 361:
 
</pre>
 
</pre>
  
 +
==Performance Measurements==
 +
The following performance measurements were executed on a Jetson TX2 platform with L4T-28.1 Kernel-4.4.38 Jetpack-3.1 version on an Auvidea J130 board. The tests were performed after executing the "jetson_clocks.sh" script provided by default in standard Jetpack images. This script configures the TX in high-performance mode. The CPU load percentage measurement reported by perf is an average of the 4 ARM cores available in the TX2.
  
=Performance Measurements=
+
==Simple capture pipeline at 1080p@60fps===
The following performance measurements were executed on a Jetson TX2 platform with L4T-28.1 Kernel-4.4.38 Jetpack-3.1 version on an Auvidea J130 board. The tests were performed after executing the "jetson_clocks.sh" script provided by default in standard Jetpack images. This script configures the TX in high performance mode. The CPU load percentage measurement reported by perf is an average of the 4 ARM cores available in the TX2.
 
 
 
==Simple capture pipeline at 1080p@60fps==
 
 
<pre>
 
<pre>
 
gst-launch-1.0 v4l2src device=/dev/video1 ! 'video/x-raw,format=UYVY,width=1920,height=1080,framerate=60/1' ! perf print-arm-load=true ! fakesink async=false sync=false enable-last-sample=false
 
gst-launch-1.0 v4l2src device=/dev/video1 ! 'video/x-raw,format=UYVY,width=1920,height=1080,framerate=60/1' ! perf print-arm-load=true ! fakesink async=false sync=false enable-last-sample=false
Line 385: Line 408:
 
</pre>
 
</pre>
  
==Capture-Live preview at 1080p@60fps==
+
===Capture-Live preview at 1080p@60fps===
 
<pre>
 
<pre>
  
Line 433: Line 456:
 
</pre>
 
</pre>
  
==Capture-Live preview at 1080p@30fps==
+
===Capture-Live preview at 1080p@30fps===
 
<pre>
 
<pre>
 
DISPLAY=:0 gst-launch-1.0 v4l2src device=/dev/video1 do-timestamp=true ! \
 
DISPLAY=:0 gst-launch-1.0 v4l2src device=/dev/video1 do-timestamp=true ! \
Line 470: Line 493:
 
</pre>
 
</pre>
  
==Capture-Live preview at 720p@60fps==
+
===Capture-Live preview at 720p@60fps===
 
<pre>
 
<pre>
 
 
Line 509: Line 532:
 
</pre>
 
</pre>
  
= Articles related  =
+
== See also ==
 
[[Toshiba TC358743 Linux driver for iMX6]]
 
[[Toshiba TC358743 Linux driver for iMX6]]
  
= Contact Us =
+
{{ContactUs}}
For technical questions please send an email to '''support@ridgerun.com''' or if you are interested in purchasing the driver, please post your inquiry at our [http://www.ridgerun.com/contact/ '''Contact Us'''] link.
 
  
[[Category:Jetson]]
+
[[Category:Jetson]][[Category:Jetson V4L2 Drivers]][[Category:Toshiba]]

Latest revision as of 05:32, 20 February 2023

Nvidia-preferred-partner-badge-rgb-for-screen.png

Error something wrong.jpg Problems running the pipelines shown on this page?
Please see our GStreamer Debugging guide for help.

RR Contact Us.png


TC358840 features

Reference: Toshiba TC358840 bridge chip

TC358840XBG, Ultra HD to CSI-2, bridge converts high resolution (higher than 4 Gbps) HDMI® stream to MIPI® CSI-2 Tx video. It is a follow-up device of TC358840XBG.

  • Tested resolutions are 1280x720 and 1920x1080, both at 30 and 60 fps. The tested format is UYVY.
  • TC358840 supports Dual links CSI-2 (CSI0 and CSI1), each link supports 4 data lanes @ 1 Gbps/data for Video resolution up to 4K×2K / 30fps (under development)

Build driver

This driver consists of a patch to the default kernel provided by Nvidia, so you must apply the patch to the kernel source code and compile it, to use the built kernel image with the supported driver. Please refer Compiling_Tegra_X1/X2_source_code for step-by-step instruction on how to compile Tegra X1/X2 source code.

Also, below you will find specific instructions on how to get the kernel source code, apply the driver patch, and compile it, for the different currently supported versions.

TX1 L4T-24.2 Kernel-3.10.96 Jetpack-3.0 version

Let's call $DEVDIR the path where you download the kernel.

1. In a browser, navigate to https://developer.nvidia.com/embedded/downloads, Locate and download the L4T Sources (L4T Sources 24.2.1 2016/11/21). Also, you can use wget command:

wget http://developer2.download.nvidia.com/embedded/L4T/r24_Release_v2.1/BSP/sources_r24.2.1.tbz2

2. Copy L4T kernel sources into DEVDIR.

cp sources_r24.2.1.tbz2 $DEVDIR

3. Expand tarball file.

tar -vxjf sources_r24.2.1.tbz2
# Decompress kernel
cd sources/
sudo tar -xjf kernel_src.tbz2

4. Download tc358840-r24.2.1-j130.tar.gz file and apply the patches.

cp tc358840-r24.2.1-j130.tar.gz $DEVDIR
cd $DEVDIR
tar -xzvf tc358840-r24.2.1-j130.tar.gz
quilt push -a

5. Compile the kernel. Specify the path to the toolchain and architecture: Compiling_Jetson_TX1/TX2_source_code#Toolchain

export CROSS_COMPILE=/opt/linaro/gcc-linaro-5.3-2016.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
export CROSS32CC=/opt/linaro/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc
export ARCH=arm64

6. Define and create destination directories.

export TEGRA_KERNEL_OUT=/home/$USER/sources_tc358840/images
export TEGRA_MODULES_OUT=/home/$USER/sources_tc358840/modules
mkdir -p $TEGRA_KERNEL_OUT
mkdir -p $TEGRA_MODULES_OUT

7. Configure your kernel

make -C sources/kernel/ O=$TEGRA_KERNEL_OUT tegra21_defconfig

8. Enable driver

make -C sources/kernel/ O=$TEGRA_KERNEL_OUT menuconfig

Select the driver. The menu option is located:

-> Device Drivers
  -> Multimedia support (MEDIA_SUPPORT [=y])
    -> Encoders, decoders, sensors and other helper chips
       <*> Toshiba TC358840 decoder

Save your new configuration.

9. Compile kernel, device tree and modules. To speed up compilation on multiprocessor systems, use -j n, this option tells make to execute many recipes simultaneously.

make -C sources/kernel/ O=$TEGRA_KERNEL_OUT zImage
make -C sources/kernel/ O=$TEGRA_KERNEL_OUT dtbs
make -C sources/kernel/ O=$TEGRA_KERNEL_OUT modules
make -C sources/kernel/ O=$TEGRA_KERNEL_OUT modules_install INSTALL_MOD_PATH=$TEGRA_MODULES_OUT

TX2 L4T-28.1 Kernel-4.4.38 Jetpack-3.1 version

1. Let's call $DEVDIR the path to "Linux for Tegra" where you have installed Jetpack 3.1.

export DEVDIR=$HOME/JetPack-L4T-3.1/64_TX2/Linux_for_Tegra_tx2

2. Download the kernel source code

cd $DEVDIR/
./source_sync.sh

This will download the bootloader and kernel. When syncing, you'll be asked for a tag, let's use tegra-l4t-r28.1 for both Kernel and uboot.

3. Download tc358840-tx2-l4t28.1-j130.tar.gz file and apply the patches.

cp tc358840-tx2-l4t28.1-j130.tar.gz $DEVDIR/sources
cd $DEVDIR/sources
tar -xzvf tc358840-tx2-l4t28.1-j130.tar.gz
quilt push -a

4. Compile the kernel. Specify the path to the toolchain and architecture: Compiling_Tegra_X1/X2_source_code#Toolchain

export CROSS_COMPILE=/opt/linaro/gcc-linaro-5.3-2016.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
export CROSS32CC=/opt/linaro/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc
export ARCH=arm64

5. Define and create destination directories.

export TEGRA_KERNEL_OUT=/home/$USER/sources_tc358840/images
export TEGRA_MODULES_OUT=/home/$USER/sources_tc358840/modules
export TEGRA_FS_BOOT_DIR=/home/$USER/sources_tc358840/recompiled_image/boot
export TEGRA_FS_LIB_DIR=/home/$USER/sources_tc358840/recompiled_image/lib
mkdir -p $TEGRA_KERNEL_OUT
mkdir -p $TEGRA_MODULES_OUT
mkdir -p $TEGRA_FS_BOOT_DIR
mkdir -p $TEGRA_FS_LIB_DIR

6. Configure your kernel

cd $DEVDIR/
make -C sources/kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT tegra18_defconfig

7. Enable driver

make -C sources/kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT menuconfig

Select the driver. The menu option is located:

-> Device Drivers
  -> Multimedia support (MEDIA_SUPPORT [=y])
    -> Encoders, decoders, sensors and other helper chips
       <*> Toshiba TC358840 decoder

Save your new configuration.

8. Compile kernel, device tree, and modules. To speed up compilation on multiprocessor systems, use -j n, this option tells make to execute many recipes simultaneously.

make -C sources/kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT zImage
make -C sources/kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT dtbs
make -C sources/kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT modules
make -C sources/kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT modules_install INSTALL_MOD_PATH=$TEGRA_MODULES_OUT

9. Save your compiled Kernel Image, modules, and device tree ready to flash to /boot and /lib directories of Tegra File System image:

cp $TEGRA_KERNEL_OUT/arch/arm64/boot/Image $TEGRA_KERNEL_OUT/arch/arm64/boot/zImage $TEGRA_FS_BOOT_DIR
cp -r $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/* $TEGRA_FS_BOOT_DIR
cp -a $TEGRA_MODULES_OUT/lib/* $TEGRA_FS_LIB_DIR

10. Copy the recompiled kernel image, device tree, and modules to Tegra File System image:

sudo cp -a $TEGRA_FS_BOOT_DIR/* <TEGRA-DEVICE-ROOT-FS>/boot/ 
sudo cp -a $TEGRA_FS_LIB_DIR/* <TEGRA-DEVICE-ROOT-FS>/lib/

The <TEGRA-DEVICE-ROOT-FS> could be an SD card with the TX File System image or the EMMC of your TX containing the File System image.


11. Updating target DTB In previous versions of jetpack, updating the DTB was as easy as replacing the on in the boot folder of the boot directory and you could also just change the FDT entry in /boot/extlinux/extlinux.conf to use a different one. For Jetpack 3.1 this was changed and a separate partition is used to flash the DTB file and Nvidia says you can only update it by flashing it again using the provided flash script.

  • Replace the dtb in $DEVDIR/kernel/dtb/ with yours (you might want to make a backup of the original DTB, just in case):
cp $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/tegra186-quill-p3310-1000-c03-00-base.dtb $DEVDIR/kernel/dtb/
cd $DEVDIR/
#Put the board into recovery mode and flash the DTB
sudo ./flash.sh -r -k kernel-dtb jetson-tx2 mmcblk1p1 #if using SDcard
sudo ./flash.sh -r -k kernel-dtb jetson-tx2 mmcblk0p1 #if using EMMC 

TX2 L4T-28.2 Kernel-4.4.38+ Jetpack-3.2 version

1. Let's call $DEVDIR the path to "Linux for Tegra" where you have installed Jetpack 3.2.

export DEVDIR=$HOME/JetPack-L4T-3.2/64_TX2/Linux_for_Tegra_tx2

Download the kernel source code

2.1 RECOMMENDED

Download kernel sources from the next link:

https://developer.nvidia.com/embedded/dlc/sources-r2821#Getting_kernel

Untar the sources and copy kernel_src.tbz2 to $HOME/JetPack-L4T-3.2.1/64_TX2/Linux_for_Tegra/sources

tar -xf public_sources.tbz2
cd public_release/
cp kernel_src.tbz2 $HOME/JetPack-L4T-3.2.1/64_TX2/Linux_for_Tegra/sources
cd $HOME/JetPack-L4T-3.2.1/64_TX2/Linux_for_Tegra/sources
tar -xf kernel_src.tbz2

2.2 Option 2

cd $DEVDIR/
./source_sync.sh

This will download the bootloader and kernel. When syncing, you'll be asked for a tag, let's use tegra-l4t-r28.1 for both Kernel and uboot.

3. Download tc358840-tx2-l4t28.2-j130.tar.gz file and apply the patches.

cp tc358840-tx2-l4t28.2-j130.tar.gz $DEVDIR/sources
cd $DEVDIR/sources
tar -xzvf tc358840-tx2-l4t28.2-j130.tar.gz
quilt push -a

4. Compile the kernel. Specify the path to the toolchain and architecture: Compiling_Tegra_X1/X2_source_code#Toolchain

export CROSS_COMPILE=/opt/linaro/gcc-linaro-5.3-2016.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
export CROSS32CC=/opt/linaro/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc
export ARCH=arm64

5. Define and create destination directories.

export TEGRA_KERNEL_OUT=/home/$USER/sources_tc358840/images
export TEGRA_MODULES_OUT=/home/$USER/sources_tc358840/modules
export TEGRA_FS_BOOT_DIR=/home/$USER/sources_tc358840/recompiled_image/boot
export TEGRA_FS_LIB_DIR=/home/$USER/sources_tc358840/recompiled_image/lib
mkdir -p $TEGRA_KERNEL_OUT
mkdir -p $TEGRA_MODULES_OUT
mkdir -p $TEGRA_FS_BOOT_DIR
mkdir -p $TEGRA_FS_LIB_DIR

6. Configure your kernel

cd $DEVDIR/
make -C sources/kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT tegra18_defconfig

7. Enable driver

make -C sources/kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT menuconfig

Select the driver. The menu option is located:

-> Device Drivers
  -> Multimedia support (MEDIA_SUPPORT [=y])
    -> Encoders, decoders, sensors and other helper chips
       <*> Toshiba TC358840 decoder

Save your new configuration.

8. Compile kernel, device tree and modules. To speed up compilation on multiprocessor systems, use -j n, this option tells make to execute many recipes simultaneously.

make -C sources/kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT zImage
make -C sources/kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT dtbs
make -C sources/kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT modules
make -C sources/kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT modules_install INSTALL_MOD_PATH=$TEGRA_MODULES_OUT

9. Save your compiled Kernel Image, modules, and device tree ready to flash to /boot and /lib directories of Tegra File System image:

cp $TEGRA_KERNEL_OUT/arch/arm64/boot/Image $TEGRA_KERNEL_OUT/arch/arm64/boot/zImage $TEGRA_FS_BOOT_DIR
cp -r $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/* $TEGRA_FS_BOOT_DIR
cp -a $TEGRA_MODULES_OUT/lib/* $TEGRA_FS_LIB_DIR

10. Copy the recompiled kernel image, device tree, and modules to Tegra File System image:

sudo cp -a $TEGRA_FS_BOOT_DIR/* <TEGRA-DEVICE-ROOT-FS>/boot/ 
sudo cp -a $TEGRA_FS_LIB_DIR/* <TEGRA-DEVICE-ROOT-FS>/lib/

The <TEGRA-DEVICE-ROOT-FS> could be an SD card with the TX File System image or the EMMC of your TX containing the File System image.


11. Updating target DTB In previous versions of jetpack, updating the DTB was as easy as replacing the on in the boot folder of the boot directory and you could also just change the FDT entry in /boot/extlinux/extlinux.conf to use a different one. For Jetpack 3.1 this was changed and a separate partition is used to flash the DTB file and Nvidia says you can only update it by flashing it again using the provided flash script.

  • Replace the dtb in $DEVDIR/kernel/dtb/ with yours (you might want to make a backup of the original DTB, just in case):
cp $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/tegra186-quill-p3310-1000-c03-00-base.dtb $DEVDIR/kernel/dtb/
cd $DEVDIR/
#Put the board into recovery mode and flash the DTB
sudo ./flash.sh -r -k kernel-dtb jetson-tx2 mmcblk1p1 #if using SDcard
sudo ./flash.sh -r -k kernel-dtb jetson-tx2 mmcblk0p1 #if using EMMC 

Examples

Yavta

Yavta (Yet Another V4L2 Test Application) can be used for testing the driver, according to the input video resolution:

./yavta /dev/video1 -c600 -n4 -s1920x1080 --enum-formats -fUYVY

v4l2-ctl

v4l2-ctl is an application to control video4linux drivers.

v4l2-ctl -d /dev/video1 --set-fmt-video=width=1920,height=1080, --set-ctrl bypass_mode=0 --stream-mmap --stream-count=600

GStreamer

Simple capture pipeline:

gst-launch-1.0 v4l2src device=/dev/video1 ! 'video/x-raw,format=UYVY,width=1920,height=1080' ! perf print-arm-load=true ! fakesink async=false sync=false enable-last-sample=false

Capture to Display pipeline (Live preview):

The following pipeline can be used to visualize the input video in the Jetson TX1/TX2:

DISPLAY=:0 gst-launch-1.0 v4l2src device=/dev/video1 do-timestamp=true ! \
perf print-arm-load=true ! 'video/x-raw,format=UYVY,width=1920,height=1080,framerate=60/1' ! \
nvvidconv ! 'video/x-raw(memory:NVMM),format=I420,width=1920,height=1080,framerate=60/1' ! \
nvoverlaysink async=false sync=false enable-last-sample=false -v

Performance Measurements

The following performance measurements were executed on a Jetson TX2 platform with L4T-28.1 Kernel-4.4.38 Jetpack-3.1 version on an Auvidea J130 board. The tests were performed after executing the "jetson_clocks.sh" script provided by default in standard Jetpack images. This script configures the TX in high-performance mode. The CPU load percentage measurement reported by perf is an average of the 4 ARM cores available in the TX2.

Simple capture pipeline at 1080p@60fps=

gst-launch-1.0 v4l2src device=/dev/video1 ! 'video/x-raw,format=UYVY,width=1920,height=1080,framerate=60/1' ! perf print-arm-load=true ! fakesink async=false sync=false enable-last-sample=false
INFO:
Timestamp: 0:12:58.940864119; Bps: 4081889; fps: 60.3; CPU: 0; 
INFO:
Timestamp: 0:12:59.957496320; Bps: 4081889; fps: 60.3; CPU: 0; 
INFO:
Timestamp: 0:13:00.974133184; Bps: 4081889; fps: 60.3; CPU: 0; 
INFO:
Timestamp: 0:13:01.990764211; Bps: 4081889; fps: 60.3; CPU: 0; 
INFO:
Timestamp: 0:13:03.007399893; Bps: 4081889; fps: 60.3; CPU: 0; 
INFO:
Timestamp: 0:13:04.024039268; Bps: 4081889; fps: 60.3; CPU: 1; 
INFO:
Timestamp: 0:13:05.040669662; Bps: 4081889; fps: 60.3; CPU: 2; 
INFO:
Timestamp: 0:13:06.057302655; Bps: 4081889; fps: 60.3; CPU: 1; 
INFO:
Timestamp: 0:13:07.073937797; Bps: 4081889; fps: 60.3; CPU: 0; 
INFO:
Timestamp: 0:13:08.090571214; Bps: 4081889; fps: 60.3; CPU: 0; 
INFO:
Timestamp: 0:13:09.107213209; Bps: 4081889; fps: 60.3; CPU: 0; 
INFO:
Timestamp: 0:13:10.123846273; Bps: 4081889; fps: 60.3; CPU: 0; 
INFO:
Timestamp: 0:13:11.140480709; Bps: 4081889; fps: 60.3; CPU: 0; 
INFO:
Timestamp: 0:13:12.157117219; Bps: 4081889; fps: 60.3; CPU: 0; 
INFO:
Timestamp: 0:13:13.173759285; Bps: 4081889; fps: 60.3; CPU: 0; 
INFO:
Timestamp: 0:13:14.190394301; Bps: 4081889; fps: 60.3; CPU: 0; 
INFO:
Timestamp: 0:13:15.207033717; Bps: 4081889; fps: 60.3; CPU: 0; 
INFO:
Timestamp: 0:13:16.223669499; Bps: 4081889; fps: 60.3; CPU: 0; 

Capture-Live preview at 1080p@60fps


DISPLAY=:0 gst-launch-1.0 v4l2src device=/dev/video1 do-timestamp=true ! \
perf print-arm-load=true ! 'video/x-raw,format=UYVY,width=1920,height=1080,framerate=60/1' ! \
nvvidconv ! 'video/x-raw(memory:NVMM),format=I420,width=1920,height=1080,framerate=60/1' ! \
nvoverlaysink async=false sync=false enable-last-sample=false -v
INFO:
Timestamp: 0:08:02.989948507; Bps: 4081889; fps: 60.3; CPU: 13; 
INFO:
Timestamp: 0:08:03.989966271; Bps: 4147200; fps: 60.0; CPU: 12; 
INFO:
Timestamp: 0:08:04.989995933; Bps: 4147200; fps: 60.0; CPU: 13; 
INFO:
Timestamp: 0:08:05.990025299; Bps: 4147200; fps: 60.0; CPU: 13; 
INFO:
Timestamp: 0:08:06.990053154; Bps: 4147200; fps: 60.0; CPU: 13; 
INFO:
Timestamp: 0:08:07.990083370; Bps: 4147200; fps: 60.0; CPU: 11; 
INFO:
Timestamp: 0:08:08.990110923; Bps: 4147200; fps: 60.0; CPU: 10; 
INFO:
Timestamp: 0:08:09.990139620; Bps: 4147200; fps: 60.0; CPU: 10; 
INFO:
Timestamp: 0:08:10.990166517; Bps: 4147200; fps: 60.0; CPU: 10; 
INFO:
Timestamp: 0:08:11.990196477; Bps: 4147200; fps: 60.0; CPU: 10; 
INFO:
Timestamp: 0:08:12.990230011; Bps: 4147200; fps: 60.0; CPU: 11; 
INFO:
Timestamp: 0:08:13.990254320; Bps: 4147200; fps: 60.0; CPU: 11; 
INFO:
Timestamp: 0:08:14.990283354; Bps: 4147200; fps: 60.0; CPU: 11; 
INFO:
Timestamp: 0:08:15.990310108; Bps: 4147200; fps: 60.0; CPU: 11; 
INFO:
Timestamp: 0:08:16.990335409; Bps: 4147200; fps: 60.0; CPU: 11; 
INFO:
Timestamp: 0:08:17.990371036; Bps: 4147200; fps: 60.0; CPU: 11; 
INFO:
Timestamp: 0:08:18.990394650; Bps: 4147200; fps: 60.0; CPU: 12; 
INFO:
Timestamp: 0:08:19.990422989; Bps: 4147200; fps: 60.0; CPU: 15; 

Capture-Live preview at 1080p@30fps

DISPLAY=:0 gst-launch-1.0 v4l2src device=/dev/video1 do-timestamp=true ! \
perf print-arm-load=true ! 'video/x-raw,format=UYVY,width=1920,height=1080,framerate=30/1' ! \
nvvidconv ! 'video/x-raw(memory:NVMM),format=I420,width=1920,height=1080,framerate=30/1' ! \
nvoverlaysink async=false sync=false enable-last-sample=false -v
INFO:
INFO:
Timestamp: 0:09:31.462594179; Bps: 4014714; fps: 30.0; CPU: 7; 
INFO:
Timestamp: 0:09:32.462622018; Bps: 4147200; fps: 30.0; CPU: 6; 
INFO:
Timestamp: 0:09:33.462655465; Bps: 4147200; fps: 30.0; CPU: 7; 
INFO:
Timestamp: 0:09:34.462684023; Bps: 4147200; fps: 30.0; CPU: 8; 
INFO:
Timestamp: 0:09:35.462715689; Bps: 4147200; fps: 30.0; CPU: 8; 
INFO:
Timestamp: 0:09:36.462743682; Bps: 4147200; fps: 30.0; CPU: 7; 
INFO:
Timestamp: 0:09:37.462774656; Bps: 4147200; fps: 30.0; CPU: 6; 
INFO:
Timestamp: 0:09:38.462801188; Bps: 4147200; fps: 30.0; CPU: 6; 
INFO:
Timestamp: 0:09:39.462832432; Bps: 4147200; fps: 30.0; CPU: 7; 
INFO:
Timestamp: 0:09:40.462859680; Bps: 4147200; fps: 30.0; CPU: 6; 
INFO:
Timestamp: 0:09:41.462890935; Bps: 4147200; fps: 30.0; CPU: 5; 
INFO:
Timestamp: 0:09:42.462919762; Bps: 4147200; fps: 30.0; CPU: 5; 
INFO:
Timestamp: 0:09:43.462951317; Bps: 4147200; fps: 30.0; CPU: 5; 

Capture-Live preview at 720p@60fps

​
DISPLAY=:0 gst-launch-1.0 v4l2src device=/dev/video1 do-timestamp=true ! \
perf print-arm-load=true ! 'video/x-raw,format=UYVY,width=1280,height=720,framerate=60/1' ! \
nvvidconv ! 'video/x-raw(memory:NVMM),format=I420,width=1280,height=720,framerate=60/1' ! \
nvoverlaysink async=false sync=false enable-last-sample=false -v
​
INFO:
Timestamp: 0:01:49.661574440; Bps: 0; fps: 0.0; CPU: 13; 
INFO:
Timestamp: 0:01:50.678068687; Bps: 1814173; fps: 60.3; CPU: 4; 
INFO:
Timestamp: 0:01:51.694653853; Bps: 1814173; fps: 60.3; CPU: 5; 
INFO:
Timestamp: 0:01:52.711245768; Bps: 1814173; fps: 60.3; CPU: 6; 
INFO:
Timestamp: 0:01:53.727842543; Bps: 1814173; fps: 60.3; CPU: 6; 
INFO:
Timestamp: 0:01:54.744441368; Bps: 1814173; fps: 60.3; CPU: 5; 
INFO:
Timestamp: 0:01:55.761048260; Bps: 1814173; fps: 60.3; CPU: 6; 
INFO:
Timestamp: 0:01:56.777655010; Bps: 1814173; fps: 60.3; CPU: 5; 
INFO:
Timestamp: 0:01:57.794274563; Bps: 1814173; fps: 60.3; CPU: 5; 
INFO:
Timestamp: 0:01:58.810885062; Bps: 1814173; fps: 60.3; CPU: 5; 
INFO:
Timestamp: 0:01:59.827506633; Bps: 1814173; fps: 60.3; CPU: 5; 
INFO:
Timestamp: 0:02:00.844129340; Bps: 1814173; fps: 60.3; CPU: 5; 
INFO:
Timestamp: 0:02:01.860753501; Bps: 1814173; fps: 60.3; CPU: 5; 
INFO:
Timestamp: 0:02:02.877381687; Bps: 1814173; fps: 60.3; CPU: 4; 

See also

Toshiba TC358743 Linux driver for iMX6


RidgeRun Resources

Quick Start Client Engagement Process RidgeRun Blog Homepage
Technical and Sales Support RidgeRun Online Store RidgeRun Videos Contact Us

OOjs UI icon message-progressive.svg Contact Us

Visit our Main Website for the RidgeRun Products and Online Store. RidgeRun Engineering informations are available in RidgeRun Professional Services, RidgeRun Subscription Model and Client Engagement Process wiki pages. Please email to support@ridgerun.com for technical questions and contactus@ridgerun.com for other queries. Contact details for sponsoring the RidgeRun GStreamer projects are available in Sponsor Projects page. Ridgerun-logo.svg
RR Contact Us.png