OV9732 Image Capture on TX2

Hi,

I have an OV9732 camera interfaced with TX2-4GB varient. I have taken OV5693 camera as reference and did the driver and device-tree porting for OV9732. Video nodes and subdev nodes are coming.
Now when i am trying to capture raw images or videos using gst-launch and yavta i am getting full black image with horizontal lines on it. Camera preview is bad.
Camera Details:
OV9732
format: bayer-bggr
res:1280x720
fps:120
command to capture frames:

gst-launch-1.0 nvarguscamerasrc num-buffers=200 ! ‘video/x-raw(memory:NVMM),width=1280, height=720, framerate=30/1, format=NV12’ ! omxh264enc ! qtmux ! filesink location=test1.mp4 -e

Setting pipeline to PAUSED …
Pipeline is live and does not need PREROLL …
Setting pipeline to PLAYING …
New clock: GstSystemClock
Framerate set to : 30 at NvxVideoEncoderSetParameterNvMMLiteOpen : Block : BlockType = 4
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
H264: Profile = 66, Level = 40
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected…
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 1280 x 720 FR = 120.000005 fps Duration = 8333333 ; Analog Gain range min 1.000000, max 16.000000; Exposure Range min 22000, max 358733000;

GST_ARGUS: Running with following settings:
Camera index = 0
Camera mode = 0
Output Stream W = 1280 H = 720
seconds to Run = 0
Frame Rate = 120.000005
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
Got EOS from element “pipeline0”.
Execution ended after 0:00:25.762670144
Setting pipeline to PAUSED …
Setting pipeline to READY …
GST_ARGUS: Cleaning up
CONSUMER: Done Success
GST_ARGUS: Done Success
Setting pipeline to NULL …
Freeing pipeline …

Please suggest how can i fix this preview.

Have v4l2-ctl to get the raw data to confirm the sensor setting first. You can use 7yuv to check the raw data.

v4l2-ctl -d /dev/video0 --set-fmt-video=width=1280,height=720 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=ov.raw

Hi Shane,

We got the reason for the black image, calculated the pixel clock again and kept frame rate to 30fps in the device tree. and now with v4l2-ctl command able to capture raw frames.

I have one more query, in our design i am having four cameras. I want to capture video from all the four cameras.

i found below command to capture video but it is automatically picking video2, which is third camera in our case:

gst-launch-1.0 nvarguscamerasrc num-buffers=200 ! ‘video/x-raw(memory:NVMM),width=1280, height=720, framerate=30/1, format=NV12’ ! omxh264enc ! qtmux ! filesink location=test2.mp4 -e

Can you please suggest how can i capture video from all the four cameras parallely using gst-launch ?

That’s weird the default should be sensor 0,
You can add sensor-id=1 to the pipeline to select sensor.

gst-launch-1.0 nvarguscamerasrc sensor-id=1 num-buffers=200 ! .....

Hi Shane,

