Support Virtual Channel on single CSI Port

Hi Team,

I have connected the single camera on a CSI port and camera is configured to send 2 streams on virtual channel.

I had gone through some of the forum’s solution, but it seems not clear for single camera use case.

Here is the dts file I had configured.
Linux_for_Tegra/source/hardware/nvidia/t23x/nv-public/overlay/tegra234-p3767-camera-p3768-abcd.dts

tegra234-p3767-camera-p3768-abcd.txt (5.2 KB)

in kernel driver i had added the node entry like

const static struct of_device_id abcd_of_match = {
{ .compatible = “abcd” },
{ .compatible = “abcd1” },
{ /* sentinel */ }
};

could you please help me to configure the VC0 and VC1 from single CSI port camera.

Thank you in advance!

Hi there @kishan.kava, welcome to the NVIDIA developer forums.

Which Jetson device are you using? Then I can reference you to the correct sub-forum on the server.

Thanks!

Hi @MarkusHoHo

I am using the Jetson Orin Nano Developer Kit.

1 Like

hello kishan.kava,

please refer to developer guide, Jetson Virtual Channel with GMSL Camera Framework.
you may see-also AGX Orin’s reference driver which using virtual channels.
for instance, $public_sources/kernel_src/hardware/nvidia/t23x/nv-public/overlay/tegra234-camera-imx390-a00.dtsi

Hi @JerryChang

Thank you for your reply!

I have read this document.
I am not using the GMSL framework and do not have the Serializer-Deserializer.

hello kishan.kava,

may I confirm what’s the real use-case with virtual channel supports?

Hi @JerryChang,

Camera sends two different data on each channel like Depth on one channel and AB on one channel.

At the host side (Jetson Orin Nano) we need to receive the frame in virtual channel manner.

like VC0 = depth frame, VC1 = AB frame

sorry, we do not support that feature in the current Jetpack-6.0 release version.

Hi @JerryChang,

I was reading the below forum page seems we can make it work,
but not sure in current release it’s possible or not.

Question about Virtual Channel Support - Jetson & Embedded Systems / Jetson Xavier NX - NVIDIA Developer Forums

so just want some information from you.

hello kishan.kava,

may I also confirm how these frames looks like,
for instance, were they had individual start-of-frame/end-of-frame?

Hi @JerryChang

Yes, both have individual SoF/EoF.

hello kishan.kava,

all right, it may works.
please also refer to AGX Orin’s reference driver (i.e. IMX390) to define two NVCSI/VI port bindings with VC0 and VC1.

Hi @JerryChang,

I had configured the port binging as per the IMX390, still i am not able to get the 2 video node.
Attached the dts file could you please look into it once.

tegra234-p3767-camera-p3768-abcd.txt (5.2 KB)

hello kishan.kava,

did you confirm Orin Nano is loading Camera ABCD camera overlay correctly?
may I also know your kernel logs for device registration.

besides,
it looks you’ve incorrect port bindings, and also incorrect camera node definition.
for instance,
(1) you should have two nodes within tegra-capture-vi{} and nvcsi{},
(2) your camera node, abcd@38 and abcd@39 should them mapping to different CSI/VI node.

