Enabling v4l2 driver in R24.1 by building Kernel from source code

The first issue for cheese will be fixed in the coming R24.2 release.
As to the second issue, Cheese or v4l2src can be working with the webcam, other than the onboard camera ov5693, which is a raw sensor and desire proper isp processing.

Hi sergeyk789,

As to Cheese(although I can’t look into the tool implementation, it probably invokes gst v4l2src as well) or v4l2src, it’s mostly used for webcam and YUV sensor, but you couldn’t use it to view a raw stream outputs from a raw sensor(onbard ov5693).
Not like v4l2src, NVIDIA provides the gst nvcamerasrc, which has embedded NVIDIA ISP post-processing, so that you can either use it for raw sensor with ISP processing, or webcam and YUV sensor with ISP-bypassing.
Let me know if it’s clear for you.

Thanks nVConan,

So one thing is clear that onboard camera ov5693 won’t work with cheese or other v4l2 base apps in the current V4L 24.1.

We have to use nvcamerasrc what has been provided by nvidia.

  1. I did not get “embedded NVIDIA ISP post-processing” ?
    Does it mean nvcamerasrc converts raw sensor format to RGB/BGR or in other formats ?

  2. How do get onboard camera ov5693 work with opencv ?
    I tried this thread but it did not work.

    https://devtalk.nvidia.com/default/topic/925923/can-not-open-the-camera-on-tx1-via-opencv/

  3. How can i get the camera data out from “gstreamer + nvcamerasrc” pipeline ?

So that i can actually work with video coming from onboard camera ov5693.

GENERIC “HOW TO” FOR CSI DEVICES

This how-to requires some knowledge, skills and definitely great courage :-) It is based on R21.4 and Tegra K1 but I guess it should be helpful anyway.

According to our experience to make any device (including OV sensors) work with Tegra the one should do following things:

  • Use I2C to configure your image source device to feed correct resolution and color format. Or any other way if I2C is not applicable.

  • Completely remove soc_camera_platform driver from kernel. (important!)

  • Provide correct device platform data (file mach_tegra.c or proper dts/dtsi files): clocks, lanes, disable DPD on CSI lanes if needed.

  • Update tegra_camera driver (vi2.c):

  • to disable DPD mode for CSI lanes if needed: disable DPD for both A and B if 4 lanes (important!).
  • add new supported formats V4L2_PIX_FMT_xxx if needed (tegra_camera/common.c):
  • update actions for previously added V4L2_PIX_FMT_xxx formats in source code (if needed)
  • improve vi2_capture_error_status to make it decode errors in text
  • make verbose error reporting to track CSI status in real time
  • Don’t forget to load drivers in proper order similar to the following (based on driver for tc358748 chip):

sudo rmmod tegra_camera
sudo rmmod tc358748
sudo rmmod ov5640

cd /lib/modules/uname -r/kernel

sudo insmod drivers/media/v4l2-core/videobuf2-dma-contig.ko

sudo insmod drivers/media/i2c/soc_camera/tc358748.ko
sudo insmod drivers/media/platform/soc_camera/tegra_camera/tegra_camera.ko

  • Use the power (and notes above) to debug hw/CSI stream issues )

Good luck!

Here’s a C++ class that uses nvcamerasrc and appsink element to get the data from onboard camera in R24.1:

https://github.com/dusty-nv/jetson-inference/blob/master/camera/gstCamera.h
https://github.com/dusty-nv/jetson-inference/blob/master/camera/gstCamera.cpp

You may want to copy it along with gstUtility.h/cpp into your own project. See the CMakeLists.txt for compiler include/linker directives related to compiling with gstreamer, and see the CMakePreBuild.sh for installing any required gstreamer-1.0 development packages.

Can the V4L2_Sensor_Driver_Programming_Guide_v4.0.pdf instructions be applied to the TK1

Hi ayodeji

TK1 are using soc_camera instead of media controller framework so that you can’t reference to it.
For the TK1 you can reference to the driver locate …/kernel/drivers/media/i2c/soc_camera/ar0261_v4l2.c ,and the board file are locate …/kernel/arch/arm/mach-tegra/board-ardbeg-sensors.c

And you may need below kernel configs
disable CONFIG_SOC_CAMERA_PLATFORM
CONFIG_VIDEO_TEGRA=y
CONFIG_VIDEO_TEGRA_VI2=y