OmniVision Monochrome OV24A1B Linux driver for Jetson: Difference between revisions

From RidgeRun Developer Wiki
Line 312: Line 312:
</syntaxhighlight>
</syntaxhighlight>


'''2.''' Download and install JetPack 4.4 following the instructions from [https://developer.ridgerun.com/wiki/index.php?title=Raspberry_Pi_HQ_camera_IMX477_Linux_driver_for_Jetson#Download_the_JetPack_4.4 JetPack 4.4 Installation Instructions]<br><br>
'''2.''' Download and install JetPack 4.4 following the instructions from [https://developer.ridgerun.com/wiki/index.php?title=Raspberry_Pi_HQ_camera_IMX477_Linux_driver_for_Jetson#Download_the_JetPack_4.4 JetPack 4.4 Installation Instructions]<br>


'''3.''' Download the L4T sources according to your platform from the [https://developer.nvidia.com/embedded/downloads Jetson Download Center].<br>
'''3.''' Download the L4T sources according to your platform from the [https://developer.nvidia.com/embedded/downloads Jetson Download Center].<br>


The Xavier AGX sources for JetPack 4.4 can be downloaded from [https://developer.nvidia.com/embedded/L4T/r32_Release_v4.3/sources/T186/public_sources.tbz2 here].<br><br>
The Xavier AGX sources for JetPack 4.4 can be downloaded from [https://developer.nvidia.com/embedded/L4T/r32_Release_v4.3/sources/T186/public_sources.tbz2 here].<br>


'''4.''' Create a folder named ''sources/'' in the ''Linux_for_Tegra/'' directory.
'''4.''' Create a folder named ''sources/'' in the ''Linux_for_Tegra/'' directory.
Line 340: Line 340:
<syntaxhighlight>
<syntaxhighlight>
tar -xvf ov24a1b_driver.tar
tar -xvf ov24a1b_driver.tar
</syntaxhighlight><br>
</syntaxhighlight>


Move the uncompressed ''patches/'' folder into your ''JetPack_4.4_Linux_JETSON_AGX_XAVIER/Linux_for_Tegra/source/'' directory.
Move the uncompressed ''patches/'' folder into your ''JetPack_4.4_Linux_JETSON_AGX_XAVIER/Linux_for_Tegra/source/'' directory.
<syntaxhighlight>
<syntaxhighlight>
mv patches/ JetPack_4.4_Linux_JETSON_AGX_XAVIER/Linux_for_Tegra/source/
mv patches/ JetPack_4.4_Linux_JETSON_AGX_XAVIER/Linux_for_Tegra/source/
</syntaxhighlight><br>
</syntaxhighlight>


Apply the patch as follows:
Apply the patch as follows:
Line 362: Line 362:
mkdir -p packages/
mkdir -p packages/
mkdir -p dtb/
mkdir -p dtb/
</syntaxhighlight><br>
</syntaxhighlight>


Set up some variables:
Set up some variables:
Line 369: Line 369:
KERNEL_OUT=$JETSON_KERNEL_SOURCE/../build
KERNEL_OUT=$JETSON_KERNEL_SOURCE/../build
KERNEL_MODULES_OUT=$JETSON_KERNEL_SOURCE/../modules
KERNEL_MODULES_OUT=$JETSON_KERNEL_SOURCE/../modules
</syntaxhighlight><br>
</syntaxhighlight>


Configure and build the kernel:
Configure and build the kernel:
Line 376: Line 376:
make -C kernel/kernel-4.9/ ARCH=arm64 O=$KERNEL_OUT tegra_defconfig
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
make -C kernel/kernel-4.9/ ARCH=arm64 O=$KERNEL_OUT menuconfig
</syntaxhighlight><br>
</syntaxhighlight>


==== Enable driver ====
==== Enable driver ====

Revision as of 22:19, 8 April 2021


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

OmniVision Monochrome OV24A1B Sensor features

Reference: OmniVision OV24A1B sensor

Supported resolutions and formats

Feature Value
Resolution 5664x4248
Framerate(fps) 30
Format GRAY16_LE
Pixel depth 16

Controls

  • Gain
  • Exposure
  • Frame rate

Build kernel using Jetpack and OV24A1B driver

The following guide relies on the steps required to install the OV24A1B driver on JetPack 4.4 for the Jetson AGX Xavier platform.

Building kernel sources

Once you have purchased the driver you will be provided with a tarball file containing the required patches to install the driver. Lets call it ov24a1b_driver.tar.

1. Download 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

2. Download and install JetPack 4.4 following the instructions from JetPack 4.4 Installation Instructions

3. Download the L4T sources according to your platform from the Jetson Download Center.

The Xavier AGX sources for JetPack 4.4 can be downloaded from here.

4. Create a folder named sources/ in the Linux_for_Tegra/ directory.

mkdir -p JetPack_4.4_Linux_JETSON_AGX_XAVIER/Linux_for_Tegra/source/


5. Uncompress the public_sources.tbz2 tarball.

tar -xvf public_sources.tbz2


6. Uncompress the public_sources.tbz2/Linux_for_Tegra/source/public/kernel_src.tbz2 content (kernel and hardware folders) in the JetPack_4.4_Linux_JETSON_AGX_XAVIER/Linux_for_Tegra/source/ directory.

cd Linux_for_Tegra/source/public/
tar -xvf kernel_src.tbz2
mv hardware/ kernel/ JetPack_4.4_Linux_JETSON_AGX_XAVIER/Linux_for_Tegra/source/


7. Apply the patch present in the provided tarball file:

First untar the provided tarball:

tar -xvf ov24a1b_driver.tar

Move the uncompressed patches/ folder into your JetPack_4.4_Linux_JETSON_AGX_XAVIER/Linux_for_Tegra/source/ directory.

mv patches/ JetPack_4.4_Linux_JETSON_AGX_XAVIER/Linux_for_Tegra/source/

Apply the patch as follows:

cd JetPack_4.4_Linux_JETSON_AGX_XAVIER/Linux_for_Tegra/source/
quilt push


8. Build the new patched kernel:

Create the main directories:

JETSON_KERNEL_SOURCE=JetPack_4.4_Linux_JETSON_AGX_XAVIER/Linux_for_Tegra/source/
cd $JETSON_KERNEL_SOURCE/../
mkdir -p modules/
mkdir -p packages/
mkdir -p dtb/

Set up some variables:

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

Configure and build the 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

Enable driver

Select in the menu (if not selected yet):

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


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. It allows you to enable the OV24A1B driver as built-in.

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


Copy the generated kernel and dtb:

cd $JETSON_KERNEL_SOURCE/../
cp build/arch/arm64/boot/dts/tegra194-p2888-0001-p2822-0000.dtb ./kernel/dtb
cp build/arch/arm64/boot/Image ./kernel


Flash the Xavier AGX and install the OV24A1B driver

1. Put your Jetson developer kit into Force Recovery Mode (RCM):

i) Ensure that the developer kit is powered off.
ii) Press and hold down the Force Recovery button.
iii) Press, then release the Power button.
iv) Release the Recovery button.

You can confirm that your developer kit is in Force Recovery mode you can use lsusb and get the following line as part of the output:

Bus 001 Device 015: ID 0955:7020 NVidia Corp.

2. Flash the board with the following command:

sudo ./flash.sh -r -k kernel-dtb -d kernel/dtb/tegra194-p2888-0001-p2822-0000.dtb jetson-xavier mmcblk0p1

3. Copy the compiled kernel image and modules:

Kernel:

scp ./kernel/Image nvidia@<xavier-ip>:/tmp/

Modules:

scp -r ./modules/lib/modules/4.9.140/kernel/ nvidia@<xavier-ip>:/tmp/
scp ./modules/lib/modules/4.9.140/modules.* nvidia@<xavier-ip>:/tmp/

4. Update kernel image and modules inside the board and reboot from CLI:

cd /tmp/
sudo rm -rf /lib/modules/4.9.140/kernel/*
sudo mv kernel/* /lib/modules/4.9.140/kernel/
sudo mv modules.* /lib/modules/4.9.140/
sudo mv Image /boot/
sudo reboot

Test your Kernel image using Jetpack root file system

1. Check the kernel version. At this moment you can test the image created in order to see the new kernel is working correctly.
You should see a new kernel version with the correct date of compilation:

uname -a 
Linux nvidia 4.9.140 #199 SMP PREEMPT Tue Mar 16 16:25:38 CST 2021 aarch64 aarch64 aarch64 GNU/Linux


2. You can see whether the driver is probed by executing this line:

dmesg | grep ov24a1b

Expected output:

nvidia@nvidia:~$ dmesg | grep ov24a1b
[    1.926169] ov24a1b 30-0036: probing v4l2 sensor
[    1.927161] ov24a1b 30-0036: tegracam sensor driver:_v2.0.6
[    1.926169] tegra194-vi5 15c10000.vi: subdev ov24a1b 30-0036 bound

3. Check the created video devices:

ls /dev/video*
/dev/video0

Examples

GStreamer pipelines

5664x4248@30fps

gst-launch-1.0 v4l2src ! video/x-raw,width=5664,height=4248,format=GRAY16_LE ! perf ! fakesink


RidgeRun Resources

Quick Start Client Engagement Process RidgeRun Blog Homepage
Technical and Sales Support RidgeRun Online Store RidgeRun Videos Contact Us
RidgeRun.ai: Artificial Intelligence | Generative AI | Machine Learning

Contact Us

Visit our Main Website for the RidgeRun Products and Online Store. RidgeRun Engineering information is available at RidgeRun Engineering Services, 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.