OmniVision OV5647 Linux driver for Jetson Nano

From RidgeRun Developer Connection
Revision as of 15:17, 7 June 2019 by Mleiva (talk | contribs) (5. Apply driver patches)
Jump to: navigation, search

OV5647 Features

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 driver

Follow these instructions to build and install the kernel Image and device tree.

1. Install dependencies

https://developer.ridgerun.com/wiki/index.php?title=NVIDIA_Jetson_Nano_-_Building_the_Kernel_from_Source#Dependencies

2. Set the environment variables for the sources L4T 31-1-0

https://developer.ridgerun.com/wiki/index.php?title=NVIDIA_Jetson_Nano_-_Building_the_Kernel_from_Source#Environment_variables

3. Install the toolchain

https://developer.ridgerun.com/wiki/index.php?title=NVIDIA_Jetson_Nano_-_Building_the_Kernel_from_Source#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
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 sources directory, decompress the tarball and apply the patch with the commands:

mv 4.2_nano_ov5647.tar $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

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

Contact Us

If you are interested in the evaluation version or for technical questions please send an email to support@ridgerun.com. If you are interested in purchasing the driver, please post your inquiry at our Contact Us link.