Difference between revisions of "Mira130 Linux Driver"

From RidgeRun Developer Connection
Jump to: navigation, search
(Using the Driver)
Line 422: Line 422:
  
 
* Reboot the board after the flashing is completed.
 
* Reboot the board after the flashing is completed.
 +
 +
= Apply the v4l2src patch =
 +
 +
In order to capture with v4l2src, a patch needs to be applied to gstreamer in order for v4l2src to support a Y10 format output.
 +
 +
'''1.''' Please extract the contents provided in <code> extra_gstreamer_flashing_patches.tar</code> in <code> sources/patches</code> directory:
 +
 +
<syntaxhighlight lang=bash>
 +
cd $PATCHESPATH
 +
</syntaxhighlight>
 +
 +
<syntaxhighlight lang=bash>
 +
tar -xvf extra_gstreamer_flashing_patches.tar
 +
</syntaxhighlight>
 +
 +
== Apply the v4l2src patch to the Jetson Nano Devkit board ==
 +
 +
1. Transfer the patch to the board:
 +
 +
<syntaxhighlight lang=bash>
 +
cd $PATCHESPATH
 +
</syntaxhighlight>
 +
 +
<syntaxhighlight lang=bash>
 +
scp add-Y10-support-1.14.5.patch <nvidia-nano-user>@<nvidia-nano-ip>:/home/<nvidia-nano-username>
 +
</syntaxhighlight>
 +
 +
2. In the board, download the necessary gstreamer dependencies:
 +
 +
<syntaxhighlight lang=bash>
 +
sudo apt update
 +
</syntaxhighlight>
 +
 +
<syntaxhighlight lang=bash>
 +
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
 +
</syntaxhighlight>
 +
 +
3. Download gst-plugins-good:
 +
 +
<syntaxhighlight lang=bash>
 +
mkdir gstreamer-1.14.5; cd gstreamer-1.14.5
 +
</syntaxhighlight>
 +
 +
<syntaxhighlight lang=bash>
 +
wget https://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-1.14.5.tar.xz
 +
</syntaxhighlight>
 +
 +
<syntaxhighlight lang=bash>
 +
tar -xvf gst-plugins-good-1.14.5.tar.xz
 +
</syntaxhighlight>
 +
 +
4. Apply the patch:
 +
<syntaxhighlight lang=bash>
 +
cd gst-plugins-good-1.14.5/sys/v4l2/
 +
</syntaxhighlight>
 +
 +
<syntaxhighlight lang=bash>
 +
patch -i $HOME/add-Y10-support-1.14.5.patch
 +
</syntaxhighlight>
 +
 +
== Compile and install ==
 +
 +
1. Compile:
 +
<syntaxhighlight lang=bash>
 +
cd ~/gstreamer-1.14.5/gst-plugins-good-1.14.5
 +
</syntaxhighlight>
 +
 +
<syntaxhighlight lang=bash>
 +
./configure --prefix=/usr --libdir=/usr/lib/aarch64-linux-gnu/
 +
</syntaxhighlight>
 +
 +
<syntaxhighlight lang=bash>
 +
make
 +
</syntaxhighlight>
 +
 +
<syntaxhighlight lang=bash>
 +
DESTDIR=$(pwd)/install make install
 +
</syntaxhighlight>
 +
 +
2. Install the library:
 +
<syntaxhighlight lang=bash>
 +
sudo cp install/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstvideo4linux2.so /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstvideo4linux2.so
 +
</syntaxhighlight>
 +
  
 
==Using the Driver==
 
==Using the Driver==

Revision as of 12:33, 11 July 2022

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

RR Contact Us.png

AMS MIRA130 Features

The Mira130 is a global shutter CMOS and monochrome sensor with an effective pixel array output of 1080 H x 1280 V. This sensor supports NIR enhancement of the QE, and operations such as high dynamic range (HDR) mode, external triggering, windowing, horizontal or vertical mirroring. This sensor can perform a framerate of 120 fps with 10-bit data at a resolution of 1080 H x 1280 V as a maximum. This chip operates with analog 2.5 V, digital 1.8 V, and interface 1.8 V. High sensitivity, programmable registers through I2C, low power consumption, build-in temperature sensor are features that this sensor provides. (Applications: 3D structured light, 3D Active Stereo systems, Machine vision)

Supported Platforms

  • NVIDIA Jetson Nano Development Kit B01

Features Included in the Driver

Nano
Feature Details SDK Support
1080x1280@120fps 2 Lanes, RAW10, Y10 L4T 32.6.1 / Jetpack 4.6

RidgeRun has developed a driver for the Jetson Nano platform with the following support:

  • V4l2 Media controller driver
  • Capture with GStreamer v4l2src and v4l2-ctl

Enabling the driver

To use this driver, you have to patch and compile the kernel source.

Using Jetpack

Follow these instructions:

