How to add 12 ports of tegra-capture-vi?

Hi,

I am trying to port 12 camera modules to NV Xavier-Industrial.
After I configure the channel numbers of tegra-capture-vi to 12, the system is crashed when boots up and shows me the port numbers should not be more than 8.

Would you please help to suggest me how to do that for 12 camera?

[ 3.168605] tegra-camrtc-capture-vi tegra-capture-vi: Invalid NVCSI stream Id
[ 3.169687] tegra-camrtc-capture-vi tegra-capture-vi: Invalid NVCSI stream Id
[ 3.176930] tegra-camrtc-capture-vi tegra-capture-vi: port index >7!
[ 3.183629] tegra-camrtc-capture-vi tegra-capture-vi: tegra_channel_csi_init:Fail to parse port info
[ 3.192194] tegra-camrtc-capture-vi tegra-capture-vi: channel init failed
[ 3.199024] tegra-camrtc-capture-vi tegra-capture-vi: port index >7!
[ 3.205833] tegra-camrtc-capture-vi tegra-capture-vi: tegra_channel_csi_init:Fail to parse port info
[ 3.214768] tegra-camrtc-capture-vi tegra-capture-vi: channel init failed
[ 3.221593] tegra-camrtc-capture-vi tegra-capture-vi: port index >7!
[ 3.228405] tegra-camrtc-capture-vi tegra-capture-vi: tegra_channel_csi_init:Fail to parse port info
[ 3.237159] tegra-camrtc-capture-vi tegra-capture-vi: channel init failed
[ 3.243822] tegra-camrtc-capture-vi tegra-capture-vi: port index >7!
[ 3.250454] tegra-camrtc-capture-vi tegra-capture-vi: tegra_channel_csi_init:Fail to parse port info
[ 3.259384] tegra-camrtc-capture-vi tegra-capture-vi: channel init failed

hello frank_cf_weng,

please refer to Port Index section. there’re only six VI streams,
for your use-case, you’ll need to enable virtual channel supports, please see-also developer gudie, Jetson Virtual Channel with GMSL Camera Framework.

Hi Jerry

I try to change the Port Index, and then the system can boot up normally.
But when I try to capture video by gst-launch-1.0 command, something wrong from dmesg like as below.
Do you have any ideas?

=
[ 2005.311726] ar0233 2-0044: Index = 0x0005 , format = 0x59565955, width = 1920, height = 1080, frate num = 30
[ 2009.057795] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[ 2009.058055] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[ 2009.059059] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 2009.059272] t194-nvcsi 13e10000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=0, csi_port=0
[ 2009.059489] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 2009.059655] t194-nvcsi 13e10000.host1x:nvcsi@15a00000: csi5_stream_open: VI channel not found for stream- 0 vc- 1
[ 2009.060255] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel
[ 2011.873772] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[ 2011.874017] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[ 2011.875125] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 2011.875317] t194-nvcsi 13e10000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=0, csi_port=0
[ 2011.875535] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 2011.875693] t194-nvcsi 13e10000.host1x:nvcsi@15a00000: csi5_stream_open: VI channel not found for stream- 0 vc- 1
[ 2011.876300] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel
[ 2014.505762] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[ 2014.506039] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[ 2014.507020] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 2014.507185] t194-nvcsi 13e10000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=0, csi_port=0
[ 2014.507420] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 2014.507600] t194-nvcsi 13e10000.host1x:nvcsi@15a00000: csi5_stream_open: VI channel not found for stream- 0 vc- 1
[ 2014.508270] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel
[ 2014.512764] ar0233 2-0044: mcu_cam_stream_off 250 CAM Get CMD Stream off Success !!

