nvidia tx2 nvcamerasrc error

Hi,

We have developed a camera driver on tx2, and the camera output format is RAW10, so I want to use gstreamer plugin nvcamerasrc, the cmd as follows:

gst-launch-1.0 --gst-debug=nvcamerasrc:9 --gst-debug-level=4 nvcamerasrc num-buffers=1 ! 'video/x-raw(memory:NVMM), width=(int)4096, height=(int)3072,format=(string)I420, framerate=(fraction)30/1' ! nvvidconv ! 'video/x-raw, format=(string)I420, framerate=(fraction)30/1' ! filesink location='camera.yuv'

kernel error message:

nvidia@tegra-ubuntu:~$ 
nvidia@tegra-ubuntu:~$ [  367.316270] nvcamera-daemon[1709]: unhandled level 2 translation fault (11) at 0x00000000, esr 0x92000006
[  367.325892] pgd = ffffffc1e2726000
[  367.329334] [00000000] *pgd=000000025910b003, *pud=000000025910b003, *pmd=0000000000000000
[  367.337695] 
[  367.339203] CPU: 4 PID: 1709 Comm: nvcamera-daemon Not tainted 4.4.38+ #53
[  367.346088] Hardware name: quill (DT)
[  367.349774] task: ffffffc1d3dbf080 ti: ffffffc1ec158000 task.ti: ffffffc1ec158000
[  367.357272] PC is at 0x402efc
[  367.360259] LR is at 0x402ef8
[  367.363230] pc : [<0000000000402efc>] lr : [<0000000000402ef8>] pstate: 60000000
[  367.370620] sp : 0000007f9fda12d0
[  367.373935] x29: 0000007f9fda59d0 x28: 0000000000000000 
[  367.379269] x27: 0000000000000003 x26: 0000007f9fda5340 
[  367.384600] x25: 0000000000404000 x24: 0000000000000334 
[  367.389929] x23: 0000007f9fda3340 x22: 0000007f9fda2340 
[  367.395261] x21: 0000007f9fda3264 x20: 0000007f9fda1350 
[  367.400592] x19: 0000007f9fda3950 x18: 0000000000000014 
[  367.405922] x17: 0000007fa1616fb0 x16: 0000007fa136b540 
[  367.411257] x15: 0000007fa200c000 x14: 7265766972446172 
[  367.416587] x13: 656d61432f697061 x12: 2f637273206d6f72 
[  367.421918] x11: 6620676e69746167 x10: 61706f7270282020 
[  367.427254] x9 : 3a726574656d6172 x8 : 0000000000000040 
[  367.432582] x7 : 0000007f986b3290 x6 : 0000000000000001 
[  367.437912] x5 : 0000000000000000 x4 : 0000007f98000b10 
[  367.443245] x3 : 0000000000000000 x2 : 0000000000000001 
[  367.448574] x1 : 0000000000000000 x0 : 0000000000000000 
[  367.453902] 
[  367.455400] Library at 0x402efc: 0x400000 /usr/sbin/nvcamera-daemon
[  367.461663] Library at 0x402ef8: 0x400000 /usr/sbin/nvcamera-daemon
[  367.467926] vdso base = 0x7fa200b000

gstreamer debug message:

0:00:17.590800288  1707       0x428520 DEBUG            nvcamerasrc gstnvcamerasrc.cpp:3219:gst_nvcamerasrc_start:<nvcamerasrc0> start
0:00:17.590819360  1707       0x428520 ERROR            nvcamerasrc gstnvcamerasrc.cpp:2336:gst_nvcamera_open:<nvcamerasrc0> REQ_NVCAM_CREATE_SESSION to camera_daemon failed

gst_nvcamera_open() failed ret=0
0:00:17.590839488  1707       0x428520 WARN                 basesrc gstbasesrc.c:3353:gst_base_src_start:<nvcamerasrc0> error: Failed to start
0:00:17.590892960  1707       0x428520 INFO        GST_ERROR_SYSTEM gstelement.c:1881:gst_element_message_full:<nvcamerasrc0> posting message: GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failure.
0:00:17.590950688  1707       0x428520 INFO        GST_ERROR_SYSTEM gstelement.c:1904:gst_element_message_full:<nvcamerasrc0> posted error message: GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failure.
0:00:17.590972800  1707       0x428520 WARN                 basesrc gstbasesrc.c:3724:gst_base_src_activate_push:<nvcamerasrc0> Failed to start in push mode
0:00:17.590983200  1707       0x428520 INFO                GST_PADS gstpad.c:1237:activate_mode_internal:<nvcamerasrc0:src> failed to activate in push mode
0:00:17.590996864  1707       0x428520 WARN                GST_PADS gstpad.c:1106:gst_pad_set_active:<nvcamerasrc0:src> Failed to activate pad

If we want to use this plugin, what should we do?

thanks