here’s pseudo code for your reference.

                        tegra-capture-vi {
                                num-channels = <2>;
                                ports {
                                        port@0 {
                                                abcd_vi_in0: endpoint {
                                                        vc-id = <0>;
                                                        port-index = <1>;
                                                        bus-width = <2>;
                                                        remote-endpoint = <&abcd_csi_out0>;
                                                };
                                        };
                                        port@1 {
                                                abcd_vi_in1: endpoint {
                                                        vc-id = <1>;
                                                        port-index = <1>;
                                                        bus-width = <2>;
                                                        remote-endpoint = <&abcd_csi_out1>;
                                                };

                                host1x@13e00000 {
                                        nvcsi@15a00000 {
                                                num-channels = <2>;
                                                channel@0 {
                                                        ports {
                                                                port@0 {
                                                                        abcd_csi_in0: endpoint@0 {
                                                                                port-index = <1>;
                                                                                bus-width = <2>;
                                                                                remote-endpoint = <&abcd_cam_out0>;
                                                                        };
                                                                };
                                                                port@1 {
                                                                        abcd_csi_out0: endpoint@1 {
                                                                                remote-endpoint = <&abcd_vi_in0>;
                                                                        };
                                                                };
                                                channel@1 {
                                                        ports {
                                                                port@0 {
                                                                        abcd_csi_in1: endpoint@2 {
                                                                                port-index = <1>;
                                                                                bus-width = <2>;
                                                                                remote-endpoint = <&abcd_cam_out1>;
                                                                        };
                                                                };
                                                                port@1 {
                                                                        reg = <1>;
                                                                        imx390_csi_out1: endpoint@3 {
                                                                                remote-endpoint = <&abcd_vi_in1>;
                                                                        };
                                                                };

Hi @JerryChang,

Thank you very much for your input.

I have tried the suggestion you have given, but no luck with this i am getting error while loading the dts file from
tegra-capture-vi, invalid virtual memory access address 0x0000000
i have attached the diff of the changes as well.

binding_changes_non_functional.txt (2.0 KB)

but if i have run the attached the dts file i am able to boot and got the below logs from the driver, seems it probing the driver.

tegra234-p3767-camera-p3768-abcd.txt (6.8 KB)

and i can see the 2 entry in dev like
crw-rw----+ 1 root video 81, 0 Jan 1 05:52 /dev/video0
crw-rw----+ 1 root video 81, 4 Jan 1 05:52 /dev/video1

in driver i have added the below change at the beginning of the probe, tried to read the vc-id but not able to read it.

if(client->addr == 0x38){
	dev_err(&client->dev, "Probing 0x38\n");
}
else if(client->addr == 0x39){
	client->addr = 0x38;
	dev_err(&client->dev, "Probing 0x39\n");
}

driver logs:
[ 11.359095] ABCD1234 2-0039: probing ABCD1234 v4l2 sensor
[ 11.359101] ABCD1234 2-0039: Probing 0x39
[ 11.359143] ABCD1234 2-0039: Virtual Channel mode activated
[ 11.359145] ABCD1234 2-0039: No vc-id info: 65535
[ 11.359147] ABCD1234 2-0039: No vc_id info: 65535
[ 11.359149] ABCD1234 2-0039: Read from the DTSI: Video Node: video1
[ 11.359154] ABCD1234 2-0039: Reset-gpios not found -2
[ 11.361630] ABCD1234 2-0039: Read of Chip ID register failed.
[ 11.361784] tegra-camrtc-capture-vi tegra-capture-vi: subdev ABCD1234 2-0038 bound
[ 11.363327] ABCD1234 2-0039: Detected ABCD1234 sensor
[ 11.363432] ABCD1234 2-0038: probing ABCD1234 v4l2 sensor
[ 11.363435] ABCD1234 2-0038: Probing 0x38
[ 11.363471] ABCD1234 2-0038: Virtual Channel mode activated
[ 11.363472] ABCD1234 2-0038: No vc-id info: 65535
[ 11.363474] ABCD1234 2-0038: No vc_id info: 65535
[ 11.363476] ABCD1234 2-0038: Read from the DTSI: Video Node: video0
[ 11.363481] ABCD1234 2-0038: Reset-gpios not found -2
[ 11.363740] debugfs: Directory ‘ABCD1234_b’ with parent ‘/’ already present!
[ 11.364996] ABCD1234 2-0038: Read of Chip ID register failed.
[ 11.365112] tegra-camrtc-capture-vi tegra-capture-vi: subdev ABCD1234 2-0038 bound
[ 11.365644] ABCD1234 2-0038: Detected ABCD1234 sensor

below is logs to confirm the overlay file is being loaded.

[ 8.204677] platform 13e00000.host1x:nvcsi@15a00000: Fixing up cyclic dependency with 2-0038
[ 8.204702] platform 13e00000.host1x:nvcsi@15a00000: Fixing up cyclic dependency with 2-0039
[ 8.204719] platform 13e00000.host1x:nvcsi@15a00000: Fixing up cyclic dependency with tegra-capture-vi
[ 9.919010] tegra-camrtc-capture-vi tegra-capture-vi: subdev 13e00000.host1x:nvcsi@15a00000- bound
[ 9.919027] tegra-camrtc-capture-vi tegra-capture-vi: subdev 13e00000.host1x:nvcsi@15a00000- bound
[ 8.204719] platform 13e00000.host1x:nvcsi@15a00000: Fixing up cyclic dependency with tegra-capture-vi
[ 9.919010] tegra-camrtc-capture-vi tegra-capture-vi: subdev 13e00000.host1x:nvcsi@15a00000- bound
[ 9.919027] tegra-camrtc-capture-vi tegra-capture-vi: subdev 13e00000.host1x:nvcsi@15a00000- bound
[ 10.133929] tegra-camrtc-capture-vi tegra-capture-vi: subdev ABCD1234 2-0038 bound
[ 10.220258] tegra-camrtc-capture-vi tegra-capture-vi: subdev ABCD1234 2-0038 bound

but i am not able to read chip-id or any other i2c operations as well.

hello kishan.kava,

it looks it’s added port bindings to register the device now.
the following up should related to sensor driver side operations, you may dig into the drivers.

Hi @JerryChang

Thank you for the confirmation, I2c operation is working now.

I am taking the reference of the imx390 but in that driver it seems reading the virtual ID from the dtsi and setting the “gmsl_link_ctx” which is refer to gmsl link.

do you have any reference to this use case which may help?

I am trying to capture using v4l2_utils using below command, not able to capture the frames with this.

Error: VIDIOC_S_FMT: failed: Invalid argument

v4l2-ctl -d /dev/v4l-subdev2 --set-ctrl operating_mode=0
v4l2-ctl -d /dev/v4l-subdev2 --set-ctrl phase_depth_bits=4
v4l2-ctl -d /dev/v4l-subdev2 --set-ctrl ab_bits=6

Request command:
v4l2-ctl --device /dev/video0 --set-fmt-video=width=2048,height=2560,pixelformat=RGGB --stream-mmap --stream-to=mode0.bin --stream-count=1

if I run the “v4l2-ctl -d /dev/v4l-subdev2 -L” it will list the above configuration, but request command is failing, and the device goes into hang state, and it requires hardware reboot.

hello kishan.kava,

no, since we don’t have a camera (VC0 = depth frame, VC1 = AB frame) for testing.

it’s the CID control to request sensor’s set format operation.
please also check your sensor driver, did you have below struct for tegracam_ctrl_ops()?

static struct tegracam_ctrl_ops imx390_ctrl_ops = { 
        .numctrls = ARRAY_SIZE(ctrl_cid_list),
        .ctrl_cid_list = ctrl_cid_list,
        .set_gain = imx390_set_gain,
        .set_exposure = imx390_set_exposure,
        .set_exposure_short = imx390_set_exposure,
        .set_frame_rate = imx390_set_frame_rate,
        .set_group_hold = imx390_set_group_hold,

Hi @JerryChang

No, driver does not have the “tegracam_ctrl_ops” but it has “v4l2_ctrl_ops”.

static const struct v4l2_ctrl_ops abcd1234_ctrl_ops = {
.g_volatile_ctrl = abcd1234_g_volatile_ctrl,
.s_ctrl = abcd1234_s_ctrl,

};

I am able to get the frames in /dev/video1 which is bind with /dev/v4l0subdev3 but not from the video0 which is actually bind with the real slave address 38.

Commands

v4l2-ctl -d /dev/v4l-subdev3 --set-ctrl operating_mode=0
v4l2-ctl -d /dev/v4l-subdev3 --set-ctrl phase_depth_bits=4
v4l2-ctl -d /dev/v4l-subdev3 --set-ctrl ab_bits=6
v4l2-ctl -d /dev/v4l-subdev3 --set-ctrl confidence_bits=0
v4l2-ctl -d /dev/v4l-subdev3 --set-ctrl ab_averaging=0
v4l2-ctl -d /dev/v4l-subdev3 --set-ctrl depth_enable=0
v4l2-ctl --device /dev/video1 --set-fmt-video=width=2048,height=2560,pixelformat=RGGB --stream-mmap --stream-to=mode0.bin --stream-count=1

Here is the output of “media-ctl -p”

Media controller API version 5.15.136

Media device information

driver tegra-camrtc-ca
model NVIDIA Tegra Video Input Device
serial
bus info
hw revision 0x3
driver version 5.15.136

Device topology

  • entity 1: 13e00000.host1x:nvcsi@15a00000- (2 pads, 2 links)
    type V4L2 subdev subtype Unknown flags 0
    device node name /dev/v4l-subdev0
    pad0: Sink
    ← “abcd1234 2-0038”:0 [ENABLED]
    pad1: Source
    → “vi-output, abcd1234 2-0038”:0 [ENABLED]

  • entity 4: 13e00000.host1x:nvcsi@15a00000- (2 pads, 2 links)
    type V4L2 subdev subtype Unknown flags 0
    device node name /dev/v4l-subdev1
    pad0: Sink
    ← “abcd1234 2-0038”:0 [ENABLED]
    pad1: Source
    → “vi-output, abcd1234 2-0038”:0 [ENABLED]

  • entity 7: abcd1234 2-0038 (1 pad, 1 link)
    type V4L2 subdev subtype Sensor flags 0
    device node name /dev/v4l-subdev2
    pad0: Source
    → “13e00000.host1x:nvcsi@15a00000-”:0 [ENABLED]

  • entity 9: vi-output, abcd1234 2-0038 (1 pad, 1 link)
    type Node subtype V4L flags 0
    device node name /dev/video0
    pad0: Sink
    ← “13e00000.host1x:nvcsi@15a00000-”:1 [ENABLED]

  • entity 23: abcd1234 2-0038 (1 pad, 1 link)
    type V4L2 subdev subtype Sensor flags 0
    device node name /dev/v4l-subdev3
    pad0: Source
    [fmt:SRGGB8_1X8/2048x2560 field:none colorspace:srgb]
    → “13e00000.host1x:nvcsi@15a00000-”:0 [ENABLED]

  • entity 25: vi-output, abcd1234 2-0038 (1 pad, 1 link)
    type Node subtype V4L flags 0
    device node name /dev/video1
    pad0: Sink
    ← “13e00000.host1x:nvcsi@15a00000-”:1 [ENABLED]

hello kishan.kava,

please aware that, as mentioned in comment#14.
I’m not sure whether it works or not since we don’t support that feature in the current Jetpack release version.

anyways,

please double check your device tree settings,
it seems there’s only single camera node available according to device topology.