Jetson Orin Nano camera ports

Hello,

I am using Jetson Orin Nano, When I am connecting the camera kit to the CAM0 port, it works fine, when connecting it to CAM1 port it is not working.

  1. Any clue what is the main differences between the two camera ports?

  2. How to activate the CAM1 port to work as CAM0?

Thanks!

hello reem.othman,

please refer to Jetson Orin NX Series and Orin Nano Series Design Guide for checking [Figure 10-1. CSI 2-Lane Connection Options].
and… for using Orin Nano DevKit, it’s actually CSI-C for Cam0 slot, and CSI-B for Cam1 slot.

@JerryChang
Do you mean by :
CSI-C : Camera 3 (2-Lane) & CSI-B for Camera 3 (2-Lane) ??
image

Additionally, I didn’t get what is the main reason behind that issue? cam0 works but cam1 doesn’t work ? Specially for Omnivision sensors (E.g OV9782), Would you kindly explain this? and how to solve it?

hello reem.othman,

for example, on carrier board. 1st camera slot (Cam0) it’s connected to CSI2.
as you can see, there’s polarity swap, CSI0 D1 and CSI1 D0 P/N will always been swizzled for P/N.

there’s device tree property, lane_polarity to configure a polarity swap on any lane.
please check you’ve correct device tree property settings, you may see-also reference driver,
$public_sources/kernel_src/hardware/nvidia/platform/t23x/p3768/kernel-dts/cvb/tegra234-camera-rbpcv2-imx219.dtsi

@JerryChang Hi Jerry,
Sorry for the delay, I was waiting to get the source code of the camera driver I am using, which is arducam OV9782 quad stereo kit (B0331), the only compatible OV9782 board with Jetson Orin nano as attached:

