Jetson T5000 gmsl camera preview error

  1. carrier board
  2. jetson_r38.2.1
  3. gst-launch-1.0 -v v4l2src device=“/dev/video0” ! video/x-raw,framerate=30/1,width=1920,height=1080,format=UYVY ! xvimagesink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Device '/dev/video0' has no supported format
New clock: GstSystemClock
Additional debug info:
../sys/v4l2/gstv4l2object.c(4399): gst_v4l2_object_set_format_full (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Call to TRY_FMT failed for UYVY @ 1920x1080: Invalid argument
Execution ended after 0:00:00.000295455
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Setting pipeline to NULL ...
Additional debug info:
../libs/gst/base/gstbasesrc.c(3177): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Freeing pipeline ...
  1. v4l2-ctl -d /dev/video0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture

        [0]: 'UYVY' (UYVY 4:2:2)
        [1]: 'NV16' (Y/UV 4:2:2)
        [2]: 'UYVY' (UYVY 4:2:2)

camera.dmesg.txt (129.9 KB)

trace.txt (9.7 KB)

Try v4l2-ctl to confirm the driver. And get the trace log if failed.

v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=UYVY --set-ctrl bypass_mode=0 --stream-mmap -d /dev/video0 

nvidia@tegra-ubuntu:~$ v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=UYVY --set-ctrl bypass_mode=0 --stream-mmap -d /dev/video0
VIDIOC_S_FMT: failed: Invalid argument
rify_rate_range: FMON_NVCSI: rate 9727619 below min 15000000
fmon_update_config: FMON_NVCSI: detected fault 0x80
verify_rate_range: FMON_NVCSI: rate 9727619 below min 15000000
fmon_update_config: FMON_NVCSI: detected fault 0x80
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.00 fps
<<<<<<<<<<<<<FO: END TASK:MBINFO: enter idle task.
 =ogic map: 0=>0 1=>2 2=>1er idle taC .
<<<<<<<<<<<<<<< 30.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.00 fps
<<<<<<<<<<<<<<<<<<C ph => logic map: 0=>0 1=>2 2=>1
<<<<<<<<<< 30.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.00 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.00 fps
<<<<^Crify_rate_range: FMON_NVCSI: rate 9727619 below min 15000000
fn_update_config: FMON_NVCSI: detected fault 0x80

Looks like v4l2-ctl working well.

Maybe try the nvv4l2camerasrc to try.

nvidia@tegra-ubuntu:~$ DISPLAY=:0 gst-launch-1.0 nvv4l2camerasrc device=/dev/video0 ! 'video/x-raw(memory:NVMM), format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, interlace-mode=progressive' ! nvvidconv ! nv3dsink -e
ERROR: pipeline could not be constructed: no element "nvv4l2camerasrc".

Install the nvidia-l4t-gstreamer and nvidia-l4t-jetson-multimedia-api to check.

nvidia@tegra-ubuntu:~$ gst-launch-1.0 nvv4l2camerasrc device=/dev/video0 ! 'video/x-raw(memory:NVMM), format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, interlace-mode=progressive' ! nvvidconv ! nv3dsink -e
Setting pipeline to PAUSED ...
ERROR: from element /GstPipeline:pipeline0/GstNv3dSink:nv3dsink0: GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failure.
Additional debug info:
../libs/gst/base/gstbasesink.c(5906): gst_base_sink_change_state (): /GstPipeline:pipeline0/GstNv3dSink:nv3dsink0:
Failed to start
ERROR: pipeline doesn't want to preroll.
Failed to set pipeline to PAUSED.
Setting pipeline to NULL ...
Freeing pipeline ...

What’s the output size? What’s the command didn’t show the size? Could you remove the NV16 and duplicate UYVY to confirm.

nvidia@tegra-ubuntu:~$ v4l2-ctl -d /dev/video0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
	Type: Video Capture

	[0]: 'UYVY' (UYVY 4:2:2)
		Size: Discrete 1920x1080
			Interval: Discrete 0.033s (30.000 fps)
	[1]: 'NV16' (Y/UV 4:2:2)
		Size: Discrete 1920x1080
			Interval: Discrete 0.033s (30.000 fps)
	[2]: 'UYVY' (UYVY 4:2:2)
		Size: Discrete 1920x1080
			Interval: Discrete 0.033s (30.000 fps)

How to remove the NV16 and duplicate UYVY ?

You may check your sensor driver.

NV16 and UYVY are not set in imx390 sensor driver

sg_imx390.c.txt (9.0 KB)

Then it could be the device tree problem.

gmsl.dts.txt (30.4 KB)

How to check dts ?

Dump the device tree to confirm.

sudo dtc -I fs -O dts -o extracted_proc.dts /sys/firmware/devicetree/base

extracted_proc.dts.txt (353.7 KB)

Looks like without problem.

Could you remove the mode_type to try.

remove the mode_type and /dev/videoX is null

nvidia@tegra-ubuntu:~$ ls /dev/video*
ls: cannot access '/dev/video*': No such file or directory

OK, roll back the mode_type and remove the use_sensor_mode_id and dynamic_pixel_bit_depth to try. If still unable to remove you may check trace the ../drivers/media/platform/tegra/camera/* to confirm the color formats report. Otherwise check the v4l2src code to figure out the error.

../sys/v4l2/gstv4l2object.c(4399): gst_v4l2_object_set_format_full (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Call to TRY_FMT failed for UYVY @ 1920x1080: Invalid argument
Execution ended after 0:00:00.000295455

kernel-noble/drivers/media/v4l2-core/v4l2-ioctl.c

ret = ops->vidioc_try_fmt_vid_cap(file, fh, arg);

vidioc_try_fmt_vid_cap return failure

also,

static int
__tegra_channel_try_format(struct tegra_channel *chan,
                        struct v4l2_pix_format *pix)
{
        const struct tegra_video_format *vfmt;
        struct v4l2_subdev_format fmt;
        struct v4l2_subdev *sd = chan->subdev_on_csi;
        struct v4l2_subdev_pad_config pad_cfg;
        struct v4l2_subdev_state cfg = {.pads = &pad_cfg};
        int ret = 0;

        /* Use the channel format if pixformat is not supported */
        vfmt = tegra_core_get_format_by_fourcc(chan, pix->pixelformat);
        if (!vfmt) {
                pix->pixelformat = chan->format.pixelformat;
                vfmt = tegra_core_get_format_by_fourcc(chan, pix->pixelformat);
                if (!vfmt)
                        return -EINVAL;
        }

        fmt.which = V4L2_SUBDEV_FORMAT_TRY;
        fmt.pad = 0;
        v4l2_fill_mbus_format(&fmt.format, pix, vfmt->code);

        ret = v4l2_subdev_call(sd, pad, set_fmt, &cfg, &fmt);
        if (ret == -ENOIOCTLCMD)
                return -ENOTTY;

        v4l2_fill_pix_format(pix, &fmt.format);

        tegra_channel_fmt_align(chan, vfmt,
                                &pix->width, &pix->height, &pix->bytesperline);
        pix->sizeimage = get_aligned_buffer_size(chan,
                        pix->bytesperline, pix->height);
        if (chan->fmtinfo->fourcc == V4L2_PIX_FMT_NV16)
                pix->sizeimage *= 2;

        return ret;
}

v4l2_subdev_call return -22