Difference between revisions of "Mira130 Linux Driver"

From RidgeRun Developer Connection
Jump to: navigation, search
(Using the Driver)
m
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<seo title="Mira130 Linux Driver for NVIDIA Jetson | AMS Mira130 Linux Driver | RidgeRun" titlemode="replace" keywords="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, Mira130 Jetson Nano, Mira130, V4L2 Driver, AMS Mira130, AMS Mira130 Linux Driver, Mira130 Linux driver, AMS Mira130 Linux Driver, AMS, AMS Mira130, MIRA 130." description="Check out our comprehensive overview and features of the AMS Mira130 Linux Driver for NVIDIA Jetson!."></seo>
+
<seo title="MIRA130 Linux Driver for NVIDIA Jetson | AMS MIRA130 Linux Driver | RidgeRun" titlemode="replace" metakeywords="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, MIRA130 Jetson Nano, MIRA130, V4L2 Driver, AMS MIRA130, AMS MIRA130 Linux Driver, MIRA130 Linux driver, AMS MIRA130 Linux Driver, AMS, AMS MIRA130, MIRA 130." metadescription="Check out our comprehensive overview and features of the AMS MIRA130 Linux Driver for NVIDIA Jetson!."></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 id='product-component-1594671854188'></div>
+
<td>
<script type="text/javascript">
+
{{NVIDIA Preferred Partner logo}}
/*<![CDATA[*/
+
<td>
(function () {
 
  var scriptURL = 'https://sdks.shopifycdn.com/buy-button/latest/buy-button-storefront.min.js';
 
  if (window.ShopifyBuy) {
 
    if (window.ShopifyBuy.UI) {
 
      ShopifyBuyInit();
 
    } else {
 
      loadScript();
 
    }
 
  } else {
 
    loadScript();
 
  }
 
  function loadScript() {
 
    var script = document.createElement('script');
 
    script.async = true;
 
    script.src = scriptURL;
 
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(script);
 
    script.onload = ShopifyBuyInit;
 
  }
 
  function ShopifyBuyInit() {
 
    var client = ShopifyBuy.buildClient({
 
      domain: 'ridgerun1.myshopify.com',
 
      storefrontAccessToken: 'b0ca98633a82de5d2f63cd51f5af30ac',
 
    });
 
    ShopifyBuy.UI.onReady(client).then(function (ui) {
 
      ui.createComponent('product', {
 
        id: '1684420821063',
 
        node: document.getElementById('product-component-1594671854188'),
 
        moneyFormat: '%24%7B%7Bamount%7D%7D',
 
        options: {
 
  "product": {
 
    "styles": {
 
      "product": {
 
        "@media (min-width: 601px)": {
 
          "max-width": "calc(25% - 20px)",
 
          "margin-left": "20px",
 
          "margin-bottom": "50px"
 
        }
 
      },
 
      "button": {
 
        "font-family": "Open Sans, sans-serif",
 
        "font-weight": "bold",
 
        "font-size": "18px",
 
        "padding-top": "17px",
 
        "padding-bottom": "17px",
 
        ":hover": {
 
          "background-color": "#0187a7"
 
        },
 
        "background-color": "#0196ba",
 
        ":focus": {
 
          "background-color": "#0187a7"
 
        },
 
        "border-radius": "5px",
 
        "padding-left": "50px",
 
        "padding-right": "50px"
 
      },
 
      "quantityInput": {
 
        "font-size": "18px",
 
        "padding-top": "17px",
 
        "padding-bottom": "17px"
 
      }
 
    },
 
    "text": {
 
      "button": "Add to cart"
 
    },
 
    "googleFonts": [
 
      "Open Sans"
 
    ]
 
  },
 
  "productSet": {
 
    "styles": {
 
      "products": {
 
        "@media (min-width: 601px)": {
 
          "margin-left": "-20px"
 
        }
 
      }
 
    }
 
  },
 
  "modalProduct": {
 
    "contents": {
 
      "img": false,
 
      "imgWithCarousel": true,
 
      "button": false,
 
      "buttonWithQuantity": true
 
    },
 
    "styles": {
 
      "product": {
 
        "@media (min-width: 601px)": {
 
          "max-width": "100%",
 
          "margin-left": "0px",
 
          "margin-bottom": "0px"
 
        }
 
      },
 
      "button": {
 
        "font-family": "Open Sans, sans-serif",
 
        "font-weight": "bold",
 
        "font-size": "18px",
 
        "padding-top": "17px",
 
        "padding-bottom": "17px",
 
        ":hover": {
 
          "background-color": "#0187a7"
 
        },
 
        "background-color": "#0196ba",
 
        ":focus": {
 
          "background-color": "#0187a7"
 
        },
 
        "border-radius": "5px",
 
        "padding-left": "50px",
 
        "padding-right": "50px"
 
      },
 
      "quantityInput": {
 
        "font-size": "18px",
 
        "padding-top": "17px",
 
        "padding-bottom": "17px"
 
      }
 
    },
 
    "googleFonts": [
 
      "Open Sans"
 
    ]
 
  },
 
  "cart": {
 
    "styles": {
 
      "button": {
 
        "font-family": "Open Sans, sans-serif",
 
        "font-weight": "bold",
 
        "font-size": "18px",
 
        "padding-top": "17px",
 
        "padding-bottom": "17px",
 
        ":hover": {
 
          "background-color": "#0187a7"
 
        },
 
        "background-color": "#0196ba",
 
        ":focus": {
 
          "background-color": "#0187a7"
 
        },
 
        "border-radius": "5px"
 
      },
 
      "title": {
 
        "color": "#4c4c4c"
 
      },
 
      "header": {
 
        "color": "#4c4c4c"
 
      },
 
      "lineItems": {
 
        "color": "#4c4c4c"
 
      },
 
      "subtotalText": {
 
        "color": "#4c4c4c"
 
      },
 
      "subtotal": {
 
        "color": "#4c4c4c"
 
      },
 
      "notice": {
 
        "color": "#4c4c4c"
 
      },
 
      "currency": {
 
        "color": "#4c4c4c"
 
      },
 
      "close": {
 
        "color": "#4c4c4c",
 
        ":hover": {
 
          "color": "#4c4c4c"
 
        }
 
      },
 
      "empty": {
 
        "color": "#4c4c4c"
 
      },
 
      "noteDescription": {
 
        "color": "#4c4c4c"
 
      },
 
      "discountText": {
 
        "color": "#4c4c4c"
 
      },
 
      "discountIcon": {
 
        "fill": "#4c4c4c"
 
      },
 
      "discountAmount": {
 
        "color": "#4c4c4c"
 
      }
 
    },
 
    "googleFonts": [
 
      "Open Sans"
 
    ]
 
  },
 
  "toggle": {
 
    "styles": {
 
      "toggle": {
 
        "font-family": "Open Sans, sans-serif",
 
        "font-weight": "bold",
 
        "background-color": "#0196ba",
 
        ":hover": {
 
          "background-color": "#0187a7"
 
        },
 
        ":focus": {
 
          "background-color": "#0187a7"
 
        }
 
      },
 
      "count": {
 
        "font-size": "18px"
 
      }
 
    },
 
    "googleFonts": [
 
      "Open Sans"
 
    ]
 
  },
 
  "lineItem": {
 
    "styles": {
 
      "variantTitle": {
 
        "color": "#4c4c4c"
 
      },
 
      "title": {
 
        "color": "#4c4c4c"
 
      },
 
      "price": {
 
        "color": "#4c4c4c"
 
      },
 
      "fullPrice": {
 
        "color": "#4c4c4c"
 
      },
 
      "discount": {
 
        "color": "#4c4c4c"
 
      },
 
      "discountIcon": {
 
        "fill": "#4c4c4c"
 
      },
 
      "quantity": {
 
        "color": "#4c4c4c"
 
      },
 
      "quantityIncrement": {
 
        "color": "#4c4c4c",
 
        "border-color": "#4c4c4c"
 
      },
 
      "quantityDecrement": {
 
        "color": "#4c4c4c",
 
        "border-color": "#4c4c4c"
 
      },
 
      "quantityInput": {
 
        "color": "#4c4c4c",
 
        "border-color": "#4c4c4c"
 
      }
 
    }
 
  }
 
},
 
      });
 
    });
 
  }
 
})();
 