I found in the Driver source code (named Jetvariety) some specification regarding the lane polarity; If you can help me to figure this out?
diff --git a/hardware/nvidia/platform/t23x/p3768/kernel-dts/Makefile b/hardware/nvidia/platform/t23x/p3768/kernel-dts/Makefile
index f306119fe…a35e99a9c 100644

  1. for cam0 configuration:
    mode0 {
  •   			mclk_khz = "24000";
    
  •   			num_lanes = "2";
    
  •   			tegra_sinterface = "serial_b";
    
  •   			phy_mode = "DPHY";
    
  •   			discontinuous_clk = "yes";
    
  •   			dpcm_enable = "false";
    
  •   			cil_settletime = "0";
    
  •   			lane_polarity = "6";
    
  1. for cam1 configuration:
  •   			lane_polarity = "0";
    

How can I change the lane_polarity values so that I can activate both camera ports?

Here you can find Other specs in the driver regarding camera configuartion:
reg in :
tegra-capture-vi {

  •   num-channels = <2>;
    
  •   ports {
    
  •   	#address-cells = <1>;
    
  •   	#size-cells = <0>;
    
  •   	port@0 {
    
  •   		reg = <0>;
    
  •   		arducam_vi_in0: endpoint {
    
  •   			port-index = <0>;
    
  •   			bus-width = <2>;
    
  •   			remote-endpoint = <&arducam_csi_out0>;
    
  •   		};
    
  •   	};
    
  •   	port@1 {
    
  •   		reg = <1>;
    
  •   		arducam_vi_in1: endpoint {
    
  •   			port-index = <2>;
    
  •   			bus-width = <2>;
    
  •   			remote-endpoint = <&arducam_csi_out1>;
    
  •   		};
    
  •   	};
    
  •   };
    

gpios = <CAM1_PWDN 0 CAM0_PWDN 0>;

  • label = “cam1-pwdn”, “cam0-pwdn”;

arducam_csi_in0: endpoint@0

port-index

remote-endpoint

Which of these parameters I can play with so that I can activate both Jetson camera ports with the board??

@JerryChang Any idea???

hello reem.othman,

please use device tree property, lane_polarity to configure a polarity swap on any lane.
you may see-also reference camera device tree for descriptions.
for instance,
$public_sources/kernel_src/hardware/nvidia/platform/t23x/p3768/kernel-dts/cvb/tegra234-camera-rbpcv2-imx219.dtsi

                                * lane_polarity
                                * Based on the camera connector pin.
                                * CSIx_D0 | CSIx_D1 | CSI(X+1)_D0 | CSI(X+1)CSIx_D1
                                *    LSB  |   BIT1  |     BIT2    |      MSB
                                * if there is a polarity swap on any lane, the bit corrsponding
                                * to the lane should be set
                                * e.g. polarity swap on CSIx_D0 only -> lane_polarity = "1"; 0001
                                * e.g. polarity swap on CSIx_D1 and CSI(X+1)_D0 -> lane_polarity = "6"; 0110

Hi @JerryChang,

It’s getting more confusing, so would you kindly ask my questions:

According to this figure:

QUESTION1:
I can see that:
CAM0 port uses CSI0 & CSI1 (where pins are swizzled) so I need to set the lane_polarity= 6;
CAM1 port uses CSI2 & CSI3 (where pins are NOT swizzled) so I need to set the lane_polarity= 0; CORRECT?

QUESTION2:

And according to this figure:


What are the meaning of these letters; I mean what is CAM0 and CAM1 port is using??

Cam0 slot (uses CSI-C) (i.e. Set port-index= 2)
Cam1 slot (uses CSI-B) for P3768 (i.e. Set port-index= 1)
CORRECT?

QUESTION3:
Please find the following driver code where I set the lane-polarity and port-index as explained:

AND

CORRECT??

Thanks a lot for you help!

hello reem.othman,

this only happened on A03.

to simplify,
CAM0 port (J20) used CSIB (i.e. CSI1 in data-sheet) and CAM1 port (J21) used CSIC (i.e. CSI2 in data-sheet), Only x2 lane mode is supported.

your Q1 and Q2 were correct. but Q3 assign to incorrect port-index.
please use port-index=<1> for serial_b, and port-index=<2> for serial_c.

@JerryChang Thanks for your guidance it’s really helpful,

Now I need to apply the patch file (driver source code for the camera sensor) after I made the changes to it; would you help with which jetson file i should patch this patch file to?

where:
diff --git a/hardware/nvidia/platform/t23x/p3768/kernel-dts/Makefile b/hardware/nvidia/platform/t23x/p3768/kernel-dts/Makefile
index f306119fe…a35e99a9c 100644
— a/hardware/nvidia/platform/t23x/p3768/kernel-dts/Makefile
+++ b/hardware/nvidia/platform/t23x/p3768/kernel-dts/Makefile
@@ -35,6 +35,7 @@ dtbo-$(BUILD_ENABLE) += tegra234-p3767-0000-p3768-0000-csi.dtbo
dtbo-$(BUILD_ENABLE) += tegra234-p3767-camera-imx477-imx219.dtbo
dtbo-$(BUILD_ENABLE) += tegra234-p3767-camera-imx477-dual.dtbo
dtbo-$(BUILD_ENABLE) += tegra234-p3767-camera-imx219-dual.dtbo
+dtbo-$(BUILD_ENABLE) += tegra234-p3767-camera-p3768-arducam-dual.dtbo
dtbo-$(BUILD_ENABLE) += tegra234-p3767-camera-p3768-imx477-imx219.dtbo
dtbo-$(BUILD_ENABLE) += tegra234-p3767-camera-p3768-imx219-dual.dtbo
dtbo-$(BUILD_ENABLE) += tegra234-p3767-camera-p3768-imx477-dual.dtbo
diff --git a/hardware/nvidia/platform/t23x/p3768/kernel-dts/cvb/tegra234-camera-arducam.dtsi b/hardware/nvidia/platform/t23x/p3768/kernel-dts/cvb/tegra234-camera-arducam.dtsi
new file mode 100644
index 000000000…d316d3bb7
— /dev/null
+++ b/hardware/nvidia/platform/t23x/p3768/kernel-dts/cvb/tegra234-camera-arducam.dtsi

hello reem.othman,

I assume you’re using the latest JP-5 release version.
you may visit jetson-linux-r3550 to download [Driver Package (BSP) Sources] package for public release sources.
or… you may follow developer guide to Obtaining the Kernel Sources with Git.
once you obtain the kernel sources, you’re able to follow Building the Kernel section to compile the sources.

as you can see…
this is git diff, and it’s indicate the path of the modification.

you may running with git commands to apply the patch if you obtain the kernel sources via source_sync.sh .
or, you may checking that path to apply the patches manually.

Hello @JerryChang,

I made all changes and I successfully patched the patch file (driver source code for Ov9782) to the kernel_src follwoing your mentioned steps, but still I wasn’t able to get any data via the CAM0 port!

My question is, do I need to change the port-index to 1 instead of 0 in all the source code as attached in screenshots?? or just specific places?

Here are the instances of the port-index in the source_code file :



hello reem.othman,

this depends-on your real camera connections, default reference driver (i.e. IMX219) it’s using csi-b.

@JerryChang Thanks for quick response!
Yes but in the driver source code it’s just using either serial_b or serial_c
I mean no serial_a is mentioned
So why should I have any port index set to 0 ?!
They must be either set to 1 or 2, or?

it’s according to Port Index, software side simply react to real hardware connections.

@JerryChang
Exactly, and according to this

If we are using serial_b and serial_c
So, the port-index should be either 1 or 2 not 0

Correct ? or am I missing something?

that’s correct, port-index assignment should following the above diagram.

@JerryChang Do you have any idea why after setting the port-index and the lane-polarity as mentioned above; still we cannot get the video stream from CAM0 port?!

Giving that the patch file is applying many changes, all of them was successfully patched except that we get this error when patching the file:

Here is the part where the error comes from:

Is this related why we don’t get the video stream? Any idea how to fix it?

Thanks!

hello reem.othman,

who’s maintain the patch, is it validated by partners?
besides, what’s the error messages looks like, thanks

hello @JerryChang

The patch file is supported by Arducam,
Here is the error message, just to small part of the patch attached above

But other than this, all patch file parts were patched successfully including the port-index and lane-polarity settings and other staff