Difference between revisions of "Raspberry Pi HQ camera IMX477 Linux driver for Jetson"

From RidgeRun Developer Connection
Jump to: navigation, search
m
m
 
(42 intermediate revisions by 7 users not shown)
Line 1: Line 1:
<seo title="Raspberry Pi HQ camera IMX477 Driver | Linux driver for Jetson | RidgeRun" titlemode="replace" keywords=" GStreamer, IMX477, Raspberry Pi HQ camera IMX477, IMX477 Linux driver, Jetson IMX477 driver, Jetson IMX477 Linux driver, IMX477 Linux driver for Jetson, Raspberry Pi HQ camera, Raspberry Pi HQ camera IMX477, RidgeRun, Sony IMX477, Sony IMX477 sensor, Jetson Xavier NX, Xavier NX, NVIDIA, Jetson, TX2, Jetson TX2, NVIDIA Jetson, Raspberry Pi" description="Read RidgeRun’s detailed guide about the Raspberry Pi HQ camera Sony IMX477 Linux driver for Jetson."></seo>
+
<seo title="Raspberry Pi HQ camera IMX477 Driver | Linux driver for Jetson | RidgeRun" titlemode="replace" metakeywords="GStreamer, IMX477, Raspberry Pi HQ camera IMX477, IMX477 Linux driver, Jetson IMX477 driver, Jetson IMX477 Linux driver, IMX477 Linux driver for Jetson, Raspberry Pi HQ camera, Raspberry Pi HQ camera IMX477, RidgeRun, Sony IMX477, Sony IMX477 sensor, Jetson Xavier NX, Xavier NX, NVIDIA, Jetson, TX1, Jetson TX2, NVIDIA Jetson, NVIDIA Jetson Orin, Jetson Orin, Orin, NVIDIA Orin, NVIDIA Jetson AGX Orin, Jetson AGX Orin, Jetson AGX Xavier, Xavier, Jetson Xavier, NVIDIA Jetson Xavier, Orin Nano, Jetson Orin Nano, NVIDIA Jetson Orin Nano, Raspberry Pi" metadescription="Read RidgeRun’s detailed guide about the Raspberry Pi HQ camera Sony IMX477 Linux driver for Jetson."></seo>
  
 
<table>
 
<table>
 
<tr>
 
<tr>
 
<td><div class="clear; float:right">__TOC__</div></td>
 
<td><div class="clear; float:right">__TOC__</div></td>
 +
<td>
 +
{{Shopping_cart_mpo}}
 +
<td>
 +
{{NVIDIA Preferred Partner logo}}
 +
<td>
 
<td>
 
<td>
 
{{GStreamer debug}}
 
{{GStreamer debug}}
Line 13: Line 18:
 
</table>
 
</table>
  
==Introduction to Raspberry Pi HQ camera Sony IMX477 Linux driver==
+
==Introduction to Sony IMX477 Linux driver==
 +
 
 +