/*]]>*/
 
</script>
 
</html>
 
 
<td>
 
<td>
 
{{GStreamer debug}}
 
{{GStreamer debug}}
Line 266: Line 17:
 
</tr>
 
</tr>
 
</table>
 
</table>
 +
<br>
  
 
== AMS MIRA130 Features ==
 
== AMS MIRA130 Features ==
Line 285: Line 37:
 
|<!--
 
|<!--
 
-->
 
-->
{| class="wikitable sortable mw-collapsible mw-collapsed" style="width:100%; margin:0;"
+
{| class="wikitable sortable mw-collapsible mw-Uncollapsed" style="width:100%; margin:0;"
 
! Feature
 
! Feature
 
! Details
 
! Details
Line 312: Line 64:
  
 
1.  Download the toolchain following the instructions from:<br>
 
1.  Download the toolchain following the instructions from:<br>
[https://developer.ridgerun.com/wiki/index.php?title=Jetson_Nano/Development/Building_the_Kernel_from_Source#1._Download_and_install_the_Toolchain Download and install the Toolchain]
+
[[Jetson_Nano/Development/Building_the_Kernel_from_Source#1._Download_and_install_the_Toolchain | Download and install the Toolchain]]
  
 
2.  Follow the instructions to download and install the NVIDIA SDK Manager from: <br>
 
2.  Follow the instructions to download and install the NVIDIA SDK Manager from: <br>
[https://developer.nvidia.com/nvidia-sdk-manager Nvidia SDK Manager] <br>
+
[https://developer.nvidia.com/nvidia-sdk-manager NVIDIA SDK Manager] <br>
 
- Then choose the platform (Jetson Nano) and version of JetPack (4.6).
 
- 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:
+
- The NVIDIA SDK manager is going to install in a directory similar to:
 
<source lang="bash">
 
<source lang="bash">
 
$HOME/nvidia/nvidia_sdk/JetPack_4.6_Linux_JETSON_NANO_TARGETS/
 
$HOME/nvidia/nvidia_sdk/JetPack_4.6_Linux_JETSON_NANO_TARGETS/
Line 331: Line 83:
 
- First untar the provided tarball:
 
- First untar the provided tarball:
 
<pre>
 
<pre>
tar -xvf 4.3_ovm6211-v0.1.0.tar
+
tar -xvf 4.6_evm_mira130_v0.1.tar
 
</pre>
 
</pre>
  
Line 340: Line 92:
 
</pre>
 
</pre>
  
6.  To compile the code follow the steps: <br>
+
5.  To compile the code follow the steps: <br>
  
 
<source lang="bash">
 
<source lang="bash">
Line 378: Line 130:
 
* In the terminal menu that appears, select:
 
* 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.
+
{{Ambox
 +
|type=notice
 +
|small=left
 +
|issue='''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.
 +
|style=width:unset;
 +
}}
  
 
<pre>
 
<pre>
Line 401: Line 158:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
8. Flash the Jetson Nano:
+
6. Flash the Jetson Nano:
  
 
Make sure the Jetson Nano is in recovery mode.
 
Make sure the Jetson Nano is in recovery mode.
Line 423: Line 180:
 
* Reboot the board after the flashing is completed.
 
* Reboot the board after the flashing is completed.
  
= Apply the v4l2src patch =
+
== 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.
+
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:  
 
'''1.''' Please extract the contents provided in <code> extra_gstreamer_flashing_patches.tar</code> in <code> sources/patches</code> directory:  
Line 437: Line 194:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
== Apply the v4l2src patch to the Jetson Nano Devkit board ==
+
=== Apply the v4l2src patch to the Jetson Nano Devkit board ===
  
 
1. Transfer the patch to the board:
 
1. Transfer the patch to the board:
Line 482: Line 239:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
== Compile and install ==
+
=== Compile and install ===
  
 
1. Compile:  
 
1. Compile:  
Line 506: Line 263:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 +
== Using the Driver ==
  
= Using the Driver =
+
=== Capture with v4l2-ctl ===
 
 
== Capture with v4l2-ctl ==
 
  
 
* Install v4l utils:
 
* Install v4l utils:
Line 517: Line 273:
  
 
* Test the capture framerate:
 
* Test the capture framerate:
 
  
 
<syntaxhighlight lang=bash>
 
<syntaxhighlight lang=bash>
Line 552: Line 307:
 
- Little Endian box checked <br>
 
- Little Endian box checked <br>
  
'''Note:''' The Y10 format comes in 2 bytes with a padding of zeros for the remaining bits. Since rawpixels requires the bit depth specification for Y10 to be 16bpps, the image looks darker.  
+
{{Ambox
 +
|type=notice
 +
|small=left
 +
|issue='''Note:''' The Y10 format comes in 2 bytes with padding of zeros for the remaining bits. Since rawpixels require the bit depth specification for Y10 to be 16bpps, the image looks darker.  
 +
|style=width:unset;
 +
}}
  
 
* '''vooya:''' <br>
 
* '''vooya:''' <br>
Line 562: Line 322:
 
- ''Bit Depth (Value):'' 14bit <br>
 
- ''Bit Depth (Value):'' 14bit <br>
  
'''Note1:''' Bit depth needs to be 14 due to how the Jetson boards pack pixels. The image looks darker.
+
{{Ambox
 +
|type=notice
 +
|small=left
 +
|issue='''Note1:''' Bit depth needs to be 14 due to how the Jetson boards pack pixels. The image looks darker.
 +
|style=width:unset;
 +
}}
 +
 
 +
{{Ambox
 +
|type=notice
 +
|small=left
 +
|issue='''Note2:''' To see the frame the bit depth needs to be 9 or 10.
 +
|style=width:unset;
 +
}}
 +
 
 +
=== Capture with GStreamer ===
 +
 
 +
{{Ambox
 +
|type=notice
 +
|small=left
 +
|issue='''Important:''' To achieve the maximum performance at 120 fps on the Jetson Nano Devkit board, you need to run the following command on the terminal every time the board is powered on:
 +
|style=width:unset;
 +
}}
 +
 
 +
<syntaxhighlight lang=bash>
 +
sudo jetson_clocks
 +
</syntaxhighlight>
 +
 
 +
==== Performance statistics ====
 +
 
 +
<pre style="background:#d6e4f1">
 +
gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,width=1080,height=1280,framerate=120/1,format=GRAY16_LE" ! queue ! fakesink
 +
</pre>
 +
 
 +
<pre>
 +
RAM 1233/3963MB (lfb 400x4MB) CPU [0%@1479,0%@1479,0%@1479,50%@1479]
 +
RAM 1233/3963MB (lfb 400x4MB) CPU [1%@1479,0%@1479,0%@1479,52%@1479]
 +
RAM 1233/3963MB (lfb 400x4MB) CPU [3%@1479,0%@1479,0%@1479,52%@1479]
 +
RAM 1233/3963MB (lfb 400x4MB) CPU [8%@1479,1%@1479,0%@1479,51%@1479]
 +
RAM 1233/3963MB (lfb 400x4MB) CPU [2%@1479,0%@1479,0%@1479,52%@1479]
 +
RAM 1233/3963MB (lfb 400x4MB) CPU [1%@1479,0%@1479,0%@1479,51%@1479]
 +
RAM 1233/3963MB (lfb 400x4MB) CPU [1%@1479,1%@1479,0%@1479,51%@1479]
 +
RAM 1233/3963MB (lfb 400x4MB) CPU [2%@1479,2%@1479,16%@1479,37%@1479]
 +
RAM 1233/3963MB (lfb 400x4MB) CPU [0%@1479,0%@1479,0%@1479,51%@1479]
 +
RAM 1233/3963MB (lfb 400x4MB) CPU [0%@1479,0%@1479,45%@1479,7%@1479]
 +
RAM 1233/3963MB (lfb 400x4MB) CPU [1%@1479,1%@1479,52%@1479,0%@1479]
 +
</pre>
 +
 
 +
==== Framerate ====
 +
 
 +
Using the next pipeline we were able to measure the framerate for single capture with perf element:
 +
 
 +
<pre style="background:#d6e4f1">
 +
gst-launch-1.0 v4l2src device=/dev/video0 ! perf ! "video/x-raw,width=1080,height=1280,framerate=120/1,format=GRAY16_LE" ! fakesink
 +
</pre>
 +
 
 +
<pre>
 +
perf: perf0; timestamp: 0:56:38.972435551; bps: 0,000; mean_bps: 0,000; fps: 0,000; mean_fps: 0,000
 +
INFO:
 +
perf: perf0; timestamp: 0:56:39.979731288; bps: 2540175360,000; mean_bps: 0,000; fps: 120,124; mean_fps: 120,124
 +
INFO:
 +
perf: perf0; timestamp: 0:56:40.979764633; bps: 2673868800,000; mean_bps: 2673868800,000; fps: 119,996; mean_fps: 120,060
 +
INFO:
 +
perf: perf0; timestamp: 0:56:41.979774896; bps: 2673868800,000; mean_bps: 2673868800,000; fps: 119,999; mean_fps: 120,039
 +
INFO:
 +
perf: perf0; timestamp: 0:56:42.979792024; bps: 2673868800,000; mean_bps: 2673868800,000; fps: 119,998; mean_fps: 120,029
 +
INFO:
 +
perf: perf0; timestamp: 0:56:43.979810601; bps: 2673868800,000; mean_bps: 2673868800,000; fps: 119,998; mean_fps: 120,023
 +
INFO:
 +
perf: perf0; timestamp: 0:56:44.979836408; bps: 2673868800,000; mean_bps: 2673868800,000; fps: 119,997; mean_fps: 120,018
 +
INFO:
 +
perf: perf0; timestamp: 0:56:45.979851268; bps: 2696151040,000; mean_bps: 2677582506,667; fps: 119,998; mean_fps: 120,016
 +
INFO:
 +
perf: perf0; timestamp: 0:56:46.979881952; bps: 2673868800,000; mean_bps: 2677051977,143; fps: 119,996; mean_fps: 120,013
 +
INFO:
 +
perf: perf0; timestamp: 0:56:47.979909813; bps: 2673868800,000; mean_bps: 2676654080,000; fps: 119,997; mean_fps: 120,011
 +
INFO:
 +
perf: perf0; timestamp: 0:56:48.979927144; bps: 2673868800,000; mean_bps: 2676344604,444; fps: 119,998; mean_fps: 120,010
 +
INFO:
 +
perf: perf0; timestamp: 0:56:49.979933060; bps: 2673868800,000; mean_bps: 2676097024,000; fps: 119,999; mean_fps: 120,009
 +
INFO:
 +
perf: perf0; timestamp: 0:56:50.979961414; bps: 2673868800,000; mean_bps: 2675894458,182; fps: 119,997; mean_fps: 120,008
 +
INFO:
 +
perf: perf0; timestamp: 0:56:51.979984914; bps: 2673868800,000; mean_bps: 2675725653,333; fps: 119,997; mean_fps: 120,007
 +
INFO:
 +
perf: perf0; timestamp: 0:56:52.980041219; bps: 2673868800,000; mean_bps: 2675582818,462; fps: 119,993; mean_fps: 120,006
 +
INFO:
 +
perf: perf0; timestamp: 0:56:53.988375122; bps: 2696151040,000; mean_bps: 2677051977,143; fps: 120,000; mean_fps: 120,006
 +
INFO:
 +
perf: perf0; timestamp: 0:56:54.996700006; bps: 2673868800,000; mean_bps: 2676839765,333; fps: 120,001; mean_fps: 120,005
 +
INFO:
 +
perf: perf0; timestamp: 0:56:55.996715395; bps: 2673868800,000; mean_bps: 2676654080,000; fps: 119,998; mean_fps: 120,005
 +
INFO:
 +
perf: perf0; timestamp: 0:56:56.996737859; bps: 2673868800,000; mean_bps: 2676490240,000; fps: 119,997; mean_fps: 120,005
 +
INFO:
 +
perf: perf0; timestamp: 0:56:57.996773699; bps: 2673868800,000; mean_bps: 2676344604,444; fps: 119,996; mean_fps: 120,004
 +
INFO:
 +
perf: perf0; timestamp: 0:56:58.996792290; bps: 2673868800,000; mean_bps: 2676214298,947; fps: 119,998; mean_fps: 120,004
 +
INFO:
 +
perf: perf0; timestamp: 0:56:59.996808788; bps: 2673868800,000; mean_bps: 2676097024,000; fps: 119,998; mean_fps: 120,004
 +
INFO:
 +
perf: perf0; timestamp: 0:57:00.996826163; bps: 2673868800,000; mean_bps: 2675990918,095; fps: 119,998; mean_fps: 120,003
 +
INFO:
 +
perf: perf0; timestamp: 0:57:01.996847486; bps: 2696151040,000; mean_bps: 2676907287,273; fps: 119,997; mean_fps: 120,003
 +
</pre>
  
'''Note2:''' To see the frame as in the email was sent before, the bit depth needs to be 9.
+
==== GStreamer Examples ====
 +
 
 +
{{Ambox
 +
|type=notice
 +
|small=left
 +
|issue='''Important:''' Since Y10 is not supported by v4l2src, GRAY16_LE is used for buffer dequeue, this causes GStreamer to take the full 2 bytes instead of just the 10 bits, which results in a darker image due to a 10bit image being interpreted as a 16bit image.
 +
|style=width:unset;
 +
}}
 +
 
 +
===== Capture and Display =====
 +
<syntaxhighlight lang=bash>
 +
gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,width=1080,height=1280,framerate=120/1,format=GRAY16_LE" ! queue ! videoconvert ! xvimagesink sync=false
 +
</syntaxhighlight>
 +
 
 +
===== Video Encoding =====
 +
<syntaxhighlight lang=bash>
 +
gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,width=1080,height=1280,framerate=120/1,format=GRAY16_LE" ! queue ! videoconvert ! queue ! omxh265enc ! h265parse ! qtmux ! filesink location=out.mp4 -e
 +
</syntaxhighlight>
  
 +
The sensor will capture in the 1080x1280@120fps mode and the pipeline will encode the video and save it into an out.mp4 file.
  
 
{{ContactUs}}
 
{{ContactUs}}
  
 
[[Category:Jetson]][[Category:Jetson V4L2 Drivers]][[Category:AMS]]
 
[[Category:Jetson]][[Category:Jetson V4L2 Drivers]][[Category:AMS]]

Latest revision as of 14:16, 17 March 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


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 is 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.6_evm_mira130_v0.1.tar

You can then apply the patch:

quilt push -a

5. 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:
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

6. 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

Capture with v4l2-ctl

  • Install v4l utils:
sudo apt install v4l-utils
  • Test the capture framerate:
v4l2-ctl -d /dev/video0 --set-fmt-video=width=1080,height=1280,pixelformat=Y10 --set-ctrl bypass_mode=0 --stream-mmap

The output should look like the following:

ams@ams-desktop:~$ v4l2-ctl -d /dev/video0 --set-fmt-video=width=1080,height=1280,pixelformat=Y10 --set-ctrl bypass_mode=0 --stream-mmap
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 120.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 120.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 120.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 120.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 120.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 120.00 fps
  • Capture a single frame:
v4l2-ctl -d /dev/video0 --set-fmt-video=width=1080,height=1280,pixelformat=Y10 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=test_frame_120fps.raw

The MIRA130 supports a resolution of 1080x1280 but the platform used (Jetson Nano) defined padding of 8 pixels to the image in order to align and optimize the capture process. The post-process applied is to open the image with a 1088x1280 resolution using Vooya o Rawpixels.

Please consider the following settings to be able to view it correctly:

  • rawpixels:

- width: 1088
- height: 1280
- Predefined format: Grayscale 8bit
- Pixel format: Grayscale
- bpp1: 16
- Little Endian box checked

  • vooya:

- width: 1088
- height: 1280
- Frames/Second: 120
- Color Space: Single Channel
- Data Container: Single Integer
- Bit Depth (Value): 14bit

Capture with GStreamer

sudo jetson_clocks

Performance statistics

gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,width=1080,height=1280,framerate=120/1,format=GRAY16_LE" ! queue ! fakesink
RAM 1233/3963MB (lfb 400x4MB) CPU [0%@1479,0%@1479,0%@1479,50%@1479]
RAM 1233/3963MB (lfb 400x4MB) CPU [1%@1479,0%@1479,0%@1479,52%@1479]
RAM 1233/3963MB (lfb 400x4MB) CPU [3%@1479,0%@1479,0%@1479,52%@1479]
RAM 1233/3963MB (lfb 400x4MB) CPU [8%@1479,1%@1479,0%@1479,51%@1479]
RAM 1233/3963MB (lfb 400x4MB) CPU [2%@1479,0%@1479,0%@1479,52%@1479]
RAM 1233/3963MB (lfb 400x4MB) CPU [1%@1479,0%@1479,0%@1479,51%@1479]
RAM 1233/3963MB (lfb 400x4MB) CPU [1%@1479,1%@1479,0%@1479,51%@1479]
RAM 1233/3963MB (lfb 400x4MB) CPU [2%@1479,2%@1479,16%@1479,37%@1479]
RAM 1233/3963MB (lfb 400x4MB) CPU [0%@1479,0%@1479,0%@1479,51%@1479]
RAM 1233/3963MB (lfb 400x4MB) CPU [0%@1479,0%@1479,45%@1479,7%@1479]
RAM 1233/3963MB (lfb 400x4MB) CPU [1%@1479,1%@1479,52%@1479,0%@1479]

Framerate

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

gst-launch-1.0 v4l2src device=/dev/video0 ! perf ! "video/x-raw,width=1080,height=1280,framerate=120/1,format=GRAY16_LE" ! fakesink
perf: perf0; timestamp: 0:56:38.972435551; bps: 0,000; mean_bps: 0,000; fps: 0,000; mean_fps: 0,000
INFO:
perf: perf0; timestamp: 0:56:39.979731288; bps: 2540175360,000; mean_bps: 0,000; fps: 120,124; mean_fps: 120,124
INFO:
perf: perf0; timestamp: 0:56:40.979764633; bps: 2673868800,000; mean_bps: 2673868800,000; fps: 119,996; mean_fps: 120,060
INFO:
perf: perf0; timestamp: 0:56:41.979774896; bps: 2673868800,000; mean_bps: 2673868800,000; fps: 119,999; mean_fps: 120,039
INFO:
perf: perf0; timestamp: 0:56:42.979792024; bps: 2673868800,000; mean_bps: 2673868800,000; fps: 119,998; mean_fps: 120,029
INFO:
perf: perf0; timestamp: 0:56:43.979810601; bps: 2673868800,000; mean_bps: 2673868800,000; fps: 119,998; mean_fps: 120,023
INFO:
perf: perf0; timestamp: 0:56:44.979836408; bps: 2673868800,000; mean_bps: 2673868800,000; fps: 119,997; mean_fps: 120,018
INFO:
perf: perf0; timestamp: 0:56:45.979851268; bps: 2696151040,000; mean_bps: 2677582506,667; fps: 119,998; mean_fps: 120,016
INFO:
perf: perf0; timestamp: 0:56:46.979881952; bps: 2673868800,000; mean_bps: 2677051977,143; fps: 119,996; mean_fps: 120,013
INFO:
perf: perf0; timestamp: 0:56:47.979909813; bps: 2673868800,000; mean_bps: 2676654080,000; fps: 119,997; mean_fps: 120,011
INFO:
perf: perf0; timestamp: 0:56:48.979927144; bps: 2673868800,000; mean_bps: 2676344604,444; fps: 119,998; mean_fps: 120,010
INFO:
perf: perf0; timestamp: 0:56:49.979933060; bps: 2673868800,000; mean_bps: 2676097024,000; fps: 119,999; mean_fps: 120,009
INFO:
perf: perf0; timestamp: 0:56:50.979961414; bps: 2673868800,000; mean_bps: 2675894458,182; fps: 119,997; mean_fps: 120,008
INFO:
perf: perf0; timestamp: 0:56:51.979984914; bps: 2673868800,000; mean_bps: 2675725653,333; fps: 119,997; mean_fps: 120,007
INFO:
perf: perf0; timestamp: 0:56:52.980041219; bps: 2673868800,000; mean_bps: 2675582818,462; fps: 119,993; mean_fps: 120,006
INFO:
perf: perf0; timestamp: 0:56:53.988375122; bps: 2696151040,000; mean_bps: 2677051977,143; fps: 120,000; mean_fps: 120,006
INFO:
perf: perf0; timestamp: 0:56:54.996700006; bps: 2673868800,000; mean_bps: 2676839765,333; fps: 120,001; mean_fps: 120,005
INFO:
perf: perf0; timestamp: 0:56:55.996715395; bps: 2673868800,000; mean_bps: 2676654080,000; fps: 119,998; mean_fps: 120,005
INFO:
perf: perf0; timestamp: 0:56:56.996737859; bps: 2673868800,000; mean_bps: 2676490240,000; fps: 119,997; mean_fps: 120,005
INFO:
perf: perf0; timestamp: 0:56:57.996773699; bps: 2673868800,000; mean_bps: 2676344604,444; fps: 119,996; mean_fps: 120,004
INFO:
perf: perf0; timestamp: 0:56:58.996792290; bps: 2673868800,000; mean_bps: 2676214298,947; fps: 119,998; mean_fps: 120,004
INFO:
perf: perf0; timestamp: 0:56:59.996808788; bps: 2673868800,000; mean_bps: 2676097024,000; fps: 119,998; mean_fps: 120,004
INFO:
perf: perf0; timestamp: 0:57:00.996826163; bps: 2673868800,000; mean_bps: 2675990918,095; fps: 119,998; mean_fps: 120,003
INFO:
perf: perf0; timestamp: 0:57:01.996847486; bps: 2696151040,000; mean_bps: 2676907287,273; fps: 119,997; mean_fps: 120,003

GStreamer Examples

Capture and Display
gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,width=1080,height=1280,framerate=120/1,format=GRAY16_LE" ! queue ! videoconvert ! xvimagesink sync=false
Video Encoding
gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,width=1080,height=1280,framerate=120/1,format=GRAY16_LE" ! queue ! videoconvert ! queue ! omxh265enc ! h265parse ! qtmux ! filesink location=out.mp4 -e

The sensor will capture in the 1080x1280@120fps mode and the pipeline will encode the video and save it into an out.mp4 file.


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