CSI camera is not working in Jetson tx2i

Hi,
The CSI camera is not working in a custom board based on Jetson Jetson TX2i.
The camera is being recognised as v4l2 device (/dev/video0)

I am getting following error while running the camera-test.py script.

camera-test.py (260 Bytes)

[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (1757) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Internal data stream error.
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (886) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
select timeout
VIDIOC_DQBUF: Resource temporarily unavailable
Traceback (most recent call last):
File “camera-test.py”, line 11, in
cv2.imshow(‘Webcam’, image)
cv2.error: OpenCV(4.1.1) /home/nvidia/host/build_opencv/nv_opencv/modules/highgui/src/window.cpp:352: error: (-215:Assertion failed) size.width>0 && size.height>0 in function ‘imshow’

The same camera works on the EV kit. Is there any issue with custom board . The camera is recognised as v4l2 device so that eliminates the issue with hardware. Can you please help to resolve the issue?
Thanks
Goutam

Have reference to below doc to verify the sensor driver fisr.

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/camera_sensor_prog.html#wwpID0E0LF0HA

https://elinux.org/Jetson_TX2_Camera_BringUp

Hi,
I am getting the following outputs with the following debug commands:
a. v4l2-compliance -d /dev/video0
v4l2-compliance SHA : not available

Driver Info:
Driver name : tegra-video
Card type : vi-output, ov5693 2-0036
Bus info : platform:15700000.vi:2
Driver version: 4.9.201
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: 1 Private Controls: 21

Format ioctls:
	test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
	fail: v4l2-test-formats.cpp(1184): ret && node->has_frmintervals
	test VIDIOC_G/S_PARM: FAIL
	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: 42, Failed: 1, Warnings: 0

b. v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=RG12 --stream-mmap --set-ctrl=sensor_mode=0 --stream-count=100 -d /dev/video0

unknown control ‘sensor_mode’

What does this mean? The same camera works on the EV kit. Can you please help?

Thanks
Goutam

You can remove the --set-ctrl=sensor_mode=0 to verify it if your sensor driver didn’t implement this CID

I tried the following command :
a. elma@elma-desktop:~$ v4l2-ctl --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: ‘BG10’
Name : 10-bit Bayer BGBG/GRGR
Size: Discrete 2592x1944
Interval: Discrete 0.033s (30.000 fps)
Size: Discrete 2592x1458
Interval: Discrete 0.033s (30.000 fps)
Size: Discrete 1280x720
Interval: Discrete 0.008s (120.000 fps)
b. v4l2-ctl --set-fmt-video=width=1280,height=720,pixelformat=BG10 --stream-mmap --stream-count=100 -d /dev/video0
c.
v4l2-ctl --set-fmt-video=width=1280,height=720,pixelformat=RG12 --stream-mmap --stream-count=100 -d /dev/video0
But the device is not responding. What does it mean. I tried various Gstreamer commands as well, but i am not able to capture any frame.
Thanks

Try below command. If v4l2-ctl can’t worked well gst definitely not working.

v4l2-ctl --stream-mmap --stream-count=100 --set-ctrl bypass_mode=0 -d /dev/video0

Hi, There is no response from the camera from below command too.

v4l2-ctl --stream-mmap --stream-count=100 --set-ctrl bypass_mode=0 -d /dev/video0

You may need to enable the debug print of csi2_fops.c to check the status.
DId you ever verify this CSI camera before?

Where is this file located? This camera works well on the EV kit but it doesn’t work on my custom platform though it is recognised as /dev/video0 device.

Then, I think it could be signal or HW issue. You may need HW engineer help to clarify the problem.

ok. What all signals are required for CSI camera driver?
CSI_X_CLK_P
CSI_X_CLK_N
CSI_X_DX_P
CSI_X_DX_N
CAMX_I2C_CLK/SDA
CAMX_RST
CAMX_MCLK
CAMX_PWDN
FLASH_STROBE
FLASH_EN
CAM_VSYNC
all these pins are coming from SOM and is also connected in our custom board. In our custom board, there are some changes in the pin mapping of the GPIO expander. I need help in confirming , which all signals coming from the GPIO expander is being used by the driver? As per my understanding only following three signals are used based on the file tegra186-cvb-prod-p2597-b00-p3489-1000-a00-00.dtsi
CAM_VDD_1V8_EN
CAM_VDD_1V2_EN
CAM_AVDD_CAM_EN
Am i missing some signals ?

Hi @ShaneCCC ,
Any help on the above query will be greatly appreciated. We are stuck in bringing up the CSI camera. Can you please help in understanding which all signals are used by the camera driver files?
Where will I get these details? I am using the same CSI camera provided on the EV kit. If the camera is being recognized as /dev/video0 device , does that not mean that H/W signal connections are ok?
Thanks
Goutam

Hi, from HW side, you need to use an oscilloscope to check if your camera module is initialized correctly and to check the I2C signals/waveforms to make sure the I2C communication/configuration is correct. Also maybe need to check the CSI signals quality.