[https://www.ridgerun.com/ RidgeRun] is actively working to enable customers with great software solutions on top of powerful hardware. For this reason, RidgeRun is currently working to create the V4L2 driver for the Raspberry Pi HQ camera. This wiki contains a brief introduction to the sensor and hardware that will be used to develop the driver.
  
[https://www.ridgerun.com/ RidgeRun] is actively working to enable customers with great software solutions on top of powerful hardware. For this reason, RidgeRun is currently working to create the V4L2 driver for the Raspberry Pi HQ camera. This wiki contains a brief introduction to the sensor and hardware that will be used to develop the driver. Please keep in mind that the driver can be ported to other Jetson platforms if needed. Please [https://www.ridgerun.com/contact contact us] if you require more information.
+
The instructions in this wiki are useful for Jetson Xavier NX and Jetson Nano, keep in mind that for Jetson Orin with a J20 adapter, you can follow the following instructions [[NVIDIA_Jetson_Orin/Video_Capture_and_Display/Cameras/IMX477_J20 | here]]. Also please keep in mind that the driver can be ported to other Jetson platforms if needed. Please [https://www.ridgerun.com/contact contact us] if you require more information.
  
 
==Raspberry Pi HQ camera==
 
==Raspberry Pi HQ camera==
Line 33: Line 40:
 
===Sony IMX477 Basic Drive Mode===
 
===Sony IMX477 Basic Drive Mode===
  
The Raspberry Pi HQ camera uses the IMX477 CMOS sensor of Sony to capture. Such a sensor provides the modes included in the table below. At this point RidgeRun is working to support one mode only but others can be added per request.
+
The Raspberry Pi HQ camera uses the IMX477 CMOS sensor of Sony to capture. Such a sensor provides the modes included in the table below. At this point, RidgeRun is working to support one mode only but others can be added per request.
  
 
{| class="wikitable" style="margin-left: auto; margin-right: auto; border: none;
 
{| class="wikitable" style="margin-left: auto; margin-right: auto; border: none;
Line 65: Line 72:
  
 
The Raspberry Pi HQ camera module requires a hardware modification in order to work with Jetson Platforms.
 
The Raspberry Pi HQ camera module requires a hardware modification in order to work with Jetson Platforms.
Both Jetson Nano and Jetson Xavier NX provides 1.8V for reset GPIO in the camera interface, but the camera module requires 3.3V.
+
Jetson Platforms provide 1.8V for reset GPIO in the camera interface, but the camera module requires 3.3V.
  
 
To fix this issue a resistor labeled as R8 must be removed from the camera module. If you decide to apply this fix it is under your own risk. RidgeRun is not responsible for any damage caused to your board. The following picture shows the location of the R8 in the module.
 
To fix this issue a resistor labeled as R8 must be removed from the camera module. If you decide to apply this fix it is under your own risk. RidgeRun is not responsible for any damage caused to your board. The following picture shows the location of the R8 in the module.
Line 73: Line 80:
 
<div style="text-align: center;">'''Figure 1'''. R8 resistor on RPi HQ camera module.</div>
 
<div style="text-align: center;">'''Figure 1'''. R8 resistor on RPi HQ camera module.</div>
  
==Raspberry Pi HQ camera IMX477 Linux driver for NVIDIA<sup>®</sup>Jetson Xavier™ NX==
+
==IMX477 Linux driver for NVIDIA<sup>®</sup>Jetson™==
  
 
RidgeRun Engineering has developed the driver with NVIDIA Corporation and Leopard Imaging Inc. as a collaborative initiative.
 
RidgeRun Engineering has developed the driver with NVIDIA Corporation and Leopard Imaging Inc. as a collaborative initiative.
In this section, you will find the instructions to patch the JetPack sources enabling the IMX477 sensor driver for the Jetson Xavier NX. These  instructions have been validated in the following Jetpack versions:
+
In this section, you will find the instructions to patch the JetPack sources enabling the IMX477 sensor driver for the Jetson Xavier NX and Nano. These  instructions have been validated in the following JetPack versions:
 
* Jetpack 4.4
 
* Jetpack 4.4
 
* Jetpack 4.4.1
 
* Jetpack 4.4.1
 
* Jetpack 4.5
 
* Jetpack 4.5
 +
 +
For '''Jetson Orin,''' a port for JetPack 5.0.1 was made, you can find all the information [[NVIDIA_Jetson_Orin/Video_Capture_and_Display/Cameras/IMX477_J20 | here]]
  
 
===Download JetPack===
 
===Download JetPack===
  
The current version of the driver is supported in Jetpack 4.4, 4.4.1 and 4.5. Porting the driver to other versions and platforms is possible.
+
The current version of the driver is supported in Jetpack 4.4, 4.4.1, and 4.5. Porting the driver to other versions and platforms is possible.
 +
 
 +
A port for is available for the '''Jetson Orin''' with J20 adapter in [[NVIDIA_Jetson_Orin/Video_Capture_and_Display/Cameras/IMX477_J20 | here]]
  
 
1. Download and install the [https://developer.nvidia.com/nvidia-sdk-manager NVIDIA SDK Manager] (membership is required).
 
1. Download and install the [https://developer.nvidia.com/nvidia-sdk-manager NVIDIA SDK Manager] (membership is required).
Line 131: Line 142:
 
# Remove the jumper from the Force Recovery Mode pins.
 
# Remove the jumper from the Force Recovery Mode pins.
  
<br>
 
 
{{Ambox
 
{{Ambox
 
|type=notice
 
|type=notice
Line 147: Line 157:
 
<div style="text-align: center;">'''Figure 7'''. Required username and password for your profile in the board.</div>
 
<div style="text-align: center;">'''Figure 7'''. Required username and password for your profile in the board.</div>
  
7. Don't close the window of Figure 7 and don't modify its content yet. Yo need to connect a screen to the board via HDMI, a keyboard/mouse via USB port, and a network cable via Ethernet port. You can remove the jumper that keeps the board in ''Recovery Mode'' and then reboot the Xavier board at this point if necessary.
+
7. Don't close the window of Figure 7 and don't modify its content yet. You need to connect a screen to the board via HDMI, a keyboard/mouse via USB port, and a network cable via Ethernet port. You can remove the jumper that keeps the board in ''Recovery Mode'' and then reboot the Xavier board at this point if necessary.
  
 
8. After reboot, you will be asked to accept the terms of the license' on the board's screen. Select the checkbox and press ''Continue''.
 
8. After reboot, you will be asked to accept the terms of the license' on the board's screen. Select the checkbox and press ''Continue''.
Line 175: Line 185:
 
14. Now you are able to access Ubuntu as a new user in the [Xavier NX | Nano]. You can find the board IP by using <code>ifconfig</code> from a terminal.
 
14. Now you are able to access Ubuntu as a new user in the [Xavier NX | Nano]. You can find the board IP by using <code>ifconfig</code> from a terminal.
  
15. Get back to the window presented in Figure 7 (in your host PC) and enter the IP, username, and password which the [Xavier NX | Nano] has been configured with. Then press ''Install''.
+
15. Get back to the window presented in Figure 7 (in your host PC) and enter the IP, username, and password that the [Xavier NX | Nano] has been configured with. Then press ''Install''.
  
 
[[Image:preinstallNX.png|thumb|center|650px]]  
 
[[Image:preinstallNX.png|thumb|center|650px]]  
Line 190: Line 200:
 
|small=left
 
|small=left
 
|issue='''IMPORTANT:'''
 
|issue='''IMPORTANT:'''
*From now on we will refer as <code>$JETPACK_DIR/</code> to the directory where the SDK Manager placed the <code>JetPack_4.4_Linux_JETSON_[PLATFORM]_DEVKIT</code> / <code>JetPack_4.4.1_Linux_JETSON_[PLATFORM]_DEVKIT</code> / <code>JetPack_4.5_Linux_JETSON_[PLATFORM]_DEVKIT</code> folder.<br>
+
*From now on we will refer as <code>$JETPACK_DIR/</code> to the directory where the SDK Manager placed the <code>JetPack_4.4_Linux_JETSON_[PLATFORM]_DEVKIT</code> / <code>JetPack_4.4.1_Linux_JETSON_[PLATFORM]_DEVKIT</code> / <code>JetPack_4.5_Linux_JETSON_[PLATFORM]_DEVKIT</code>folder.<br>
Where <code>[PLATFORM]</code> must be replaced by <code>XAVIER_NX</code> or <code>NANO</code>. This directory is usually <code>$HOME/nvidia/nvidia_sdk<code>.
+
      Where <code>[PLATFORM]</code> must be replaced by <code>XAVIER_NX</code> or <code>NANO</code>. This directory is usually <code>$HOME/nvidia/nvidia_sdk.<code>
 
|style=width:unset;
 
|style=width:unset;
 
}}
 
}}
Line 205: Line 215:
  
 
[https://drive.google.com/drive/folders/1E1bE57VlXqadLGg8sSw8KwW7AJRWjbmG?usp=sharing Kernel Debian Packages]
 
[https://drive.google.com/drive/folders/1E1bE57VlXqadLGg8sSw8KwW7AJRWjbmG?usp=sharing Kernel Debian Packages]
 +
 +
<br>
 +
{{Ambox
 +
|type=notice
 +
|small=left
 +
|issue='''Debian files for Jetpack 4.4.1 and 4.5:'''
 +
For Jetpack 4.4.1 and 4.5 the IMX477 module already comes built-in with the default kernel Image provided by NVIDIA. Only the dtb needs to be changed to enable the IMX477, for this reason, we provide only the dtb Debian packages for Jetpack 4.4.1 and 4.5.
 +
|style=width:unset;
 +
}}
 +
<br>
  
 
===Installing the debian packages===
 
===Installing the debian packages===
Line 210: Line 230:
 
====Jetson Xavier NX====
 
====Jetson Xavier NX====
  
* Copy the kernel and dtb debian packages to your board filesystem:
+
* Copy the kernel and dtb Debian packages to your board filesystem:
  
 
<pre>
 
<pre>
Line 288: Line 308:
  
 
* After these steps, the driver should be working and you can run some capture tests described below.
 
* After these steps, the driver should be working and you can run some capture tests described below.
* '''IMPORTANT''': You may see some washed-out colors in the captured image. This is because you haven't applied the ISP configuration file. Make sure to install the ISP file that you can find in the repo using [https://developer.ridgerun.com/wiki/index.php?title=Raspberry_Pi_HQ_camera_IMX477_Linux_driver_for_Jetson#ISP_camera_overrides_installation these instructions].
+
* '''IMPORTANT''': You may see some washed-out colors in the captured image. This is because you haven't applied the ISP configuration file. Make sure to install the ISP file that you can find in the repo using [[Raspberry_Pi_HQ_camera_IMX477_Linux_driver_for_Jetson#ISP_camera_overrides_installation | these instructions]].
  
 
== Installing the Driver - Option B: JetPack sources patch==
 
== Installing the Driver - Option B: JetPack sources patch==
Line 294: Line 314:
 
===Download the JetPack sources===
 
===Download the JetPack sources===
  
The sources can be downloaded from the NVIDIA's Download Center:
+
The sources can be downloaded from NVIDIA's Download Center:
  
 
Jetpack 4.4
 
Jetpack 4.4
Line 325: Line 345:
 
Where <code>[PLATFORM]</code> must be replaced by <code>XAVIER_NX</code> or <code>NANO</code>, and <code>[JETPACK_VERSION]</code> must be replaced by <code>4.4</code>, <code>4.4.1</code> or <code>4.5</code>.
 
Where <code>[PLATFORM]</code> must be replaced by <code>XAVIER_NX</code> or <code>NANO</code>, and <code>[JETPACK_VERSION]</code> must be replaced by <code>4.4</code>, <code>4.4.1</code> or <code>4.5</code>.
  
=== Patch instructions ===
+
===Patch instructions===
  
 
====Download the patches====
 
====Download the patches====
Line 337: Line 357:
 
Older versions can be found in '''jetpack-4.4''' and '''jetpack-4.4.1''' branches in the repository. You just have to switch to the jetpack version branch you want to use.
 
Older versions can be found in '''jetpack-4.4''' and '''jetpack-4.4.1''' branches in the repository. You just have to switch to the jetpack version branch you want to use.
  
Once you have downloaded the repository, move the files to the <code>$JETSON_KERNEL_SOURCE</code> directory:
+
Once you have downloaded the repository, move the files to the <code>$JETSON_KERNEL_SOURCE</code> directory (create the patches directory inside JETSON_KERNEL_SOURCE if necessary):
  
 
<pre>
 
<pre>
 
KERNEL_PATCH=$(pwd)/NVIDIA-Jetson-IMX477-RPIV3/
 
KERNEL_PATCH=$(pwd)/NVIDIA-Jetson-IMX477-RPIV3/
cp -r $KERNEL_PATCH/patches_[PLATFORM]/ $JETSON_KERNEL_SOURCE/patches/
+
mv -v $KERNEL_PATCH/patches_[PLATFORM]/* $JETSON_KERNEL_SOURCE/patches/
 
</pre>
 
</pre>
 
Where <code>[PLATFORM]</code> must be replaced by <code>nx</code> or <code>nano</code>.
 
Where <code>[PLATFORM]</code> must be replaced by <code>nx</code> or <code>nano</code>.
Line 347: Line 367:
 
====Apply the patches====
 
====Apply the patches====
 
<pre>
 
<pre>
cd $JETSON_KERNEL_SOURCE
+
cd $JETSON_KERNEL_SOURCE/patches
 
quilt push
 
quilt push
 
</pre>
 
</pre>
Line 408: Line 428:
 
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''.
 
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 kernel, device tree and modules:
+
* Compile kernel, device tree, and modules:
  
 
<pre>
 
<pre>
Line 418: Line 438:
  
 
===Flash the Jetson===
 
===Flash the Jetson===
 +
 
====Flash the Xavier NX====
 
====Flash the Xavier NX====
  
Line 446: Line 467:
  
 
====Flash the Nano====
 
====Flash the Nano====
 
 
<br>
 
<br>
 
{{Ambox
 
{{Ambox
Line 458: Line 478:
 
}}
 
}}
 
<br>
 
<br>
 
 
* Make sure your extlinux.conf file at '''/boot/extlinux/extlinux.conf''' in your Nano's filesystem looks as follows by adding the FDT line (remember to change the <dtb> depending on your board).
 
* Make sure your extlinux.conf file at '''/boot/extlinux/extlinux.conf''' in your Nano's filesystem looks as follows by adding the FDT line (remember to change the <dtb> depending on your board).
  
Line 492: Line 511:
 
===Copy the kernel modules===
 
===Copy the kernel modules===
  
* You can just access your SD card in your PC and copy the '''KERNEL_MODULES=$JETPACK_DIR/JetPack_[JETPACK_VERSION]_Linux_JETSON_[PLATFORM]_DEVKIT/Linux_for_Tegra/modules/lib/modules/4.9.140/*''' directory content into '''/lib/modules/4.9.140/''' in your SD card to update the modules. Where <code>[PLATFORM]</code> must be replaced by <code>XAVIER_NX</code> or <code>NANO</code>, and <code>[JETPACK_VERSION]</code> must be replaced by <code>4.4</code>, <code>4.4.1</code> or <code>4.5</code>.
+
* You can just access your SD card in your PC and copy the '''KERNEL_MODULES=$JETPACK_DIR/JetPack_[JETPACK_VERSION]_Linux_JETSON_[PLATFORM]_DEVKIT/Linux_for_Tegra/modules/lib/modules/4.9.201/*''' directory content into '''/lib/modules/4.9.201/''' in your SD card to update the modules. Where <code>[PLATFORM]</code> must be replaced by <code>XAVIER_NX</code> or <code>NANO</code>, and <code>[JETPACK_VERSION]</code> must be replaced by <code>4.4</code>, <code>4.4.1</code> or <code>4.5</code>.
  
 
* Or you can update with your compiled modules  If your board is up you can update the kernel modules as follows:
 
* Or you can update with your compiled modules  If your board is up you can update the kernel modules as follows:
Line 500: Line 519:
 
cd $KERNEL_MODULES
 
cd $KERNEL_MODULES
 
# use rsync instead of scp to avoid symlink recursion problems
 
# use rsync instead of scp to avoid symlink recursion problems
rsync --progress -avhe ssh ../4.9.140 <nvidia-nx-user>@<nvidia-nx-ip>:/tmp/
+
rsync --progress -avhe ssh ../4.9.201 <nvidia-nx-user>@<nvidia-nx-ip>:/tmp/
 
</pre>
 
</pre>
  
 
Where <code>[PLATFORM]</code> must be replaced by <code>XAVIER_NX</code> or <code>NANO</code>, and <code>[JETPACK_VERSION]</code> must be replaced by <code>4.4</code>, <code>4.4.1</code> or <code>4.5</code>.
 
Where <code>[PLATFORM]</code> must be replaced by <code>XAVIER_NX</code> or <code>NANO</code>, and <code>[JETPACK_VERSION]</code> must be replaced by <code>4.4</code>, <code>4.4.1</code> or <code>4.5</code>.
 +
  
 
* Move the modules from <code>/tmp</code> to the <code>/lib/modules/</code> folder inside the Jetson's filesystem and reboot:
 
* Move the modules from <code>/tmp</code> to the <code>/lib/modules/</code> folder inside the Jetson's filesystem and reboot:
  
 
<pre>
 
<pre>
sudo mv /tmp/4.9.140/ /lib/modules/
+
sudo mv /tmp/4.9.201/ /lib/modules/
 
sudo reboot
 
sudo reboot
 
</pre>
 
</pre>
  
 +
* If you find that the directory name is '''/lib/modules/4.9.201-tegra/''', change the directory name to '''/lib/modules/4.9.201/'''
 
* After these steps, the driver should be working and you can run some capture tests described below.
 
* After these steps, the driver should be working and you can run some capture tests described below.
* '''IMPORTANT''': You may see some washed-out colors in the captured image. This is because you haven't applied the ISP configuration file. Make sure to install the ISP file that you can find in the repo using [https://developer.ridgerun.com/wiki/index.php?title=Raspberry_Pi_HQ_camera_IMX477_Linux_driver_for_Jetson#ISP_camera_overrides_installation these instructions].
+
* '''IMPORTANT''': You may see some washed-out colors in the captured image. This is because you haven't applied the ISP configuration file. Make sure to install the ISP file that you can find in the repo using [[Raspberry_Pi_HQ_camera_IMX477_Linux_driver_for_Jetson#ISP_camera_overrides_installation | these instructions]].
  
 
==ISP camera overrides installation==
 
==ISP camera overrides installation==
  
Please, visit the [https://developer.ridgerun.com/wiki/index.php?title=JetsonTX2/HowTo%27s/NVIDIA_Jetson_ISP_Control#Custom_ISP_Configuration Custom ISP Configuration page] in order to learn how to use the <code>camera_overrides.isp</code> file to configure the ISP.
+
Please, visit the [[JetsonTX2/HowTo%27s/NVIDIA_Jetson_ISP_Control#Custom_ISP_Configuration | Custom ISP Configuration page]] in order to learn how to use the <code>camera_overrides.isp</code> file to configure the ISP.
  
 
==Supported Features==
 
==Supported Features==
Line 527: Line 548:
  
 
===Controls===
 
===Controls===
 +
 
* Gain
 
* Gain
 
* Exposure
 
* Exposure
Line 591: Line 613:
 
{{ContactUs}}
 
{{ContactUs}}
  
[Category:GStreamer]][[Category:Jetson]][[Category:JetsonNano]][[Category:JetsonTX2]][[Category:NVIDIA Xavier]][[Category:Jetson V4L2 Drivers]][[Category:Sony]]
+
[[Category:GStreamer]][[Category:Jetson]][[Category:JetsonNano]][[Category:JetsonTX2]][[Category:NVIDIA Xavier]][[Category:JetsonXavierNX]][[Category:Sony]][[Category:Jetson V4L2 Drivers]][[Category:NVIDIA Jetson Orin]][[Category:NVIDIA Jetson Orin Nano]]

Latest revision as of 11:26, 4 June 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

Introduction to Sony IMX477 Linux driver

RidgeRun is actively working to enable customers with great software solutions on top of powerful hardware. For this reason, RidgeRun is currently working to create the V4L2 driver for the Raspberry Pi HQ camera. This wiki contains a brief introduction to the sensor and hardware that will be used to develop the driver.

The instructions in this wiki are useful for Jetson Xavier NX and Jetson Nano, keep in mind that for Jetson Orin with a J20 adapter, you can follow the following instructions here. Also please keep in mind that the driver can be ported to other Jetson platforms if needed. Please contact us if you require more information.

Raspberry Pi HQ camera


Rpi-hq-imx477.png

Camera Features

  • 12.3-Megapixel high-resolution Sony IMX477 sensor.
  • 1.55μm × 1.55μm Pixel Size – double the pixel area of IMX219 for improved low-light performance.
  • Back-illuminated sensor architecture for improved sensitivity.
  • Support for different C- and CS-mount lenses.
  • Integrated back-focus adjustment ring and tripod mount.
Rpi-hq-imx477-sensor.jpg

Sony IMX477 Basic Drive Mode

The Raspberry Pi HQ camera uses the IMX477 CMOS sensor of Sony to capture. Such a sensor provides the modes included in the table below. At this point, RidgeRun is working to support one mode only but others can be added per request.

Drive Mode Number of active pixels Maximum frame rate
[frame/s]
Output Interface ADC
[bit]
Full (4:3) (Normal) 4056 x 3040
approx. 12.33 M pixels
60 CSI-2 10
40 CSI-2 12
Full (4:3) (DOL-HDR) 4056 x 3040
approx. 12.33 M pixels
DOL 2 frame:30
DOL 3 frame:15
CSI-2 10
Full (16:9) 4K2K (Normal) 4056 x 2288
approx. 9.28 M pixels
79 CSI-2 10
Full (16:9) 4K2K (DOL-HDR) 4056 x 2288
approx. 9.28 M pixels
DOL 2 frame:39
DOL 3 frame:19
CSI-2 10
Full (4:3) Binning (Normal) 2028 x 1520
approx. 3.08 M pixels
179 CSI-2 10
Full (16:9) Binning 1080P (Normal) 2028 x 1128
approx. 2.29 M pixels
240 CSI-2 10
Full (16:9) Binning 720P (Normal) 1348 x 750
approx. 1.01 M pixels
240 CSI-2 10
Full (16:9) Scaling 1080P (Normal) 2024 x 1142
approx. 2.31 M pixels
79 CSI-2 10
Full (16:9) Scalling 720P (Normal) 1348 x 762
approx. 1.03 M pixels
79 CSI-2 10

Compatibility with NVIDIA®Jetson™ Platforms

The Raspberry Pi HQ camera module requires a hardware modification in order to work with Jetson Platforms. Jetson Platforms provide 1.8V for reset GPIO in the camera interface, but the camera module requires 3.3V.

To fix this issue a resistor labeled as R8 must be removed from the camera module. If you decide to apply this fix it is under your own risk. RidgeRun is not responsible for any damage caused to your board. The following picture shows the location of the R8 in the module.

R8ToBeRemoved.png
Figure 1. R8 resistor on RPi HQ camera module.

IMX477 Linux driver for NVIDIA®Jetson™

RidgeRun Engineering has developed the driver with NVIDIA Corporation and Leopard Imaging Inc. as a collaborative initiative. In this section, you will find the instructions to patch the JetPack sources enabling the IMX477 sensor driver for the Jetson Xavier NX and Nano. These instructions have been validated in the following JetPack versions:

  • Jetpack 4.4
  • Jetpack 4.4.1
  • Jetpack 4.5

For Jetson Orin, a port for JetPack 5.0.1 was made, you can find all the information here

Download JetPack

The current version of the driver is supported in Jetpack 4.4, 4.4.1, and 4.5. Porting the driver to other versions and platforms is possible.

A port for is available for the Jetson Orin with J20 adapter in here

1. Download and install the NVIDIA SDK Manager (membership is required).

2. Put your NVIDIA membership credentials in the SDK Manager main window:

SDKMCredentials.png
Figure 2. Required SDK Manager credentials.

3. Select JetPack version and Jetson [Xavier NX | Nano] as shown below and press Continue:

SDKMOptions2.png
Figure 3. Required SDK Manager options.

4. Accept the terms and conditions and press Continue. The SDK Manager will download and install the selected components:

SDKMInstall.png
Figure 4. SDK Manager download and install software.

5. Select Manual Setup. Make sure the board is in Recovery Mode and then press Flash:

ManualOption.png
Figure 5. Manual setup to start the flashing process.

Recovery Mode for Jetson NX

  1. Ensure the device is powered off and the power adapter is disconnected.
  2. Verify that a microSD card is inserted in the Jetson Xavier NX module's card slot.
  3. Place a jumper across the Force Recovery Mode pins (9 and 10) on the button header [J14]. Please, see Figure 6 below.
  4. Connect your host computer to the developer kit's USB Micro-B connector.
  5. Connect the power supply to the power jack [J16]. The developer kit automatically powers on in Force Recovery Mode.
  6. Remove the jumper from the Force Recovery Mode pins.
  7. Use the lsusb command to check if the NVidia corp message is shown.


RecmodeNX.png
Figure 6. Jumper between pins 9 and 10 to get the board on Recovery Mode (top view).

Recovery Mode for Jetson Nano

  • To set the Jetson Nano in Recovery Mode, follow these steps:
  1. Ensure the device is powered off and the power adapter is disconnected.
  2. Verify that a microSD card is inserted in the Jetson Nano SD card slot.
  3. Place a jumper across the Force Recovery pins.
  4. Enable the use of the Power Jack [J15] by placing a jumper across the Power Select Header [J48] pins.
  5. Connect your host computer to the device's Micro USB connector.
  6. Connect the power supply to the power jack [J25]. The developer kit automatically powers on in Force Recovery Mode.
  7. Remove the jumper from the Force Recovery Mode pins.


6. When the OS has been installed successfully in the [Xavier NX | Nano], you will be asked to enter the board IP, a username and a password, as shown below in Figure7:

OSIPOption.png
Figure 7. Required username and password for your profile in the board.

7. Don't close the window of Figure 7 and don't modify its content yet. You need to connect a screen to the board via HDMI, a keyboard/mouse via USB port, and a network cable via Ethernet port. You can remove the jumper that keeps the board in Recovery Mode and then reboot the Xavier board at this point if necessary.

8. After reboot, you will be asked to accept the terms of the license' on the board's screen. Select the checkbox and press Continue.

9. Select your language in the next screen and press Continue:

Error creating thumbnail: Unable to save thumbnail to destination
Figure 8. Language selection.

10. Select your keyboard layout and press Continue:

KeyboardNX.png
Figure 9. Keyboard layout selection.

11. Select your location and press Continue:

LocationNX.png
Figure 10. Location selection.

12. Enter a username and a password. Then, press Continue:

UsernameNX.png
Figure 11. User credentials for Ubuntu.

13. Wait for the system to apply the changes. The board will restart automatically.

14. Now you are able to access Ubuntu as a new user in the [Xavier NX | Nano]. You can find the board IP by using ifconfig from a terminal.

15. Get back to the window presented in Figure 7 (in your host PC) and enter the IP, username, and password that the [Xavier NX | Nano] has been configured with. Then press Install.

PreinstallNX.png
Figure 12. User credentials to start the software installation process.

16. The software installation process should finish successfully, as shown in Figure 13:

FinishNX.png
Figure 13. Finishing software install.



Installing the Driver - Option A: Debian Packages (Recommended)

This is the simplest way to install the IMX477 driver on Jetson platforms.

Downloading the debian packages

You can download the Debian packages according to your platform from the following link:

Kernel Debian Packages



Installing the debian packages

Jetson Xavier NX

  • Copy the kernel and dtb Debian packages to your board filesystem:
scp debian_nx/nvidia-l4t-kernel_4.9.140-tegra-32.4.3-20200625213407_arm64.deb [jetson-username]@[jetson-ip]:/home/nvidia/
scp debian_nx/nvidia-l4t-kernel-dtbs_4.9.140-tegra-32.4.3-20200625213407_arm64.deb [jetson-username]@[jetson-ip]:/home/nvidia/
  • Install the debian packages in your board:
sudo apt-get install --reinstall ./nvidia-l4t-kernel_4.9.140-tegra-32.4.3-20200625213407_arm64.deb
sudo apt-get install --reinstall ./nvidia-l4t-kernel-dtbs_4.9.140-tegra-32.4.3-20200625213407_arm64.deb
  • Enable the dtb changes by modifying the /boot/extlinux/extlinux.conf file:
 TIMEOUT 30
 DEFAULT primary

 MENU TITLE L4T boot options

 LABEL primary
       MENU LABEL primary kernel
       LINUX /boot/Image
       INITRD /boot/initrd
       APPEND ${cbootargs} quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyTCU0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 
       FDT /boot/tegra194-p3668-all-p3509-0000.dtb
  • Reboot your board:
sudo reboot

Jetson Nano

  • Copy the kernel and dtb debian packages to your board filesystem:
scp debian_nano/nvidia-l4t-kernel_4.9.140-tegra-32.4.3-20200625213809_arm64.deb [jetson-username]@[jetson-ip]:/home/nvidia/
scp debian_nano/nvidia-l4t-kernel-dtbs_4.9.140-tegra-32.4.3-20200625213809_arm64.deb [jetson-username]@[jetson-ip]:/home/nvidia/
  • Install the debian packages in your board:
sudo apt-get install --reinstall ./nvidia-l4t-kernel_4.9.140-tegra-32.4.3-20200625213809_arm64.deb
sudo apt-get install --reinstall ./nvidia-l4t-kernel-dtbs_4.9.140-tegra-32.4.3-20200625213809_arm64.deb
  • Enable the dtb changes by modifying the /boot/extlinux/extlinux.conf file:



 TIMEOUT 30
 DEFAULT primary
 MENU TITLE L4T boot options
 LABEL primary
       MENU LABEL primary kernel
       LINUX /boot/Image
       INITRD /boot/initrd
       APPEND ${cbootargs} quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0
       FDT <dtb path>
  • Reboot your board:
sudo reboot
  • After these steps, the driver should be working and you can run some capture tests described below.
  • IMPORTANT: You may see some washed-out colors in the captured image. This is because you haven't applied the ISP configuration file. Make sure to install the ISP file that you can find in the repo using these instructions.

Installing the Driver - Option B: JetPack sources patch

Download the JetPack sources

The sources can be downloaded from NVIDIA's Download Center:

Jetpack 4.4

Jetpack 4.4.1

Jetpack 4.5

1. You must be able to download a file called public_sources.tbz2.

2. Untar the sources

tar -xvf public_sources.tbz2

3. Let's unpack the kernel_src.tbz2 and move the hardware/ and kernel/ folders into Linux_for_Tegra/ inside the JetPack directory $JETPACK_DIR/JetPack_[JETPACK_VERSION]_Linux_JETSON_[PLATFORM]_DEVKIT/:

cd Linux_for_Tegra/source/public/
tar -xvf kernel_src.tbz2
JETSON_KERNEL_SOURCE=$JETPACK_DIR/JetPack_[JETPACK_VERSION]_Linux_JETSON_[PLATFORM]_DEVKIT/Linux_for_Tegra/source/
mkdir -p $JETSON_KERNEL_SOURCE
mv hardware/ kernel/ $JETSON_KERNEL_SOURCE

Where [PLATFORM] must be replaced by XAVIER_NX or NANO, and [JETPACK_VERSION] must be replaced by 4.4, 4.4.1 or 4.5.

Patch instructions

Download the patches

RidgeRun has created a repository from where you can download the patch files.

git clone https://github.com/RidgeRun/NVIDIA-Jetson-IMX477-RPIV3.git

Older versions can be found in jetpack-4.4 and jetpack-4.4.1 branches in the repository. You just have to switch to the jetpack version branch you want to use.

Once you have downloaded the repository, move the files to the $JETSON_KERNEL_SOURCE directory (create the patches directory inside JETSON_KERNEL_SOURCE if necessary):

KERNEL_PATCH=$(pwd)/NVIDIA-Jetson-IMX477-RPIV3/
mv -v $KERNEL_PATCH/patches_[PLATFORM]/* $JETSON_KERNEL_SOURCE/patches/

Where [PLATFORM] must be replaced by nx or nano.

Apply the patches

cd $JETSON_KERNEL_SOURCE/patches
quilt push

Kernel build instructions

Once the sources have been patched, perform the following steps in order to build and install the driver.

Install the Toolchain

NVIDIA recommends using the Linaro 7.3.1 2018.05 toolchain. Download the pre-built toolchain binaries as follows:

wget http://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/aarch64-linux-gnu/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz

Execute the following commands to extract the toolchain:

mkdir -p $HOME/l4t-gcc
cd $HOME/l4t-gcc
tar xf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz

Build the kernel

  • Create the main directories:
cd $JETSON_KERNEL_SOURCE/../
mkdir -p modules/
mkdir -p packages/
mkdir -p dtb/
  • Establish the building paths:
CROSS_COMPILE=$HOME/l4t-gcc/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
KERNEL_OUT=$JETSON_KERNEL_SOURCE/../build
KERNEL_MODULES_OUT=$JETSON_KERNEL_SOURCE/../modules
  • Use the following command to install dependencies on Ubuntu:
sudo apt install libncurses-dev
  • Configure and build kernel:
cd $JETSON_KERNEL_SOURCE
make -C kernel/kernel-4.9/ ARCH=arm64 O=$KERNEL_OUT tegra_defconfig
make -C kernel/kernel-4.9/ ARCH=arm64 O=$KERNEL_OUT menuconfig
  • Select:
Device Drivers  --->
  <*> Multimedia support  --->
      NVIDIA overlay Encoders, decoders, sensors and other helper chips  --->
          <*> IMX477 camera sensor support

Press the Y key in order to select the IMX477 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 kernel, device tree, and modules:
make -C kernel/kernel-4.9/ ARCH=arm64 O=$KERNEL_OUT CROSS_COMPILE=${CROSS_COMPILE} -j4 Image
make -C kernel/kernel-4.9/ ARCH=arm64 O=$KERNEL_OUT CROSS_COMPILE=${CROSS_COMPILE} -j4 dtbs
make -C kernel/kernel-4.9/ ARCH=arm64 O=$KERNEL_OUT CROSS_COMPILE=${CROSS_COMPILE} -j4 modules
make -C kernel/kernel-4.9/ ARCH=arm64 O=$KERNEL_OUT modules_install INSTALL_MOD_PATH=$KERNEL_MODULES_OUT

Flash the Jetson

Flash the Xavier NX

Please, make sure the board is in Recovery Mode.

  • Copy the generated kernel and dtb:
cd $JETSON_KERNEL_SOURCE/../
cp build/arch/arm64/boot/dts/tegra194-p3668-all-p3509-0000.dtb ./kernel/dtb
cp build/arch/arm64/boot/Image ./kernel
  • Flash the dtb:
sudo ./flash.sh -r -k kernel-dtb -d kernel/dtb/tegra194-p3668-all-p3509-0000.dtb jetson-xavier-nx-devkit mmcblk0p1
  • Copy the kernel image:
scp ./kernel/Image <nvidia-nx-user>@<nvidia-nx-ip>:/tmp/
  • Move the Image from /tmp to /boot inside the Xavier NX's filesystem:
sudo mv /tmp/Image /boot/

Flash the Nano



  • Make sure your extlinux.conf file at /boot/extlinux/extlinux.conf in your Nano's filesystem looks as follows by adding the FDT line (remember to change the <dtb> depending on your board).
TIMEOUT 30
DEFAULT primary

MENU TITLE L4T boot options

LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/Image
      INITRD /boot/initrd
      FDT /boot/<dtb>
      APPEND ${cbootargs} quiet
  • Copy the kernel image and DTB:
cd $JETSON_KERNEL_SOURCE/../
scp build/arch/arm64/boot/Image <nvidia-nano-user>@<nvidia-nano-ip>:/tmp/
scp build/arch/arm64/boot/dts/<dtb> <nvidia-nano-user>@<nvidia-nano-ip>:/tmp/
  • Move the files from /tmp to /boot inside the Nano's filesystem:
sudo mv /tmp/Image /boot/
sudo mv /tmp/<dtb> /boot/

Copy the kernel modules

  • You can just access your SD card in your PC and copy the KERNEL_MODULES=$JETPACK_DIR/JetPack_[JETPACK_VERSION]_Linux_JETSON_[PLATFORM]_DEVKIT/Linux_for_Tegra/modules/lib/modules/4.9.201/* directory content into /lib/modules/4.9.201/ in your SD card to update the modules. Where [PLATFORM] must be replaced by XAVIER_NX or NANO, and [JETPACK_VERSION] must be replaced by 4.4, 4.4.1 or 4.5.
  • Or you can update with your compiled modules If your board is up you can update the kernel modules as follows:
KERNEL_MODULES=$JETPACK_DIR/JetPack_[JETPACK_VERSION]_Linux_JETSON_[PLATFORM]_DEVKIT/Linux_for_Tegra/modules/lib/modules/4.9.140
cd $KERNEL_MODULES
# use rsync instead of scp to avoid symlink recursion problems
rsync --progress -avhe ssh ../4.9.201 <nvidia-nx-user>@<nvidia-nx-ip>:/tmp/

Where [PLATFORM] must be replaced by XAVIER_NX or NANO, and [JETPACK_VERSION] must be replaced by 4.4, 4.4.1 or 4.5.


  • Move the modules from /tmp to the /lib/modules/ folder inside the Jetson's filesystem and reboot:
sudo mv /tmp/4.9.201/ /lib/modules/
sudo reboot
  • If you find that the directory name is /lib/modules/4.9.201-tegra/, change the directory name to /lib/modules/4.9.201/
  • After these steps, the driver should be working and you can run some capture tests described below.
  • IMPORTANT: You may see some washed-out colors in the captured image. This is because you haven't applied the ISP configuration file. Make sure to install the ISP file that you can find in the repo using these instructions.

ISP camera overrides installation

Please, visit the Custom ISP Configuration page in order to learn how to use the camera_overrides.isp file to configure the ISP.

Supported Features

Resolutions and framerates

  • 1920x1080 @ 60fps
  • 4032x3040 @ 30fps

Controls

  • Gain
  • Exposure
  • Framerate
  • Group Hold

Example Pipelines

Find some example pipelines to use the IMX477 on Jetson Xavier NX below:

Display

1920x1080

SENSOR_ID=0 # 0 for CAM0 and 1 for CAM1 ports
FRAMERATE=60 # Framerate can go from 2 to 60 for 1920x1080 mode
gst-launch-1.0 nvarguscamerasrc sensor-id=$SENSOR_ID ! "video/x-raw(memory:NVMM),width=1920,height=1080,framerate=$FRAMERATE/1" ! nvvidconv ! nvoverlaysink

4032x3040

SENSOR_ID=0 # 0 for CAM0 and 1 for CAM1 ports
FRAMERATE=30 # Framerate can go from 2 to 30 for 4032x3040 mode
gst-launch-1.0 nvarguscamerasrc sensor-id=$SENSOR_ID ! "video/x-raw(memory:NVMM),width=4032,height=3040,framerate=$FRAMERATE/1" ! nvvidconv ! "video/x-raw(memory:NVMM),width=1920,height=1080,framerate=$FRAMERATE/1" ! nvoverlaysink

MP4 Recording

1920x1080

SENSOR_ID=0 # 0 for CAM0 and 1 for CAM1 ports
FRAMERATE=60 # Framerate can go from 2 to 60 for 1920x1080 mode
gst-launch-1.0 -e nvarguscamerasrc sensor-id=$SENSOR_ID ! "video/x-raw(memory:NVMM),width=1920,height=1080,framerate=$FRAMERATE/1" ! nvv4l2h264enc ! h264parse ! mp4mux ! filesink location=rpi_v3_imx477_cam$SENSOR_ID.mp4

4032x3040

SENSOR_ID=0 # 0 for CAM0 and 1 for CAM1 ports
FRAMERATE=30 # Framerate can go from 2 to 30 for 4032x3040 mode
gst-launch-1.0 -e nvarguscamerasrc sensor-id=$SENSOR_ID ! "video/x-raw(memory:NVMM),width=4032,height=3040,framerate=$FRAMERATE/1" ! nvv4l2h264enc ! h264parse ! mp4mux ! filesink location=rpi_v3_imx477_cam$SENSOR_ID.mp4

JPEG snapshots

1920x1080

SENSOR_ID=0 # 0 for CAM0 and 1 for CAM1 ports
FRAMERATE=60 # Framerate can go from 2 to 60 for 1920x1080 mode
NUMBER_OF_SNAPSHOTS=20
gst-launch-1.0 -e nvarguscamerasrc num-buffers=$NUMBER_OF_SNAPSHOTS sensor-id=$SENSOR_ID ! "video/x-raw(memory:NVMM),width=1920,height=1080,framerate=$FRAMERATE/1" ! nvjpegenc ! multifilesink location=%03d_rpi_v3_imx477_cam$SENSOR_ID.jpeg

4032x3040

SENSOR_ID=0 # 0 for CAM0 and 1 for CAM1 ports
FRAMERATE=30 # Framerate can go from 2 to 30 for 4032x3040 mode
NUMBER_OF_SNAPSHOTS=20
gst-launch-1.0 -e nvarguscamerasrc num-buffers=$NUMBER_OF_SNAPSHOTS sensor-id=$SENSOR_ID ! "video/x-raw(memory:NVMM),width=4032,height=3040,framerate=$FRAMERATE/1" ! nvjpegenc ! multifilesink location=%03d_rpi_v3_imx477_cam$SENSOR_ID.jpeg


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