v4l2 capture with imx185, kernel 24.2.1, jetpack 2.3.1

Hi,

I am using Leopard Imaging IMX185 camera connected to Tegra TX1 development kit using Leopard Imaging adapter. My jetpack version is JetPack-L4T-2.3.1 and kernel version is 24.2.1

I am able to capture from the camera using nvgstcapture-1.0 and also using the nvcamerasrc element in a gstreamer pipeline.

However, our requirement is to capture the RAW data from the sensor (we will be eventually moving to a monochrome sensor). When I try to capture using yavta, I get all black frames (content is 0x0). I changed yavta to fill in a “0xab” pattern in the frames before capture, and I see that the frames have the same content after capture, i.e. no data got written to the frames.

Could you please tell me:

  1. What could be causing the v4l2 direct capture failure?
  2. Is it possible to use nvcamerasrc element to capture raw bayer data (i.e. the ISP should do nothing)

Here is more information about my setup:

Jetson TX1 Development Kit
Jetpack 2.3.1, Linux kernel tegra-24.2.1

IMX 185 Leopard Imaging camera connected to J21 connector of TX1 via Leopard imaging MIPI connector

  • nvcamerasrc works:

gst-launch-1.0 nvcamerasrc fpsRange=“30 30” ! ‘video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1’ ! filesink location=file.raw

OR

nvgstcapture

–> This works
–> I put logs inside drivers/media/platform/tegra/camera/channel.c, this goes via bypass path, so VI bypass works

  • v4l2 capture does not work

v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=RG12 --stream-mmap --stream-count=1 -d /dev/video0 --stream-to=test.raw

OR

./yavta /dev/video0 -c3 -s1920x1080 -fSRGGB10 -I -Fov.raw

–> This does not work. This goes via the tegra-video v4l2 path. I put logs in the kernel driver and found that queue frame -> soc_channel_capture_frame -> updating v4l2 timestamps all happens at expected frame rate, but received frames have no data.

hi kjpadia,

v4l2 capture should works, suspect the input parameter error.
could you list your sensor capabilities by v4l2-ctl as below, and try v4l2 capture again ? thanks

$ v4l2-ctl -V

Hi JerryChang

ubuntu@tegra-ubuntu:~$ v4l2-ctl -V
Format Video Capture:
Width/Height : 1920/1080
Pixel Format : ‘RG12’
Field : None
Bytes per Line : 3840
Size Image : 4147200
Colorspace : sRGB
Transfer Function : Default
YCbCr Encoding : Default
Quantization : Default
Flags :

I am using this command for capture:

v4l2-ctl --set-fmt-video=width=1920,height=1080 --stream-count=1 -d /dev/video0 --stream-to=dma.raw

hello kjpadia,

could you add some debug message to check below functions works.
please also check the input control value too. thanks

control[0].id = V4L2_CID_GAIN;
        control[1].id = V4L2_CID_FRAME_RATE;
        control[2].id = V4L2_CID_EXPOSURE;

        err = v4l2_g_ext_ctrls(&priv->ctrl_handler, &ctrls);
        if (err == 0) {

                err |= imx185_set_gain(priv, control[0].value64);
                if (err)
                        dev_err(&client->dev,
                                "%s: error gain override\n", __func__);

                err |= imx185_set_frame_rate(priv, control[1].value64);
                if (err)
                        dev_err(&client->dev,
                                "%s: error frame length override\n", __func__);

                err |= imx185_set_exposure(priv, control[2].value64);
                if (err)
                        dev_err(&client->dev,
                                "%s: error exposure override\n", __func__);

        }

Dear Jerry,

v4l2 capture does work, I think my exposure and gain settings were wrong. I am now using the following command:

v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=1080 --set-ctrl bypass_mode=0 --set-ctrl gain=10 --set-ctrl exposure=100025 --set-ctrl sensor_mode=254 --stream-mmap --stream-count=1 --stream-to=f0.raw