csi camera issue on nvcamerasrc and argus

Hi,there
We have successfully attach ar0144 to tx2 and get raw output from /dev/video0,
using v4l2-ctl could get single and multiple raw frames which seems correct, however,
if we run libargus APIs
'gst-launch-1.0 nvarguscamerasrc num-buffers=30 ‘video/x-raw(memory:NVMM),width=1280,height=720, framerate=30/1,format=NV12’ ! omxh264env ! filesink location=test.mp4 e ’

following error logs happened.
And for nvcamerasrc , the same issue happened.
So would like to know if there is any document on how these API interaction with drivers or any
debugging tips ?

[   87.447524] ar0144 2-0018: camera_common_dpd_enable: csi 1
[   87.453010] ar0144 2-0018: camera_common_mclk_disable: disable MCLK
[   87.459500] ar0144 2-0010: camera_common_mclk_enable: enable MCLK with 27000000 Hz
[   87.467284] ar0144 2-0010: camera_common_dpd_disable: csi 0
[   87.472857] ar0144 2-0010: ar0144_power_on: power on
[   87.477832] ar0144 2-0010: ar0144_power_off: power off
[   87.482977] ar0144 2-0010: camera_common_dpd_enable: csi 0
[   87.488463] ar0144 2-0010: camera_common_mclk_disable: disable MCLK
Error generated. /dvs/git/dirty/[   87.499577] argus_daemon[1895]: unhandled level 2 translation fault (11) at 0x00000008, esr 0x92000006
git-master_linux/multime[   87.511527] pgd = ffffffc079df4000
dia/nvgstreamer/gst-nvarguscamer[   87.517016] [00000008] *pgd=000000025851f003a/gstnvarguscamerasrc.cp, *pud=000000025851f003p, execute:364 No camera, *pmd=0000000000000000s availa
ble
[   87.532867] 
[   87.534814] CPU: 4 PID: 1895 Comm: argus_daemon Not tainted 4.4.38+ #1
[   87.541354] Hardware name: quill (DT)
[   87.545036] task: ffffffc1bb049900 ti: ffffffc1bb084000 task.ti: ffffffc1bb084000
[   87.552526] PC is at 0x7f7d4dfc34
[   87.555843] LR is at 0x7f7d4dfc30
[   87.559165] pc : [<0000007f7d4dfc34>] lr : [<0000007f7d4dfc30>] pstate: 60000000
[   87.566556] sp : 0000007f7b0ee7b0
[   87.569864] x29: 0000007f7b0ee9d0 x28: 0000007f7b0ef1e0 
[   87.575203] x27: 0000007f7d4f2f48 x26: 000000000043f090 
[   87.580532] x25: 0000007f7b0ee938 x24: 0000000000000068 
[   87.585868] x23: 0000000000000000 x22: 0000000000000068 
[   87.591206] x21: 0000007f746cc4c8 x20: 0000007f746cc4c0 
[   87.596539] x19: 0000007f746cc4c0 x18: 0000007f7c7a6610 
[   87.601871] x17: 0000007f7d337290 x16: 0000007f7d52bfa8 
[   87.607210] x15: 0000007f7d58e000 x14: ffffffffffffffff 
[   87.612542] x13: 0000000000000028 x12: 0101010101010101 
[   87.617875] x11: 7f7f7f7f7f7f7f7f x10: 65736d68716f6575 
[   87.623212] x9 : 7f7f7f7f7f7f7f7f x8 : 8080800000000000 
[   87.628545] x7 : 0000000000808080 x6 : 0000000000437c05 
[   87.633878] x5 : 0000000000000000 x4 : 0000000000000000 
[   87.639214] x3 : 0000007f7b0ef8d0 x2 : 0000007f7b0ef1e0 
[   87.644545] x1 : 0000000000000000 x0 : 0000000000000000 
[   87.649875] 
[   87.651378] Library at 0x7f7d4dfc34: 0x7f7d433000 /usr/lib/aarch64-linux-gnu/tegra/libargus_socketserver.so
[   87.661111] Library at 0x7f7d4dfc30: 0x7f7d433000 /usr/lib/aarch64-linux-gnu/tegra/libargus_socketserver.so
[   87.670845] vdso base = 0x7f7d58d000
(Argus) Error EndOfFile: Unexpected error in reading socket (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadCore(), line 214)
(Argus) Error EndOfFile: Receive worker failure, notifying 1 waiting threads (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadCore(), line 289)
(Argus) Error InvalidState: Argus client is exiting with 1 outstanding client threads (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadCore(), line 306)
(Argus) Error EndOfFile: Receiving thread terminated with error (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadWrapper(), line 317)
(Argus) Error EndOfFile: Client thread received an error from socket (in src/rpc/socket/client/ClientSocketManager.cpp, function send(), line 149)
(Argus) Error EndOfFile:  (propagating from src/rpc/socket/client/SocketClientDispatch.cpp, function dispatch(), line 101)

