Gst-launch-1.0 cannot access camera

Hi, I am testing a carrier board for Xavier NX. The carrier board can support 4 MIPI cameras. I am using IMX-219 sensor for this test. I can capture raw image with the following v4l2-ctl command. The raw image can be re-played with GIMP in grey scale. The command, its output and syslog are listed below:

$ v4l2-ctl --verbose -d /dev/video0 --set-fmt-video=width=920,height=1080,pixelformat=RG10, --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=v4l2-test.raw
VIDIOC_QUERYCAP: ok
VIDIOC_S_EXT_CTRLS: ok
VIDIOC_G_FMT: ok
VIDIOC_S_FMT: ok
Format Video Capture:
        Width/Height      : 3264/2464
        Pixel Format      : 'RG10'
        Field             : None
        Bytes per Line    : 6528
        Size Image        : 16084992
        Colorspace        : sRGB
        Transfer Function : Default (maps to sRGB)
        YCbCr/HSV Encoding: Default (maps to ITU-R 601)
        Quantization      : Default (maps to Full Range)
        Flags             :
VIDIOC_REQBUFS: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_STREAMON: ok
        Index    : 0
        Type     : Video Capture
        Flags    : mapped
        Field    : None
        Sequence : 0
        Length   : 16084992
        Bytesused: 16084992
        Timestamp: 2141.835913s (Monotonic, End-of-Frame)

VIDIOC_STREAMOFF: ok

===syslog====
Jul 21 13:27:01 procerus-desktop [9048]: LMPT v4l2 test: ## Starting ##
Jul 21 13:27:01 procerus-desktop kernel: [ 2137.458991] [RCE] vi5_hwinit: firmware CL2018101701 protocol version 2.2

However, when I use gst-lunch-1.0 for video streaming, I hit error:

$ gst-launch-1.0 -v v4l2src num-buffers=200 device=/dev/video0 ! 'video/x-raw, width=1280, height=720, frame-rate=30/1' ! nvvidconv ! nvv4l2h264enc ! filesink location=gst-v4l2-test.raw -ev
Setting pipeline to PAUSED ...
Opening in BLOCKING MODE
Pipeline is live and does not need PREROLL ...
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

I also tried nvargus library with gst-lunch-1.0, also encountered error:

$ gst-launch-1.0 -v nvarguscamerasrc sensor-id=0 num-buffers=200 ! 'video/x-raw(memory:NVMM),width=1280,height=720,framerate=30/1, formate=NV12' ! nvvidconv ! nvv4l2h264enc ! filesink location=argus-test.mp4 -e
Setting pipeline to PAUSED ...
Opening in BLOCKING MODE
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:725 No cameras available
/GstPipeline:pipeline0/GstNvArgusCameraSrc:nvarguscamerasrc0.GstPad:src: caps = video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)NV12, framerate=(fraction)30/1, formate=(string)NV12
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)NV12, framerate=(fraction)30/1, formate=(string)NV12
/GstPipeline:pipeline0/Gstnvvconv:nvvconv0.GstPad:src: caps = video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)NV12, framerate=(fraction)30/1, formate=(string)NV12
/GstPipeline:pipeline0/nvv4l2h264enc:nvv4l2h264enc0.GstPad:src: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, profile=(string)NULL, level=(string)NULL, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2
/GstPipeline:pipeline0/GstFileSink:filesink0.GstPad:sink: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, profile=(string)NULL, level=(string)NULL, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2
Redistribute latency...
NvMMLiteOpen : Block : BlockType = 4
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
/GstPipeline:pipeline0/nvv4l2h264enc:nvv4l2h264enc0.GstPad:sink: caps = video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)NV12, framerate=(fraction)30/1, formate=(string)NV12
/GstPipeline:pipeline0/Gstnvvconv:nvvconv0.GstPad:sink: caps = video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)NV12, framerate=(fraction)30/1, formate=(string)NV12
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)NV12, framerate=(fraction)30/1, formate=(string)NV12
Got EOS from element "pipeline0".
Execution ended after 0:00:00.018481376
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

