what's the root cause of new sensor not working with nvcamerasrc

Hi, Shane

I’ve been slowly reconcile our driver with the existing driver. Basically implementing all the needed s_ctrl methods. I also experimented with different pix_clk_hz. Right now when I run my pipeline with nvcamerasrc I got very similar out put with existing driver at the beginning, with extensive logging of tegra vi, csi and channe and nvcamera-daemon. However my pipeline always times out after showing a few LSC:patch height less than 10, this is shown before capture thread step 5 and the capturing timeout after step 6. There also is an Error: waitCsiFrameStart timeout guid 0 later. Attached is my nvcamperasrc verbose logging as well as dmesg logs. Do you know how can I investigate further the root cause of this failure? When I use v4l2src pipeline I can see there are csi requests for capture each frame and finish capture but in nvcamerasrc pipeline there is no csi requests at all so I’m stuck.

thanks a lot
xiaoyong

nvcamera-daemon-new.log (78.1 KB)

Please use the v4l2-ctl to capture the raw data and verify it is validate first. And did you try the discontinuous_clk for yes and no.

Hi, Shane

Really appreciate for the quick response. the v4l2-ctl capture works fine now. it may have error for the first frame or two and sometime has a timeout after it finishes but in between is ok. I’ve tried both discontinous_clk yes and no and it does not make a difference for the nvcamerasrc case

thanks

If the v4l2-ctl still have problem you can’t say the v4l2-ctl capture works fine.
Please try below command to check if csi can capture continuously.

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

This command runs mostly ok, the outputs are lines of
<<<<<<<<<<<<<<< 15.04 fps
<<<<<<<<<<<<<<< 15.04 fps
<<

dmesg log is about 500 of below (with my verbose output).
Btw, the addrss 0x0000001c is for pixel_parser_A_STATUS. It has a error code 0x12,(CRC and wordcount error) Based my understand from TRM and driver code this seems is not critical because csi driver ignores it. Part of the reason is our mipi tx doesn’t generate crc code.

[ +0.000042] video4linux video0: tegra_channel_error_status : error status
[ +0.000019] vi2_channel_error_status
[ +0.000016] vi2_channel_csi_read
[ +0.000017] vi2_channel_csi_write
[ +0.000014] tegra_csi_error :
[ +0.000017] csi2_pp_read:offset 0x0000001c
[ +0.000021] csi2_pp_write:offset 0x0000001c val:0x00000012
[ +0.000016] csi2_cil_read:offset 0x00000010
[ +0.000020] csi2_cil_write:offset 0x00000010 val:0x00000000
[ +0.000016] csi2_cil_read:offset 0x00000014
[ +0.000018] csi2_cil_write:offset 0x00000014 val:0x00000000
[ +0.000023] video4linux video0: tegra_channel_ring_buffer :
[ +0.000021] video4linux video0: update_state_to_buffer :
[ +0.000022] video4linux video0: free_ring_buffers : free ring buffer 3
[ +0.000042] video4linux video0: dequeue_buffer : dequeue a capture buffer and add to ring buffer
[ +0.000023] video4linux video0: add_buffer_to_ring : add buffer to ring
[ +0.000024] video4linux video0: tegra_channel_kthread_capture_start : get a capture buffer, try to capture a frame
[ +0.000022] video4linux video0: tegra_channel_capture_frame : capture frame init for each frame
[ +0.000022] vi2_channel_capture_frame_init : setup vi/csi capture frame init
[ +0.000014] vi2_channel_csi_write
[ +0.000014] vi2_channel_csi_write
[ +0.000013] vi2_channel_csi_write
[ +0.000019] vi2_channel_capture_frame_init : program syncpoints, thresh[0], syncpt 504
[ +0.000013] vi2_channel_write
[ +0.000018] vi2_channel_capture_frame_init : !chan->syncpoint_fifo[0], frame_start 13, val 3332
[ +0.000120] video4linux video0: tegra_channel_capture_frame : capture frame
[ +0.000030] vi2_channel_capture_frame : capture frame
[ +0.000014] vi2_channel_csi_write
[ +0.000027] vi vi: nvhost_syncpt_wait_timeout_ext: thresh 504, timeout 20
[ +0.065694] vi2_channel_capture_frame : capture frame succeed
[ +0.000031] video4linux video0: tegra_channel_error_status : error status
[ +0.000015] vi2_channel_error_status
[ +0.000011] vi2_channel_csi_read
[ +0.000013] vi2_channel_csi_write

last frame has below error though

vi vi: nvhost_syncpt_wait_timeout_ext: thresh 531, timeout 20
[ +0.196170] video4linux video0: MW_ACK_DONE syncpoint time out!0

overall stat after it all finishes is

[ +0.000050] vi2_channel_read
[ +0.000049] vi2_channel_ec_recover
[ +0.000041] vi2_channel_csi_read
[ +0.000054] vi2_channel_ec_recover : TEGRA_VI_CSI_ERROR_STATUS 0x00000001
[ +0.000044] tegra_csi_status :
[ +0.000054] csi2_pp_read:offset 0x0000001c
[ +0.000080] vi vi: TEGRA_CSI_PIXEL_PARSER_STATUS 0x00000012
[ +0.000051] csi2_cil_read:offset 0x00000010
[ +0.000070] vi vi: TEGRA_CSI_CIL_STATUS 0x00000000
[ +0.000051] csi2_cil_read:offset 0x00000014
[ +0.000066] vi vi: TEGRA_CSI_CILX_STATUS 0x00000000
[ +0.000049] csi2_pp_read:offset 0x00000220
[ +0.000069] vi vi: TEGRA_CSI_DEBUG_COUNTER_0 0x0010beb7
[ +0.000048] csi2_pp_read:offset 0x00000224
[ +0.000064] vi vi: TEGRA_CSI_DEBUG_COUNTER_1 0x000001fd
[ +0.000049] csi2_pp_read:offset 0x00000228
[ +0.000066] vi vi: TEGRA_CSI_DEBUG_COUNTER_2 0x0010d08c
[ +0.000042] vi2_channel_write
[ +0.000043] tegra_csi_error_recover :
[ +0.000055] csi2_cil_write:offset 0x00000020 val:0x00000001
[ +0.000078] vi vi: csi2_write:port 1 offset 0x00000214 val:0x00000001
[ +0.000260] csi2_cil_write:offset 0x00000020 val:0x00000000
[ +0.000081] vi vi: csi2_write:port 1 offset 0x00000214 val:0x00000000

Thanks a lot

one additional thing I noticed for the nvcamera-daemon verbose output is there is a
“LSC: LSC Surface not based on full res” for working sensor such as imx172 from leopard image but for my sensor and driver I don’t get this. Not sure if this is of any value though.

Are there any additional kernal logging that I can enable in /sys/kernel/debug to understand this issue more?

thanks

@xiaoyongtijee

Due to the v4l2-ctl and nvcamerasrc use different VI/CSI driver may have different behavior for the error handling.
I think the “[ +0.000021] csi2_pp_write:offset 0x0000001c val:0x00000012” maybe the root cause. You may need to resolve this error first.

@ShaneCCC

I’ll give that a try. Does nvcamera-daemon has some setting to dump reading of registers as in tegra v4l2 vi/csi drivers?

thanks a lot

@xiaoyongtijee
Sorry, we don’t have that current.

@ShaneCCC

It finally works now!!! Really appreciate all your supports!
The changes I made are

  1. Fixed CRC as well as word count in mipi, it turns out our mipi rx misses two words.
  2. I accidentally found we have embedded_metadata so modified the DT accordingly.

Now I’ll try to port it to 28.1

thanks again!