There is a problem when bringup the sensor using CPHY 4vc

Hello,all
I’m trying to light up the 4vc image sensor on Orin using CPHY,Everything seems to be going well,There was a slight problem, however, that there was always a serious frame loss on the first light,My sensor setting is 15fps,The first time you light up, with a frame rate of less than 10 frames,Here’s the weird thing: After finishing the first mission, the second one worked fine.
The result of the first execution may be as follows:

v4l2-ctl -d /dev/video0 -c bypass_mode=0 --stream-mmap --stream-count=100
<1.31fps
<<<<<<<<<<<<<<<4.68fps
<<<<<<<<<<<<<<<6.72fps
<<<<<<<<<<<<<<<8.09fps
<<<<<<<<<<<<<<<9.07fps
<<<<<<<<<<<<<<<9.80fps
<<<<<<<<<<<<<<<10.38fps
<<<<<<<<<

The result of the second execution may be as follows:

v4l2-ctl -d /dev/video0 -c bypass_mode=0 --stream-mmap --stream-count=100
<<<<<<<<<<<<<<<15.0fps
<<<<<<<<<<<<<<<15.0fps
<<<<<<<<<<<<<<<15.0fps
<<<<<<<<<<<<<<<15.0fps
<<<<<<<<<<<<<<<15.0fps
<<<<<<<<<<<<<<<15.0fps
<<<<<<<<<

Can you give me some directions and suggestions for checking or debugging?

hello 541449841,

is there any failures for the first v4l pipeline trial?
you may check $ dmesg > klogs.txt for digging into it.

BTW,
please give it a try with below commands to boost all the VI/CSI/ISP clocks.

sudo su
echo 1 > /sys/kernel/debug/bpmp/debug/clk/vi/mrq_rate_locked
echo 1 > /sys/kernel/debug/bpmp/debug/clk/isp/mrq_rate_locked
echo 1 > /sys/kernel/debug/bpmp/debug/clk/nvcsi/mrq_rate_locked
echo 1 > /sys/kernel/debug/bpmp/debug/clk/emc/mrq_rate_locked
cat /sys/kernel/debug/bpmp/debug/clk/vi/max_rate |tee /sys/kernel/debug/bpmp/debug/clk/vi/rate
cat /sys/kernel/debug/bpmp/debug/clk/isp/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/isp/rate
cat /sys/kernel/debug/bpmp/debug/clk/nvcsi/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/nvcsi/rate
cat /sys/kernel/debug/bpmp/debug/clk/emc/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/emc/rate

yes, klogs:

[230500.288648] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: flags 2, err_data 0
[230500.296411] [RCE] ERROR: camera-ip/vi5/vi5.c:745 [vi5_handle_eof] "General error queue is out of sync with frame queue. ts=230524109503168 sof_ts=230524147904096 gerror_code=2 gerror_data=224 notify_bits=200010"
[230502.832580] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[230502.841869] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[230502.851706] (NULL device *): vi_capture_control_message: NULL VI channel received
[230502.859502] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=4, csi_port=4
[230502.870261] (NULL device *): vi_capture_control_message: NULL VI channel received
[230502.878066] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_open: VI channel not found for stream- 4 vc- 1
[230502.888913] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel

boost all the VI/CSI/ISP clocks also has same problem

[230500.288648] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: flags 2, err_data 0
[230500.296411] [RCE] ERROR: camera-ip/vi5/vi5.c:745 [vi5_handle_eof] "General error queue is out of sync with frame queue. ts=230524109503168 sof_ts=230524147904096 gerror_code=2 gerror_data=224 notify_bits=200010"
[230502.832580] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[230502.841869] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[230502.851706] (NULL device *): vi_capture_control_message: NULL VI channel received
[230502.859502] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=4, csi_port=4
[230502.870261] (NULL device *): vi_capture_control_message: NULL VI channel received
[230502.878066] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_open: VI channel not found for stream- 4 vc- 1
[230502.888913] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel
[230510.977337] bwmgr API not supported
[230658.004349] bwmgr API not supported
[230659.788661] bwmgr API not supported
[230664.307264] bwmgr API not supported
[230664.392644] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: flags 2, err_data 0
[230664.422654] [RCE] ERROR: camera-ip/vi5/vi5.c:745 [vi5_handle_eof] "General error queue is out of sync with frame queue. ts=230688213460000 sof_ts=230688251860960 gerror_code=2 gerror_data=224 notify_bits=200010"
[230666.926617] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[230666.935890] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[230666.946684] (NULL device *): vi_capture_control_message: NULL VI channel received
[230666.954481] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=4, csi_port=4
[230666.965247] (NULL device *): vi_capture_control_message: NULL VI channel received
[230666.973214] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_open: VI channel not found for stream- 4 vc- 1
[230666.984185] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel

hello 541449841,

there’re errors for fetching frames, such as request timed out errors, which cause a serious frame loss.
for example,

[230664.422654] [RCE] ERROR: camera-ip/vi5/vi5.c:745 [vi5_handle_eof] "General error queue is out of sync with frame queue. ts=230688213460000 sof_ts=230688251860960 gerror_code=2 gerror_data=224 notify_bits=200010"
[230666.926617] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[230666.935890] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[230666.946684] (NULL device *): vi_capture_control_message: NULL VI channel received
[230666.954481] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=4, csi_port=4
[230666.965247] (NULL device *): vi_capture_control_message: NULL VI channel received
[230666.973214] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_open: VI channel not found for stream- 4 vc- 1

and…
this is eventually restore by the internal VI driver,
that’s why the later capture pipeline works normally.

[230666.984185] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel

may I know what’s difference between your 1st and 2nd trial.
is it works normally after force-stop the pipeline and re-try fetch the stream?
if yes, this should be something related to sensor side, you may review the power-on/off sequence.
thanks

1、difference:2nd trial boost all the VI/CSI/ISP clocks by using command

sudo su
echo 1 > /sys/kernel/debug/bpmp/debug/clk/vi/mrq_rate_locked
echo 1 > /sys/kernel/debug/bpmp/debug/clk/isp/mrq_rate_locked
echo 1 > /sys/kernel/debug/bpmp/debug/clk/nvcsi/mrq_rate_locked
echo 1 > /sys/kernel/debug/bpmp/debug/clk/emc/mrq_rate_locked
cat /sys/kernel/debug/bpmp/debug/clk/vi/max_rate |tee /sys/kernel/debug/bpmp/debug/clk/vi/rate
cat /sys/kernel/debug/bpmp/debug/clk/isp/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/isp/rate
cat /sys/kernel/debug/bpmp/debug/clk/nvcsi/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/nvcsi/rate
cat /sys/kernel/debug/bpmp/debug/clk/emc/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/emc/rate

2、sometime fetch stream will automatically stop, it cannot works normally after force-stop unless I uninstall the driver and reload it. Looks like VI channel needs to reset,but I don’t know what caused it.

More detail:
I lit up four sensors at the same time, each of which has three VC channels. Any sensor would stop working after being lit up for a period of time, but it could continue to capture image data without any operation after uninstalling the driver and reloading. (I have blocked all register operations in the driver, the sensor is always working)

hello 541449841,

while you boosting all the clocks, it’ll ignore the device tree settings.
hence… there should be some issue with your device tree settings, especially the pixel_clk_hz setting.
please review the developer guide to check the formula to obtain the correct sensor pixel clock rate.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.