OmniVision OV5647 Linux driver for Jetson Nano
|
|
Omnivision OV5647 image sensor
The Omnivision OV5647 is a CMOS image sensor with the following features:
- Automatic image control functions:
- Automatic exposure control (AEC)
- Automatic white balance (AWB)
- Automatic band filter (ABF)
- Automatic 50/60 Hz luminance detection
- Automatic black level calibration (ABLC)
- Image quality controls: lens correction, defective pixel canceling
- CSI2 serial data output (MIPI interface 2 lanes)
- Support for output formats: 8-/10-bit raw RGB data
- Maximum image transfer rate:
- QSXGA "Mpixel" (2592 x 1944): 15 fps
- 1080p: 30 fps
- 960p: 45 fps
- 720p: 60 fps
- VGA (640 x 480): 90 fps
- QVGA (320 x 240): 120 fps
Enabling the Omnivision OV5647 Linux driver
Follow these instructions to build and install the kernel Image and device tree.
1. dependencies
2. Set the environment variables for the sources L4T 31-1-0
3. Install the toolchain
4. Download the kernel sources
JETSON_NANO_SOURCES=$(pwd)
wget https://developer.download.nvidia.com/embedded/L4T/r32_Release_v1.0/jetson-nano/BSP/Jetson-Nano-public_sources.tbz2 --no-check-certificate
tar -xvf Jetson-Nano-public_sources.tbz2
cd public_sources/
tar -xvf kernel_src.tbz2
5. Apply driver patches
Before start building the kernel and dtb sources, apply the patch with OV5647 camera sources:
Copy the patches tarball into the sources directory, decompress the tarball and apply the patch with the commands:
mv 4.2_nano_ov5647.tar.gz $JETSON_NANO_SOURCES/public_sources
cd $JETSON_NANO_SOURCES/public_sources
tar -xvf 4.2_nano_ov5647.tar.gz
quilt push
6. Compile kernel and dtb
Follow the steps:
cd $JETSON_NANO_SOURCES/public_sources
CROSS_COMPILE=${HOME}/toolchain_bin_${VERSION}/${TOOLCHAIN_DIR}/bin/$CC_PREFIX
KERNEL_OUT=$JETSON_NANO_SOURCES/public_sources/build
KERNEL_MODULES_OUT=$JETSON_NANO_SOURCES/public_sources/modules
cd $JETSON_NANO_SOURCES/public_sources
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 CROSS_COMPILE=${CROSS_COMPILE} -j6 Image
make -C kernel/kernel-4.9/ ARCH=arm64 O=$KERNEL_OUT CROSS_COMPILE=${CROSS_COMPILE} -j6 dtbs
make -C kernel/kernel-4.9/ ARCH=arm64 O=$KERNEL_OUT CROSS_COMPILE=${CROSS_COMPILE} -j6 modules
make -C kernel/kernel-4.9/ ARCH=arm64 O=$KERNEL_OUT modules_install INSTALL_MOD_PATH=$KERNEL_MODULES_OUT
7. Flash Jetson Nano memory
This guide assumes that the user already have JetPack 4.2 installed. This link contains details about how to install JetPack 4.2: https://docs.nvidia.com/sdk-manager/download-run-sdkm/index.html
JETPACK_4_2 contains the directory where JetPack 4.2 was installed. Usually in.
~/nvidia/nvidia_sdk
So please do:
export JETPACK_4_2=$HOME/nvidia/nvidia_sdk/
Make sure the Jetson Nano is in recovery mode
cd ${JETPACK_4_2}/JetPack_4.2_Linux_P3448/Linux_for_Tegra
# Copy kernel generated
cp $JETSON_NANO_SOURCES/public_sources/build/arch/arm64/boot/Image kernel/
# Copy device tree generated
cp $JETSON_NANO_SOURCES/public_sources/build/arch/arm64/boot/dts/tegra210-p3448-0000-p3449-0000-a02.dtb kernel/dtb/
# Copy new modules
sudo cp -a $JETSON_NANO_SOURCES/public_sources/modules/lib rootfs/
# Flash memory
sudo ./flash.sh jetson-nano-qspi-sd mmcblk0p1
Using the OmniVision OV5647 Linux driver
Capture at 1080p@30fps
DISPLAY=:0 gst-launch-1.0 nvarguscamerasrc sensor-id=0 num-buffers=10000 ! \
'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)21/1' ! \
nvvidconv ! queue ! ximagesink
For direct inquiries, please refer to the contact information available on our Contact page. Alternatively, you may complete and submit the form provided at the same link. We will respond to your request at our earliest opportunity.
Links to RidgeRun Resources and RidgeRun Artificial Intelligence Solutions can be found in the footer below.