You need to check all of the item is correct in the tegra-platform-camera in your device tree.

Did you mean this part ?

tegra-camera-platform {
compatible = “nvidia, tegra-camera-platform”;
/**
* Physical settings to calculate max ISO BW
*
* num_csi_lanes = <>;
* Total number of CSI lanes when all cameras are active
*
* max_lane_speed = <>;
* Max lane speed in Kbit/s
*
* min_bits_per_pixel = <>;
* Min bits per pixel
*
* vi_peak_byte_per_pixel = <>;
* Max byte per pixel for the VI ISO case
*
* vi_bw_margin_pct = <>;
* Vi bandwidth margin in percentage
*
* max_pixel_rate = <>;
* Max pixel rate in Kpixel/s for the ISP ISO case
*
* isp_peak_byte_per_pixel = <>;
* Max byte per pixel for the ISP ISO case
*
* isp_bw_margin_pct = <>;
* Isp bandwidth margin in percentage
*/
num_csi_lanes = <3>;
max_lane_speed = <1500000>;
min_bits_per_pixel = <12>;
vi_peak_byte_per_pixel = <2>;
vi_bw_margin_pct = <25>;
isp_peak_byte_per_pixel = <5>;
isp_bw_margin_pct = <25>;

	/**
	* The general guideline for naming badge_info contains 3 parts, and is as follows,
	* The first part is the camera_board_id for the module; if the module is in a FFD
	* platform, then use the platform name for this part.
	* The second part contains the position of the module, ex. “rear” or “front”.
	* The third part contains the last 6 characters of a part number which is found
	* in the module's specsheet from the vender.
	*/
	modules {
		module0 {
			badge = "e3326_front_P5V27C";
			position = "rear";
			orientation = "1";
			drivernode0 {
				/* Declare PCL support driver (classically known as guid)  */
				pcl_id = "v4l2_sensor";
				/* Driver v4l2 device name */
				devname = "ar0144 2-0010";
				/* Declare the device-tree hierarchy to driver instance */
				proc-device-tree = "/proc/device-tree/i2c@3180000/ar0144_a@10";
			};
			drivernode1 {
				/* Declare PCL support driver (classically known as guid)  */
				pcl_id = "v4l2_sensor";
				/* Driver v4l2 device name */
				devname = "ar0144 2-0018";
				/* Declare the device-tree hierarchy to driver instance */
				proc-device-tree = "/proc/device-tree/i2c@3180000/ar0144_b@18";
			};
			drivernode2 {
				/* Declare PCL support driver (classically known as guid)  */
				pcl_id = "v4l2_sensor";
				/* Driver v4l2 device name */
				devname = "ar0144 7-0018";
				/* Declare the device-tree hierarchy to driver instance */
				proc-device-tree = "/proc/device-tree/i2c@c250000/ar0144_c@18";
			};
			drivernode3 {
				/* Declare PCL support driver (classically known as guid)  */
				pcl_id = "v4l2_lens";
				proc-device-tree = "/proc/device-tree/e3326_lens_ov5693@P5V27C/";
			};
		};
	};
  1. Checking device tree seems nothing found, values are in same manner as reference files.
  2. added logs in tegra-camera-platform.c , all functions behaves normal and no errors.
  3. After setEnableCamPclLogs=1 , Get following logs

OFParserGetVirtualDevice: NVIDIA Camera virtual enumerator not found in proc device-tree
NvPclDriverInitializeData: Unable to initialize driver v4l2_sensor
NvPclInitializeDrivers: error: Failed to init camera sub module v4l2_sensor

Can you help to understand what is this camera virtual enumerator ? what driver node it depends ? and how initializate process to get v4l2_sensor , it will great helpful for us what is going wrong.
Thanks.

OFParserGetVirtualDevice: NVIDIA Camera virtual enumerator not found in proc device-tree
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/e3326_front_P5V27C.isp] 6/16LoadOverridesFile: looking for override file [/opt/nvidia/nvcam/settings/e3326_front_P5V27C.isp] 7/16LoadOverridesFile: looking for override file [/var/nvidia/nvcam/settings/e3326_front_P5V27C.isp] 8/16---- imager: No override file found. ----
(NvOdmDevice) Error ModuleNotPresent: V4L2Device not available (in dvs/git/dirty/git-master_linux/camera-partner/imager/src/V4L2Device.cpp, function findDevice(), line 245)
(NvOdmDevice) Error ModuleNotPresent:  (propagating from dvs/git/dirty/git-master_linux/camera-partner/imager/src/V4L2Device.cpp, function initialize(), line 55)
(NvOdmDevice) Error ModuleNotPresent:  (propagating from dvs/git/dirty/git-master_linux/camera-partner/imager/src/devices/V4L2SensorViCsi.cpp, function initialize(), line 103)
NvPclDriverInitializeData: Unable to initialize driver v4l2_sensor
NvPclInitializeDrivers: error: Failed to init camera sub module v4l2_sensor
NvPclStartPlatformDrivers: Failed to start module drivers
NvPclDriver_V4L2_Sensor_Close: Invalid NULL input pPclDriver
NvPclDriver_V4L2_Sensor_Close: Invalid NULL input pPclDriver
NvPclDriver_V4L2_Focuser_Stub_Close: Invalid NULL input pPclDriver
NvPclStateControllerOpen: Failed ImagerGUID 0. (error 0xA000E)
NvPclOpen: PCL Open Failed. Error: 0xf
SCF: Error BadParameter: Sensor could not be opened. (in src/services/capture/CaptureServiceDeviceSensor.cpp, function getSourceFromGuid(), line 598)
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)
Socket read error. Camera Daemon stopped functioning.....
gst_nvcamera_open() failed ret=0
ERROR: Pipeline doesn't want to pause.

