Hi, I am trying to capture frames from a CSI camera on Jetson Xavier NX (32.4.4). The driver is able to recognise the camera and /dev/video0 is created.
However when I try to capture frames or view the camera stream, I get the following errors on dmesg.
[22037.075692] tegra194-vi5 15c10000.vi: vi_capture_setup: control failed, errno 1
[22037.075938] tegra194-vi5 15c10000.vi: vi capture setup failed
[22459.840699] tegra194-vi5 15c10000.vi: vi_capture_setup: control failed, errno 1
[22459.841098] tegra194-vi5 15c10000.vi: vi capture setup failed
I looked up errno 1, and it seems to be CAPTURE_ERROR_INVALID_PARAMETER error.
I get a similar error when I do cat /dev/video0 for instance
cat: /dev/video0: Invalid argument
or when I try to stream using v4l2-ctl I get
VIDIOC_STREAMON: failed: Invalid argument
My questions are:
What is meant by invalid argument/parameter? Is it something that I have specified wrongly on the device tree for instance?
How can I find out which argument/parameter is invalid? Is there a way to get more information from the logs?
I am attaching the trace log as well as full dmesg log (sensor is ov2311). nx-dmesg-cam1.txt (62.6 KB) tracelog.txt (59.5 KB)
P.S There is no issue with the camera hardware as it works fine on a jetson nano.
[ 10.679213] ov2311 10-004a: ov2311_probe[3519]:GPIO reset Fail, err:0
[ 10.679433] ov2311: probe of 10-004a failed with error -22
[ 10.679585] RESET = fffffdfb
[ 10.679592] ar0234 9-0042: Unable to toggle RESET GPIO
[ 10.679714] ar0234: probe of 9-0042 failed with error -22
[ 10.679805] RESET = fffffdfb
[ 10.679810] ar0234 10-0042: Unable to toggle RESET GPIO
[ 10.679960] ar0234: probe of 10-0042 failed with error -22
please review your device tree definition, you should check whether you’re using GPIO control correctly.
you may also check Sensor Software Driver Programming to review your driver implementation,
thanks
Hi @JerryChang those messages are because ov2311 is actually connected to 09-004a and ar0234 is not connected at all. If you look again you will find the following messages.
[ 10.511840] ISP Already Initialized !!
[ 10.634638] mcu_cam_stream_off 2773MCU Stream Off Success !!
[ 10.671741] Menu Element 0 : Full FOV Auto Mode
[ 10.671749] Menu Element 1 : Manual Mode
[ 10.671761] 0. Initialized Custom Ctrl 0x009a0901 - Exposure, Auto
[ 10.671768] 1. Initialized Control 0x009a0902 - Exposure Time, Absolute
[ 10.671794] 2. Initialized Control 0x00980913 - Gain
[ 10.677521] 3. Initialized Custom Ctrl 0x009a0930 - Brightness
[ 10.677578] 4. Initialized Custom Ctrl 0x009a0932 - Set calibration data
[ 10.677609] 5. Initialized Custom Ctrl 0x009a0931 - Get calibration data
[ 10.677614] 6. Initialized Custom Ctrl 0x009a0933 - Verify calibration data
[ 10.677618] 7. Initialized Custom Ctrl 0x009a0934 - Tara Present
[ 10.677622] 8. Initialized Custom Ctrl 0x009a0935 - Tara password
[ 10.677628] 9. Initialized Custom Ctrl 0x009a0936 - Tara Unique ID
[ 10.677634] 10. Initialized Custom Ctrl 0x009a0937 - Tara Get FW version
[ 10.677644] tegra194-vi5 15c10000.vi: subdev ov2311 9-004a bound
[ 10.679003] ov2311 9-004a: Detected OV2311 Sensor
Here is the output of v4l2-compliance:
v4l2-compliance SHA : not available
Driver Info:
Driver name : tegra-video
Card type : vi-output, ov2311 9-004a
Bus info : platform:15c10000.vi:0
Driver version: 4.9.140
Capabilities : 0x84200001
Video Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Compliance test for device /dev/video0 (not using libv4l2):
Required ioctls:
test VIDIOC_QUERYCAP: OK
Allow for multiple opens:
test second video open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK
Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
test VIDIOC_LOG_STATUS: OK
Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 1 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_ENUMAUDOUT: OK (Not Supported)
test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
test VIDIOC_G/S_EDID: OK (Not Supported)
Test input 0:
Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 13 Private Controls: 12
Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
test VIDIOC_G/S_PARM: OK
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)
Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
test VIDIOC_G_ENC_INDEX: OK (Not Supported)
test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
test VIDIOC_EXPBUF: OK
Test input 0:
Total: 43, Succeeded: 43, Failed: 0, Warnings: 0
As I mentioned the camera is getting detected and /dev/video0 is being created. I can even use v4l2 to change exposure and gain for instance. The only issue I am facing is that I cant stream any images.
There must be some issue with the driver, but I dont know where to look until I understand what “Invalid argument/parameter” actually means. Could you point me to the right direction?
besides, your port binding and the sensor registration were corrects to enable v4l controls.
the properties of tegra-camera-platform{} were used by top-level drivers, please check the reference driver and examine those settings.
for example,
please check v4l to report sensor formats, i.e. $ v4l2-ctl --list-formats
could you please also check you have pixelformat=GREY implemented in the low level driver side.
for example, $L4T_Sources/r32.6.1/Linux_for_Tegra/source/public/kernel/nvidia/drivers/media/platform/tegra/camera/vi/camera_common.c
Where can I find more information on what this function does?
I figured that it further calls vi_capture_setup from capture.c. It seems like this function tries to setup the vi channel with some settings before images can be streamed, but I am not sure where these settings come from. Could you help me with some more information?
it’ll parse device tree properties to register the camera devices.
please review those CID controls,
you may also add some debug message to check which control caused the failure.
for example, TEGRA_CAMERA_CID_GAIN TEGRA_CAMERA_CID_FRAME_RATE TEGRA_CAMERA_CID_EXPOSURE TEGRA_CAMERA_CID_EXPOSURE_SHORT
there also the commands to enable dynamic debug flag,
you could follow below to enable dev_dbg for the specific files.
for example, capture.c # cd /sys/kernel/debug/dynamic_debug/ # echo file capture.c +p > control
@JerryChang Thanks for these suggestions. I would actually like to add some debug messages to figure out which control is causing failure, but I am not able to figure out WHERE I should add them. I am relatively new to driver programming.
you may either enable debug logs for capture.c or adding debug message to check which function call return failures.
note,
you should check /boot/extlinux/extlinux.conf, the kernel image is by default loading via LINUX entry, you may replace your own compile image with that, reboot the system to make changes applied.
thanks