1. Download the toolchain following the instructions from:
Download and install the Toolchain

2. Follow the instructions to download and install the NVIDIA SDK Manager from:
Nvidia SDK Manager
- Then choose the platform (Jetson Nano) and version of JetPack (4.6). -The Nvidia SDK manager are going to install in a directory similar to:

$HOME/nvidia/nvidia_sdk/JetPack_4.6_Linux_JETSON_NANO_TARGETS/

3. Get the L4T Nano sources from:

cd $HOME/nvidia/nvidia_sdk/JetPack_4.6_Linux_JETSON_NANO_TARGETS/Linux_for_Tegra/
./source_sync.sh -t tegra-l4t-r32.6.1

4. Apply the contents provided in 4.6_evm_mira130_v0.1.tar in the sources directory:
- First untar the provided tarball:

tar -xvf 4.3_ovm6211-v0.1.0.tar

You can then apply the patch:

quilt push -a

6. To compile the code follow the steps:

export DEVDIR=$HOME/nvidia/nvidia_sdk/JetPack_4.6_Linux_JETSON_NANO_TARGETS/Linux_for_Tegra
export PATCHESPATH=$HOME/nvidia/nvidia_sdk/JetPack_4.6_Linux_JETSON_NANO_TARGETS/Linux_for_Tegra/sources/patches/
cd $DEVDIR
# Create the directory to store the compiled image and dtb
mkdir -p $DEVDIR/images/dtb
export TEGRA_KERNEL_OUT=$DEVDIR/images
export ARCH=arm64
export KERNEL_DIR=$DEVDIR/sources/kernel/kernel-4.9
export CROSS_COMPILE=$HOME/l4t-gcc/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
export LOCALVERSION=-tegra
cd $KERNEL_DIR
make mrproper
  • Make sure to enable MIRA130 driver support:
make O=$TEGRA_KERNEL_OUT tegra_defconfig
make O=$TEGRA_KERNEL_OUT menuconfig
  • In the terminal menu that appears, select:

Note: By default, the driver is selected with an asterisk. For that reason, if you go back by hitting the double Esc key the message: Do you want to save your new configuration? will not appear.

Device Drivers  --->
  <*> Multimedia support  --->
      NVIDIA overlay Encoders, decoders, sensors and other helper chips  --->
          <*> MIRA130 camera sensor support

If the driver is not selected, press the Y key in order to select the MIRA130 option. Go back by hitting the double Esc key until you get the message: Do you want to save your new configuration?, select Yes and press Enter'

  • Compile the kernel:
make O=$TEGRA_KERNEL_OUT CROSS_COMPILE=${CROSS_COMPILE} -j4 zImage
  • Compile the device tree:
make O=$TEGRA_KERNEL_OUT CROSS_COMPILE=${CROSS_COMPILE} -j4 dtbs

8. Flash the Jetson Nano:

Make sure the Jetson Nano is in recovery mode.

  • Copy the compiled image to the kernel directory.
cp $TEGRA_KERNEL_OUT/arch/arm64/boot/Image $TEGRA_KERNEL_OUT/arch/arm64/boot/zImage $DEVDIR/kernel/
  • Copy the compiled device tree to the kernel directory.
cp -r $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/* $DEVDIR/kernel/dtb/
  • Flash the memory following the next guide:
cd $DEVDIR
sudo ./flash.sh jetson-nano-qspi-sd mmcblk0p1
  • Reboot the board after the flashing is completed.

Apply the v4l2src patch

In order to capture with v4l2src, a patch needs to be applied to gstreamer in order for v4l2src to support a Y10 format output.

1. Please extract the contents provided in extra_gstreamer_flashing_patches.tar in sources/patches directory:

cd $PATCHESPATH
tar -xvf extra_gstreamer_flashing_patches.tar

Apply the v4l2src patch to the Jetson Nano Devkit board

1. Transfer the patch to the board:

cd $PATCHESPATH
scp add-Y10-support-1.14.5.patch <nvidia-nano-user>@<nvidia-nano-ip>:/home/<nvidia-nano-username>

2. In the board, download the necessary gstreamer dependencies:

sudo apt update
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev

3. Download gst-plugins-good:

mkdir gstreamer-1.14.5; cd gstreamer-1.14.5
wget https://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-1.14.5.tar.xz
tar -xvf gst-plugins-good-1.14.5.tar.xz

4. Apply the patch:

cd gst-plugins-good-1.14.5/sys/v4l2/
patch -i $HOME/add-Y10-support-1.14.5.patch

Compile and install

1. Compile:

cd ~/gstreamer-1.14.5/gst-plugins-good-1.14.5
./configure --prefix=/usr --libdir=/usr/lib/aarch64-linux-gnu/
make
DESTDIR=$(pwd)/install make install

2. Install the library:

sudo cp install/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstvideo4linux2.so /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstvideo4linux2.so


Using the Driver


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