===syslog===
Jul 21 13:00:11 procerus-desktop [8797]: LMPT test camera gst nvargus: ## Starting ##
Jul 21 13:00:11 procerus-desktop kernel: [  527.853165] [RCE] WARNING: t194/isp5.c:901 [config_channel] "All error notifications not enabled: correctable=0x00 uncorrectable=0x00"
Jul 21 13:00:11 procerus-desktop nvargus-daemon[5995]: === NVIDIA Libargus Camera Service (0.98.3)=== Listening for connections...=== gst-launch-1.0[8798]: Connection established (7F924C91D0)OFParserListModules: module list: /proc/device-tree/tegra-camera-platform/modules/module0
Jul 21 13:00:11 procerus-desktop nvargus-daemon[5995]: OFParserEnumerateDriverNode: v4l2_sensor: failed to parse device-tree to driver node
Jul 21 13:00:11 procerus-desktop nvargus-daemon[5995]: NvPclHwGetModuleList: No module data found
Jul 21 13:00:11 procerus-desktop nvargus-daemon[5995]: OFParserGetVirtualDevice: NVIDIA Camera virtual enumerator not found in proc device-tree
Jul 21 13:00:11 procerus-desktop nvargus-daemon[5995]: ---- imager: No override file found. ----
Jul 21 13:00:11 procerus-desktop nvargus-daemon[5995]: (NvOdmDevice) Error NotInitialized: hDev Table not initialized (in dvs/git/dirty/git-master_linux/camera-partner/imager/src/devices/V4L2SensorViCsi.cpp, function initialize(), line 97)
Jul 21 13:00:11 procerus-desktop nvargus-daemon[5995]: NvPclDriverInitializeData: Unable to initialize driver v4l2_sensor
Jul 21 13:00:11 procerus-desktop nvargus-daemon[5995]: NvPclInitializeDrivers: error: Failed to init camera sub module v4l2_sensor
Jul 21 13:00:11 procerus-desktop nvargus-daemon[5995]: NvPclStartPlatformDrivers: Failed to start module drivers
Jul 21 13:00:11 procerus-desktop nvargus-daemon[5995]: NvPclStateControllerOpen: Failed ImagerGUID 0. (error 0x3)
Jul 21 13:00:11 procerus-desktop nvargus-daemon[5995]: NvPclOpen: PCL Open Failed. Error: 0xf
Jul 21 13:00:11 procerus-desktop nvargus-daemon[5995]: SCF: Error BadParameter: Sensor could not be opened. (in src/services/capture/CaptureServiceDeviceSensor.cpp, function getSourceFromGuid(), line 582)
Jul 21 13:00:11 procerus-desktop nvargus-daemon[5995]: SCF: Error BadParameter:  (propagating from src/services/capture/CaptureService.cpp, function addSourceByGuid(), line 437)
Jul 21 13:00:11 procerus-desktop nvargus-daemon[5995]: SCF: Error BadParameter:  (propagating from src/api/CameraDriver.cpp, function addSourceByIndex(), line 305)
Jul 21 13:00:11 procerus-desktop nvargus-daemon[5995]: SCF: Error BadParameter:  (propagating from src/api/CameraDriver.cpp, function getSource(), line 471)
Jul 21 13:01:49 procerus-desktop systemd[1]: Started Run anacron jobs.
Jul 21 13:01:49 procerus-desktop anacron[8860]: Anacron 2.3 started on 2021-07-21
Jul 21 13:01:49 procerus-desktop anacron[8860]: Normal exit (0 jobs run)

This problem has blocked me for about 3 weeks. I think I may miss some parameters in device tree. But I don’t have the source code of the libraries and debugging tool. I have compared many device tree and tried everything, But no lucky. Can anyone provide a help for the problem? Thanks for your attention.
I upload the device tree files here.
tegra194-camera-imx219-lmpt.dtsi (31.7 KB)
tegra194-camera-imx219-lmpt-jakku.dtsi (3.7 KB)
tegra194-p3509-0000-a00.dtsi (5 KB)
tegra194-p3668-all-p3509-0000-camera-imx219-dual.dts (4.5 KB)

Hi,
So you are bringing up imx219 on your custom board? By default Raspverry Pi camera v2 works with Xavier developer kit. If you use developer kit, you can consider to get the camera and try.

Yes I am bring up IMX219 on my custom board. But I am not using the develop kit, though the camera works on the develop kit. Can you provide a specific tip based on the error message in the syslog?

Does the camera connect to the same i2c bus?
Dump the device tree by dtc to confirm the context of tegra-camera-platform{}
Also may need v4l2-ctl --all to confirm the I2C bus

sudo dtc -I fs -O dts -o extracted_proc.dts /proc/device-tree

@ShaneCCC thanks for the tip. We fixed the problem today. The problem was the lens_ node under tegra_camera_platform misconfigured.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.