Some parts of my device tree are such like below…

 capture_vi_base: tegra-capture-vi  {
                    //num-channels = <12>;
                    //num-channels = <8>;
                    num-channels = <4>;
                    #address-cells = <1>;
                    #size-cells = <0>;
                    status = "okay";
                    ports {
                            #address-cells = <1>;
                            #size-cells = <0>;
                            status = "okay";
                            port@0 {
                                    reg = <0>;
                                    status = "okay";
                                    ecam_vi_in0: endpoint {
                                            status = "okay";
                                            vc-id = <0>;
                                            port-index = <0>;
                                            bus-width = <CAM_LANES>;
                                            remote-endpoint = <&ecam_csi_out0>;
                                    };
                            };
                            port@1 {
                                    reg = <1>;
                                    status = "okay";
                                    ecam_vi_in1: endpoint {
                                            status = "okay";
                                            vc-id = <1>;
                                            port-index = <0>;
                                            bus-width = <CAM_LANES>;
                                            remote-endpoint = <&ecam_csi_out1>;
                                    };
                            };
                            port@2 {
                                    reg = <2>;
                                    status = "okay";
                                    ecam_vi_in2: endpoint {
                                            status = "okay";
                                            vc-id = <0>;
                                            port-index = <1>;
                                            bus-width = <CAM_LANES>;
                                            remote-endpoint = <&ecam_csi_out2>;
                                    };
                            };
                            port@3 {
                                    reg = <3>;
                                    status = "okay";
                                    ecam_vi_in3: endpoint {
                                            status = "okay";
                                            vc-id = <1>;
                                            port-index = <1>;
                                            bus-width = <CAM_LANES>;
                                            remote-endpoint = <&ecam_csi_out3>;
                                    };
                            };
                     };


    host1x@13e00000 {

            nvcsi@15a00000 {
                    //num-channels = <12>;
                    //num-channels = <8>;
                    num-channels = <4>;
                    #address-cells = <1>;
                    #size-cells = <0>;
                    status = "okay";
                    channel@0 {
                            reg = <0>;
                            status = "okay";
                            ports {
                                    #address-cells = <1>;
                                    #size-cells = <0>;
                                    port@0 {
                                            reg = <0>;
                                            status = "okay";
                                            ecam_csi_in0: endpoint@0 {
                                                    status = "okay";
                                                    port-index = <0>;
                                                    bus-width = <CAM_LANES>;
                                                    remote-endpoint = <&ecam_ar0233_out0>;
                                            };
                                    };
                                    port@1 {
                                            reg = <1>;
                                            status = "okay";
                                            ecam_csi_out0: endpoint@1 {
                                                    status = "okay";
                                                    remote-endpoint = <&ecam_vi_in0>;
                                            };
                                    };
                            };
                    };
                    channel@1 {
                            reg = <1>;
                            status = "okay";
                            ports {
                                    #address-cells = <1>;
                                    #size-cells = <0>;
                                    port@0 {
                                            reg = <0>;
                                            status = "okay";
                                            ecam_csi_in1: endpoint@2 {
                                                    status = "okay";
                                                    port-index = <0>;
                                                    bus-width = <CAM_LANES>;
                                                    remote-endpoint = <&ecam_ar0233_out1>;
                                            };
                                    };
                                    port@1 {
                                            reg = <1>;
                                            status = "okay";
                                            ecam_csi_out1: endpoint@3 {
                                                    status = "okay";
                                                    remote-endpoint = <&ecam_vi_in1>;
                                            };
                                    };
                            };
                    };

hello frank_cf_weng,

please also review device tree settings, you must set the vc-id property in the gmsl-link node for each sensor to match the vc_id property in the sensor mode device node.

it sometimes clock configuration issue,
please have a try to execute below commands to boost all the VI/CSI/ISP clocks.
for example,

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

furthermore,
is it possible to probe the hardware signaling for issue narrow down?
you may need to ensure there’s MIPI signal sending to CSI brick.

Hi Jerry

The results for VI/CSI/ISP clocks are such like as below.

root@ubuntu:/home/wistron# echo 1 > /sys/kernel/debug/bpmp/debug/clk/vi/mrq_rate_locked
root@ubuntu:/home/wistron# echo 1 > /sys/kernel/debug/bpmp/debug/clk/isp/mrq_rate_locked
root@ubuntu:/home/wistron# echo 1 > /sys/kernel/debug/bpmp/debug/clk/nvcsi/mrq_rate_locked
root@ubuntu:/home/wistron# echo 1 > /sys/kernel/debug/bpmp/debug/clk/emc/mrq_rate_locked
root@ubuntu:/home/wistron# cat /sys/kernel/debug/bpmp/debug/clk/vi/max_rate |tee /sys/kernel/debug/bpmp/debug/clk/vi/rate
819200000
root@ubuntu:/home/wistron# cat /sys/kernel/debug/bpmp/debug/clk/isp/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/isp/rate
1011200000
root@ubuntu:/home/wistron# cat /sys/kernel/debug/bpmp/debug/clk/nvcsi/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/nvcsi/rate
400000000
root@ubuntu:/home/wistron# cat /sys/kernel/debug/bpmp/debug/clk/emc/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/emc/rate
2133000000

And I think I have completed the vc-id settings, you can refer to the dtsi for checking.
tegra194-camera-dino-ar0233.dtsi (35.1 KB)

And regarding to probe the hardware signaling, I don’t understand what you mean.
Can you show me more details?

it’s arrange hardware resources to probe the MIPI signaling by oscilloscope to check it’s follow the spec.

Hi @JerryChang

After checking the MIPI signals by oscilloscope, it should be caused by incorrect SERDES settings since no outputs to host.

Thanks for your suggestion.

Hi @JerryChang

I correct the SERDES parameters and then can measure the MIPI signals (data and clock) output from deserializer by oscilloscope.
I can see all the signals from oscilloscope but Xavier-Industrial still shows me timeout messages.
Can you suggest me something? Thanks.

hello frank_cf_weng,

please gather the logs for reference, for example, what’s the VI tracing logs shows?
you may also have a try to execute the commands to boost all the VI/CSI/ISP clocks.

Hi @JerryChang

Can you provide me the commands to gather the needed logs and to boost clocks?

hello frank_cf_weng,

since this topic is resolved by correct SERDES settings.
you may create a new discussion thread to follow-up.

FYI,
here’re steps to enable VI tracing logs.

echo 1 > /sys/kernel/debug/tracing/tracing_on
echo 30720 > /sys/kernel/debug/tracing/buffer_size_kb
echo 1 > /sys/kernel/debug/tracing/events/tegra_rtcpu/enable
echo 1 > /sys/kernel/debug/tracing/events/freertos/enable
echo 2 > /sys/kernel/debug/camrtc/log-level
echo > /sys/kernel/debug/tracing/trace
cat /sys/kernel/debug/tracing/trace

also,
the 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

@JerryChang

Understood, thanks.
I have a new ticket to describe my issue.
https://forums.developer.nvidia.com/t/random-failed-when-triggering-video-capture/261167

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