@cloundliu
Below pipeline is no problem for me on TX1 with reference sensor ov5693.
If your sensor is output raw sensor the “format=(string)I420” is incorrect.

gst-launch-1.0 nvcamerasrc num-buffers=1 ! nvvidconv ! 'video/x-raw, format=(string)I420, framerate=(fraction)30/1' ! filesink location='camera.yuv'

@ShaneCCC

I have tried the pipeline you supplied, but it failed, the error still as before.
I can use v4l2src and v4l2-ctl to capture raw image, and the image is right.
Generally speaking, my camera output raw10 image, and the same as ov5693.

0:00:17.590800288  1707       0x428520 DEBUG            nvcamerasrc gstnvcamerasrc.cpp:3219:gst_nvcamerasrc_start:<nvcamerasrc0> start
0:00:17.590819360  1707       0x428520 ERROR            nvcamerasrc gstnvcamerasrc.cpp:2336:gst_nvcamera_open:<nvcamerasrc0> REQ_NVCAM_CREATE_SESSION to camera_daemon failed
gst_nvcamera_open() failed ret=0

Could you check code about plugin nvcamerasrc??

thanks

@cloundliu
Follow this link https://elinux.org/Jetson_TX2/28.1_Camera_BringUp
To enable logs from user-space for more details

@ShaneCCC

nvcamera-daemon output as follows:

root@tegra-ubuntu:/home/nvidia# /usr/sbin/nvcamera-daemon
NvPclHwGetModuleList: WARNING: Could not map module to ISP config string
NvPclHwGetModuleList: No module data found
NvPclHwGetModuleList: WARNING: Could not map module to ISP config string
NvPclHwGetModuleList: No module data found
NvPclHwGetModuleList: WARNING: Could not map module to ISP config string
NvPclHwGetModuleList: No module data found
PCLHW_DTParser
PCLHW_DTParser
LoadOverridesFile: looking for override file [/Calib/camera_override.isp] 1/16LoadOverridesFile: looking for override file [/data/nvcam/settings/camera_overrides.isp] 2/16LoadOverridesFile: looking for override file [/opt/nvidia/nvcam/settings/camera_overrides.isp] 3/16LoadOverridesFile: looking for override file [/var/nvidia/nvcam/settings/camera_overrides.isp] 4/16LoadOverridesFile: looking for override file [/data/nvcam/camera_overrides.isp] 5/16LoadOverridesFile: looking for override file [/data/nvcam/settings/hl_front_P5V27C2.isp] 6/16LoadOverridesFile: looking for override file [/opt/nvidia/nvcam/settings/hl_front_P5V27C2.isp] 7/16LoadOverridesFile: looking for override file [/var/nvidia/nvcam/settings/hl_front_P5V27C2.isp] 8/16---- imager: No override file found. ----
checkDriverVersion: Mixed or missing V4L2 controls!
checkDriverVersion: Make sure your kernel driver implements either
checkDriverVersion: V4L2_m_cidFrameLength + V4L2_m_cidCoarseTime(_SHORT)
checkDriverVersion:      or  
checkDriverVersion: V4L2_m_cidFrameRate + V4L2_m_cidExposure
(NvOdmDevice) Error BadParameter:  (in dvs/git/dirty/git-master_linux/camera-partner/imager/src/devices/V4L2SensorViCsi.cpp, function checkDriverVersion(), line 379)
(NvOdmDevice) Error BadParameter:  (propagating from dvs/git/dirty/git-master_linux/camera-partner/imager/src/devices/V4L2SensorViCsi.cpp, function findCustomCids(), line 309)
(NvOdmDevice) Error BadParameter:  (propagating from dvs/git/dirty/git-master_linux/camera-partner/imager/src/devices/V4L2SensorViCsi.cpp, function initializeV4L2Items(), line 232)
(NvOdmDevice) Error BadParameter:  (propagating from dvs/git/dirty/git-master_linux/camera-partner/imager/src/devices/V4L2SensorViCsi.cpp, function initialize(), line 107)
NvPclDriverInitializeData: Unable to initialize driver v4l2_sensor
NvPclInitializeDrivers: error: Failed to init camera sub module v4l2_sensor
NvPclStartPlatformDrivers: Failed to start module drivers
NvPclStateControllerOpen: Failed ImagerGUID 1. (error 0x4)
NvPclOpen: PCL Open Failed. Error: 0xf
SCF: Error BadParameter: Sensor could not be opened. (in src/services/capture/CaptureServiceDeviceSensor.cpp, function getSourceFromGuid(), line 596)
SCF: Error BadParameter:  (propagating from src/services/capture/CaptureService.cpp, function addSourceByGuid(), line 781)
SCF: Error BadParameter:  (propagating from src/api/CameraDriver.cpp, function addSourceByIndex(), line 276)
SCF: Error BadParameter:  (propagating from src/api/CameraDriver.cpp, function getSource(), line 439)
Segmentation fault (core dumped)