Check the /proc/device-tree/tegra-camera-platform is exactly the same with your DT file.

Yes, there is exact the same values in /proc file system

So do you mean the NvPclOpen only search this proc path and find the sensor ?

Does the name and devname in the /proc/device-tree/tegra-camera-platform/modules/module0/drivernode0 correct?

The name and devnames matches what in dts. Not sure what do you mean correct ? Or it shall be something
like “ar0144_a” ? I just follow the reference one .

nvidia@tegra-ubuntu:/proc/device-tree/tegra-camera-platform/modules/module0/driveernode0$ cat name
drivernode0

nvidia@tegra-ubuntu:/proc/device-tree/tegra-camera-platform/modules/module0/driveernode0$ cat name
drivernode0\0x00
nvidia@tegra-ubuntu:/proc/device-tree/tegra-camera-platform/modules/module0/driveernode0$ cat devname
ar0144 2-0010\0x00

x00
nvidia@tegra-ubuntu:/proc/device-tree/tegra-camera-platform/modules/module0/driveernode0$ cat devname
ar0144 2-0010

nvidia@tegra-ubuntu:/proc/device-tree/tegra-camera-platform/modules/module0/driveernode0$ cat name
drivernode0\0x00
nvidia@tegra-ubuntu:/proc/device-tree/tegra-camera-platform/modules/module0/driveernode0$ cat devname
ar0144 2-0010\0x00

x00

How much device connect to Tegra?

Your DT define is not correct. Remove below if you only have one device connected. If you have 4 you have need have 4 modules for each drivernode.

drivernode2 {
/* Declare PCL support driver (classically known as guid) */
pcl_id = "v4l2_sensor";
/* Driver v4l2 device name */
devname = "ar0144 7-0018";
/* Declare the device-tree hierarchy to driver instance */
proc-device-tree = "/proc/device-tree/i2c@c250000/ar0144_c@18";
};
drivernode3 {
/* Declare PCL support driver (classically known as guid) */
pcl_id = "v4l2_lens";
proc-device-tree = "/proc/device-tree/e3326_lens_ov5693@P5V27C/";
};

Yes, I figured out that, and now the sensor could be detected, sorry my previous account is locked and I cannot login with that account and accept the answer.
And now I face the PXL_SOF issue on
https://devtalk.nvidia.com/default/topic/1035898/jetson-tx2/tx2-camera-mipi-timing-and-pxl_sof/ ,
Can you help to answer