Difference between revisions of "Mira130 Linux Driver"

From RidgeRun Developer Connection
Jump to: navigation, search
(Sony MIRA130 Features)
(Supported Platforms)
Line 275: Line 275:
 
== Supported Platforms ==
 
== Supported Platforms ==
  
* NVIDIA Jetson Nano
+
* NVIDIA Jetson Nano Development Kit B01
  
 
== Features Included in the Driver ==
 
== Features Included in the Driver ==

Revision as of 12:10, 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.

Using the Driver

GStreamer Examples

Capture and Display

  • 1920x1080@30fps RGGB12
gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=1920, height=1080, format=NV12, framerate=30/1' ! nvvidconv ! xvimagesink

Video Encoding

CAPS="video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1"

gst-launch-1.0 nvarguscamerasrc sensor-id=0 num-buffers=500 ! "video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1" ! omxh264enc ! mpegtsmux ! filesink location=test.ts

The sensor will capture in the 1920x1080@30fps mode and the pipeline will encode the video and save it into test.ts file.

Performance

ARM Load

Tegrastats display the following output when capturing with the sensor driver used in the Jetson Nano platform:

RAM 1167/3963MB (lfb 522x4MB) CPU [25%@1132,16%@1132,9%@1132,12%@1132]
RAM 1168/3963MB (lfb 522x4MB) CPU [28%@921,12%@921,9%@921,13%@921]
RAM 1167/3963MB (lfb 522x4MB) CPU [23%@921,12%@921,13%@921,10%@921]
RAM 1167/3963MB (lfb 522x4MB) CPU [28%@921,8%@921,12%@921,12%@921]
RAM 1169/3963MB (lfb 522x4MB) CPU [26%@1479,9%@1479,16%@1479,9%@1479]
RAM 1167/3963MB (lfb 522x4MB) CPU [28%@921,13%@921,9%@921,16%@921]
RAM 1168/3963MB (lfb 522x4MB) CPU [23%@1036,13%@1036,14%@1036,7%@1036]
RAM 1167/3963MB (lfb 522x4MB) CPU [25%@921,12%@921,9%@921,11%@921]
RAM 1168/3963MB (lfb 522x4MB) CPU [25%@921,13%@921,16%@921,12%@921]
RAM 1169/3963MB (lfb 522x4MB) CPU [27%@921,12%@921,8%@921,13%@921]
RAM 1168/3963MB (lfb 522x4MB) CPU [24%@921,8%@921,13%@921,10%@921]
RAM 1169/3963MB (lfb 522x4MB) CPU [29%@921,13%@921,15%@921,6%@921]

Framerate

Using the next pipeline we were able to measure the framerate for single capture with perf element:

gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1' ! perf  ! fakesink
GST-PERF-INFO --> timestamp: 0:44:34.324884537; bps: 0,000; mean_bps: 0,000; fps: 0,000; mean_fps: 0,000
GST-PERF-INFO -->  timestamp: 0:44:35.354956530; bps: 24192,000; mean_bps: 8064,000; fps: 30,095; mean_fps: 30,095
GST-PERF-INFO -->  timestamp: 0:44:36.355520992; bps: 241920,000; mean_bps: 66528,000; fps: 29,983; mean_fps: 30,039
GST-PERF-INFO -->  timestamp: 0:44:37.356864989; bps: 241920,000; mean_bps: 101606,400; fps: 29,960; mean_fps: 30,013
GST-PERF-INFO -->  timestamp: 0:44:38.357433006; bps: 241920,000; mean_bps: 124992,000; fps: 29,983; mean_fps: 30,005
GST-PERF-INFO -->  timestamp: 0:44:39.358908010; bps: 241920,000; mean_bps: 141696,000; fps: 29,956; mean_fps: 29,995
GST-PERF-INFO -->  timestamp: 0:44:40.359357860; bps: 241920,000; mean_bps: 154224,000; fps: 29,987; mean_fps: 29,994
GST-PERF-INFO -->  timestamp: 0:44:41.360617558; bps: 241920,000; mean_bps: 163968,000; fps: 29,962; mean_fps: 29,989
GST-PERF-INFO -->  timestamp: 0:44:42.361400607; bps: 241920,000; mean_bps: 171763,200; fps: 29,977; mean_fps: 29,988
GST-PERF-INFO -->  timestamp: 0:44:43.362674329; bps: 241920,000; mean_bps: 178141,091; fps: 29,962; mean_fps: 29,985
GST-PERF-INFO -->  timestamp: 0:44:44.363320878; bps: 241920,000; mean_bps: 183456,000; fps: 29,981; mean_fps: 29,984
GST-PERF-INFO -->  timestamp: 0:44:45.364541434; bps: 241920,000; mean_bps: 187953,231; fps: 29,963; mean_fps: 29,983
GST-PERF-INFO -->  timestamp: 0:44:46.365041950; bps: 241920,000; mean_bps: 191808,000; fps: 29,985; mean_fps: 29,983
GST-PERF-INFO -->  timestamp: 0:44:47.366186373; bps: 241920,000; mean_bps: 195148,800; fps: 29,966; mean_fps: 29,981
GST-PERF-INFO -->  timestamp: 0:44:48.366852845; bps: 241920,000; mean_bps: 198072,000; fps: 29,980; mean_fps: 29,981
GST-PERF-INFO -->  timestamp: 0:44:49.368081920; bps: 241920,000; mean_bps: 200651,294; fps: 29,963; mean_fps: 29,980
GST-PERF-INFO -->  timestamp: 0:44:50.368731947; bps: 241920,000; mean_bps: 202944,000; fps: 29,981; mean_fps: 29,980
GST-PERF-INFO -->  timestamp: 0:44:51.370037391; bps: 241920,000; mean_bps: 204995,368; fps: 29,961; mean_fps: 29,979
GST-PERF-INFO -->  timestamp: 0:44:52.370821395; bps: 241920,000; mean_bps: 206841,600; fps: 29,976; mean_fps: 29,979
GST-PERF-INFO -->  timestamp: 0:44:53.371545430; bps: 241920,000; mean_bps: 208512,000; fps: 29,978; mean_fps: 29,979
GST-PERF-INFO -->  timestamp: 0:44:54.372675500; bps: 241920,000; mean_bps: 210030,545; fps: 29,966; mean_fps: 29,978
GST-PERF-INFO -->  timestamp: 0:44:55.373703465; bps: 241920,000; mean_bps: 211417,043; fps: 29,969; mean_fps: 29,978


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