@cloundliu
The root cause is below log

checkDriverVersion: Mixed or missing V4L2 controls!
checkDriverVersion: Make sure your kernel driver implements either
checkDriverVersion: V4L2_m_cidFrameLength + V4L2_m_cidCoarseTime(_SHORT)
checkDriverVersion:      or  
checkDriverVersion: V4L2_m_cidFrameRate + V4L2_m_cidExposure

Please check the note. This is from sensor programing guide in the l4t-document.

@ChaneCCC

I have implemented this v4l2 controls, and error message as follows:

root@tegra-ubuntu:/home/nvidia# /usr/sbin/nvcamera-daemon 
NvPclHwGetModuleList: WARNING: Could not map module to ISP config string
NvPclHwGetModuleList: No module data found
NvPclHwGetModuleList: WARNING: Could not map module to ISP config string
NvPclHwGetModuleList: No module data found
NvPclHwGetModuleList: WARNING: Could not map module to ISP config string
NvPclHwGetModuleList: No module data found
PCLHW_DTParser
PCLHW_DTParser
LoadOverridesFile: looking for override file [/Calib/camera_override.isp] 1/16LoadOverridesFile: looking for override file [/data/nvcam/settings/camera_overrides.isp] 2/16LoadOverridesFile: looking for override file [/opt/nvidia/nvcam/settings/camera_overrides.isp] 3/16LoadOverridesFile: looking for override file [/var/nvidia/nvcam/settings/camera_overrides.isp] 4/16LoadOverridesFile: looking for override file [/data/nvcam/camera_overrides.isp] 5/16LoadOverridesFile: looking for override file [/data/nvcam/settings/hl_front_P5V27C2.isp] 6/16LoadOverridesFile: looking for override file [/opt/nvidia/nvcam/settings/hl_front_P5V27C2.isp] 7/16LoadOverridesFile: looking for override file [/var/nvidia/nvcam/settings/hl_front_P5V27C2.isp] 8/16---- imager: No override file found. ----
SCF: Error BadParameter: Unknown sensor pixel type (in src/common/Utils.cpp, function translateColorFormat(), line 403)
SCF: Error BadParameter:  (propagating from src/services/capture/CaptureServiceDeviceSensor.cpp, function open(), line 132)
SCF: Error BadParameter:  (propagating from src/services/capture/CaptureServiceDeviceSensor.cpp, function getSourceFromGuid(), line 593)
SCF: Error BadParameter:  (propagating from src/services/capture/CaptureService.cpp, function addSourceByGuid(), line 781)
SCF: Error BadParameter:  (propagating from src/api/CameraDriver.cpp, function addSourceByIndex(), line 276)
SCF: Error BadParameter:  (propagating from src/api/CameraDriver.cpp, function getSource(), line 439)
Segmentation fault (core dumped)

@cloundliu
Looks like you device tree have problem to look for the source device. Please check your device tree if any missing.

@ShaneCCC

I have checked my device-tree many times, and I can’t find anything missing.

NvPclHwGetModuleList: WARNING: Could not map module to ISP config string
NvPclHwGetModuleList: No module data found

what about the ISP config string mean? where to set it?

looking for override file
where is the override file?

Unknown sensor pixel type
where to set the pixel type?

@cloundliu
You can waive the ISP message. Possible check the run time DT in /proc/device-tree/xxxx/ is as you want.

@ShaneCCC

I think the device tree is what I want, because I can get right raw image through plugin v4l2src.

I just want to use built-in ISP to convert raw10 to rgb, so what should I do if I want to use ISP?

thanks

You can search the forum most this problem is cause the DT not programing well.
Check the document to find what you missed in the device tree.

@ShaneCCC

SCF: Error BadParameter: Unknown sensor pixel type (in src/common/Utils.cpp, function translateColorFormat(), line 403)

what the cause about this error?

What’s the pixel_t define in your DT?

mode0 {
				mclk_khz = "24000";
				num_lanes = "2";
				tegra_sinterface = "serial_e";
				discontinuous_clk = "yes";
				dpcm_enable = "false";
				cil_settletime = "0";

				dynamic_pixel_bit_depth = "12";
				csi_pixel_bit_depth = "12";
				mode_type = "bayer";
				pixel_phase = "rggb";
				pixel_t = "bayer_rggb";

				active_w = "1948";
				active_h = "1096";
				readout_orientation = "0";
				line_length = "2200";
				inherent_gain = "1";
				mclk_multiplier = "25";
				pix_clk_hz = "148500000";

				min_gain_val = "1"; /* dB */
				max_gain_val = "30"; /* dB */
				min_hdr_ratio = "1";
				max_hdr_ratio = "64";
				min_framerate = "3";
				max_framerate = "60";
				min_exp_time = "14.8";
				max_exp_time = "16650";
				embedded_metadata_height = "1";
			};