Actually right now in my device-tree, under tegra-camera-platform below entries are done for modules:
modules {
module0 {
badge = “e33_topleft_P5V27C”;
position = “topleft”;
orientation = “0”;
drivernode0 {
/* Declare PCL support driver (classically known as guid) /
pcl_id = “v4l2_sensor”;
/
Driver v4l2 device name /
devname = “ov9732 7-0036”;
/
Declare the device-tree hierarchy to driver instance /
proc-device-tree = “/proc/device-tree/i2c@c250000/ov9732_f@36”;
};
drivernode1 {
/
Declare PCL support driver (classically known as guid) /
pcl_id = “v4l2_lens”;
proc-device-tree = “/proc/device-tree/e33_lens_ov9732@P5V27C/”;
};
};
module1 {
badge = “e33_centreright_P5V27C”;
position = “centerright”;
orientation = “0”;
drivernode0 {
/
Declare PCL support driver (classically known as guid) /
pcl_id = “v4l2_sensor”;
/
Driver v4l2 device name /
devname = “ov9732 2-0036”;
/
Declare the device-tree hierarchy to driver instance /
proc-device-tree = “/proc/device-tree/i2c@3180000/ov9732_e@36”;
};
drivernode1 {
/
Declare PCL support driver (classically known as guid) */
pcl_id = “v4l2_lens”;
proc-device-tree = “/proc/device-tree/e33_lens_ov9732@P5V27C/”;
};
};

So When i am running gst-launch with sensor-id=0 then module0 is capturing the videos and when i am using sensor-id=1 then module1 starts capturing but its not releasing the buffer and is stuck as below:

Setting pipeline to PAUSED …
Pipeline is live and does not need PREROLL …
Setting pipeline to PLAYING …
New clock: GstSystemClock
Framerate set to : 30 at NvxVideoEncoderSetParameterNvMMLiteOpen : Block : BlockType = 4
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
H264: Profile = 66, Level = 40
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected…
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 1280 x 720 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 16.000000; Exposure Range min 22000, max 358733000;

GST_ARGUS: Running with following settings:
Camera index = 1
Camera mode = 0
Output Stream W = 1280 H = 720
seconds to Run = 0
Frame Rate = 29.999999
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.

and in the dmesg, its trying to capture on all the three cameras as below
[ 86.156628] ov491 2-0024: ov491_open:
[ 86.158414] ov491 2-0024: ov491_power_on: power on
[ 86.158418] ov491 2-0024: ov491_power_on: Power ON success
[ 86.160290] ov491 2-0024: ov491_power_off: power off
[ 86.160295] ov491 2-0024: ov491_power_off: Power OFF success
[ 86.160866] ov9732 2-0036: ov9732_power_on: VVDN: power on
[ 86.170579] ov9732 2-0036: ov9732_power_on: Power ON success
[ 86.176423] ov9732 2-0036: ov9732_power_off: VVDN: power off
[ 86.184735] ov9732 7-0036: ov9732_power_on: VVDN: power on
[ 86.194441] ov9732 7-0036: ov9732_power_on: Power ON success
[ 86.200396] ov9732 7-0036: ov9732_power_off: VVDN: power off
[ 92.361935] tegra_camera_open: VVDN: tegra_camera_open Called
[ 92.392515] ov491 2-0024: ov491_power_on: power on
[ 92.392529] ov491 2-0024: ov491_power_on: Power ON success
[ 92.398405] ov491 2-0024: ov491_power_off: power off
[ 92.398411] ov491 2-0024: ov491_power_off: Power OFF success
[ 92.399094] ov9732 2-0036: ov9732_power_on: VVDN: power on
[ 92.408705] ov9732 2-0036: ov9732_power_on: Power ON success
[ 92.414486] ov9732 2-0036: ov9732_power_off: VVDN: power off
[ 92.424868] ov9732 7-0036: ov9732_power_on: VVDN: power on
[ 92.434456] ov9732 7-0036: ov9732_power_on: Power ON success
[ 92.440241] ov9732 7-0036: ov9732_power_off: VVDN: power off
[ 92.450600] ov491 2-0024: ov491_power_on: power on
[ 92.450603] ov491 2-0024: ov491_power_on: Power ON success
[ 92.450657] ov491 2-0024: ov491_power_off: power off
[ 92.450660] ov491 2-0024: ov491_power_off: Power OFF success
[ 92.451185] ov9732 2-0036: ov9732_power_on: VVDN: power on
[ 92.460819] ov9732 2-0036: ov9732_power_on: Power ON success
[ 92.466586] ov9732 2-0036: ov9732_power_off: VVDN: power off
[ 92.476930] ov9732 7-0036: ov9732_power_on: VVDN: power on
[ 92.486598] ov9732 7-0036: ov9732_power_on: Power ON success
[ 92.492570] ov9732 7-0036: ov9732_power_off: VVDN: power off
[ 92.518429] ov9732 7-0036: ov9732_power_on: VVDN: power on
[ 92.528178] ov9732 7-0036: ov9732_power_on: Power ON success
[ 92.534208] ov9732 7-0036: ov9732_power_off: VVDN: power off
[ 92.542957] ov9732 7-0036: ov9732_power_on: VVDN: power on
[ 92.552628] ov9732 7-0036: ov9732_power_on: Power ON success
[ 92.558451] ov9732 7-0036: ov9732_power_off: VVDN: power off
[ 92.566801] ov9732 7-0036: ov9732_power_on: VVDN: power on
[ 92.576529] ov9732 7-0036: ov9732_power_on: Power ON success
[ 92.582332] ov9732 7-0036: ov9732_power_off: VVDN: power off
[ 92.633351] ov9732 7-0036: ov9732_power_on: VVDN: power on
[ 92.642937] ov9732 7-0036: ov9732_power_on: Power ON success
[ 92.648916] ov9732 7-0036: ov9732_power_off: VVDN: power off
[ 92.662547] ov9732 2-0036: ov9732_power_on: VVDN: power on
[ 92.672245] ov9732 2-0036: ov9732_power_on: Power ON success
[ 92.678127] ov9732 2-0036: ov9732_power_off: VVDN: power off
[ 92.687246] ov9732 2-0036: ov9732_power_on: VVDN: power on
[ 92.697036] ov9732 2-0036: ov9732_power_on: Power ON success
[ 92.702875] ov9732 2-0036: ov9732_power_off: VVDN: power off
[ 92.711231] ov9732 2-0036: ov9732_power_on: VVDN: power on
[ 92.720939] ov9732 2-0036: ov9732_power_on: Power ON success
[ 92.727140] ov9732 2-0036: ov9732_power_off: VVDN: power off
[ 92.959233] ov9732 2-0036: ov9732_power_on: VVDN: power on
[ 92.968891] ov9732 2-0036: ov9732_power_on: Power ON success
[ 92.976796] ov9732 2-0036: ov9732_set_exposure: val: 3038
[ 92.984399] ov9732_set_mode: VVDN: called with set mode value 0

your response will be awaited.

Not very clear for your problem.
Do you have verify the video0/video1 by v4l2-ctl to confirm the kernel sensor driver.

v4l2-ctl --stream-mmap --stream-count=100 -d /dev/video0

v4l2-ctl --stream-mmap --stream-count=100 -d /dev/video1

Hi Shane,

Apologies for late update.
Yes, the issue is resolved. earlier the position parameter naming was not proper. Now with below changes gst-launch command is working with both video nodes.

    modules {
        module0 {
            badge = "e33_topleft_P5V27C";
            position = "topleft";
            orientation = "0";
            drivernode0 {
                /* Declare PCL support driver (classically known as guid)  */
                pcl_id = "v4l2_sensor";
                /* Driver v4l2 device name */
                devname = "ov9732 7-0036";
                /* Declare the device-tree hierarchy to driver instance */
                proc-device-tree = "/proc/device-tree/i2c@c250000/ov9732_f@36";
            };
            drivernode1 {
                /* Declare PCL support driver (classically known as guid)  */
                pcl_id = "v4l2_lens";
                proc-device-tree = "/proc/device-tree/e33_lens_ov9732@P5V27C/";
            };
        };
        module1 {                                                                                                                                              
            badge = "e33_centerright_P5V27C";
            position = "centerright";
            orientation = "0";
            drivernode0 {
                /* Declare PCL support driver (classically known as guid)  */
                pcl_id = "v4l2_sensor";
                /* Driver v4l2 device name */
                devname = "ov9732 2-0036";
                /* Declare the device-tree hierarchy to driver instance */
                proc-device-tree = "/proc/device-tree/i2c@3180000/ov9732_e@36";
            };
            drivernode1 {
                /* Declare PCL support driver (classically known as guid)  */
                pcl_id = "v4l2_lens";
                proc-device-tree = "/proc/device-tree/e33_lens_ov9732@P5V27C/";
            };   

Thanks for the support.