Simultaneous connection of two Raspberry Pi Camera V2

Hi!
Is it possible to connect two “Raspberry Pi Camera V2” to Jetson NANO at the same time?

Although there is only one “Raspberry Pi Camera V2” that can be connected to the carrier board of Jetson NANO, there are three MIPI-CSI(2lane) ports that Jetson NANO has.
When I make a carrier board by imitating NVIDIA carrier board and physically connect two “Raspberry Pi Camera V2” to NANO, can the two “Raspberry Pi Camera V2” operate at the same time?

I would like to connect two “Raspberry Pi Camera V2” to NANO and capture different images.

best regards.

Yes, that should be fine to connect two Pi imx219 to nano.

Hi! ShaneCCC-san.
Thank you for your answer.
I was relieved to hear that “Raspberry Pi Camera V2” can be connected to NANO at the same time.

best regards.

Hi!
How do I connect a second camera RPI V2.1 to NANO?
I connect the first camera to MIPI-CSI.
What the testpoints can I use for a second camera?
Where are the CSI pins located on NANO?
I guess I’ll need a I2C multiplexer, for example, TCA9545A.

Regards!

Only one CSI port is routed out on dev kit. The others are TPs on bottom side. Attach screen shot here for your reference. You can use different I2C on nano for them if the I2C address of two cameras can’t be changed to different.
External Media

External Media

Hi!
Thanks for the TPs.
But in the doc JetsonNano_DataSheet_DS09366001v0.8.pdf on page 39 not all pins are coincided.
Only a CSI_B_D0, CSI_B_CLK, CSI_C_D0, CSI_C_CLK pins are coincided.
Why? Pin layout P and N doesn’t matter?

But if I connect the second camera to another I2C (for example 3 and 5 GPIO on J41), I will have to manually control the camera (initialization, exposion and etc.), is not it?
I would like the second camera to be defined as \dev\video1. Next I’ll use gstreamer.

Regards!

The Docs in DLC are only for production design (B01), yours looks like earlier module (A02), what i post is for your board, please ignore the datasheet. If you want to one I2C for two cameras, a multiplexer is necessary then.

Hi!
Thank you for your answers.

best regards.

Hi!

Thank you!
How to setup the NANO to work with a I2C multiplexer for two cameras?
Need to initialize the multiplexer before initializing the cameras.
I tried to connect a TCA9545 (address 0x70) to CAM_SCL0 and CAM_SDA0 through MIPI-CSI. It’s doesn’t work.
I checked this TCA9545 through GPIO (3 and 5 GPIO pins on J41). It’s work, but only manually after starting the OS.

Regards!

Did you check the reference schematic so as to attach device to correct points of CAM_I2C?

I used the following pinout for MIPI-CSI:
1 → Ground
2 → CAM1_DN0 - Data Lane 0
3 → CAM1_DP0 - Data Lane 0
4 → Ground
5 → CAM1_DN1 - Data Lane 1
6 → CAM1_DP1 - Data Lane 1
7 → Ground
8 → CAM1_CN - MIPI Clock
9 → CAM1_CP - MIPI Clock
10 → Ground
11 → CAM_GPIO
12 → CAM_CLK
13 → SCL0 - CAM_I2C
14 → SDA0 - CAM_I2C
15 → +3.3 V
If I connect the SCL0 and SDA0 contacts through the multiplexer, the camera is not detected. Device /dev/video0 is none.

I downloaded the public_sources.tbz2 (L4T Driver Package (BSP) Sources) from https://developer.nvidia.com/embedded/linux-tegra and found the following information in the i2c-ivc-multi.c file (public_sources\kernel_src\kernel\nvidia\drivers\i2c\busses):

* behind an I2C multiplexer: /i2c@3180000/tca9548@77/i2c@0/ov5693_a@36
* without an I2C multiplexer: /i2c@3180000/ov5693_c@36

Where can I change this setting?
I guess the following changes need to be made:

/i2c@3180000/tca9545@70/i2c@0/imx219 // for first camera
...
/i2c@3180000/tca9545@70/i2c@1/imx219 // for second camera

Regards!

You need to modify the device tree to match your design.
Have a reference to below doc to remove plugin manager to use main, how ever the path for nano should be this “hardware/nvidia/platform/t210/porg/…” Also you can use …/porg/kernel-dts/porg-platforms/tegra210-camera-rbpcv2-imx219.dtsi for two imx219 as base to modify to match yours.

[url]Welcome — Jetson Linux<br/>Developer Guide 34.1 documentation

Thank you!

Regards!

I rebuilt and flashed DTB file to JN.
Now I connected two cameras to JN (from CSI_A and CSI_F).

dmesg

[    3.468532] i2c /dev entries driver
[    3.470026] pca954x 6-0070: vcc-pullup regulator not found
[    3.470043] pca954x 6-0070: pca954x_probe: forcing device bus number, start 30.
[    3.470047] pca954x 6-0070: device detect skipped.
[    3.470596] i2c i2c-6: Added multiplexed i2c bus 30
[    3.470947] i2c i2c-6: Added multiplexed i2c bus 31
[    3.471283] i2c i2c-6: Added multiplexed i2c bus 32
[    3.471545] i2c i2c-6: Added multiplexed i2c bus 33
[    3.471551] pca954x 6-0070: registered 4 multiplexed busses for I2C switch pca9546
[    3.472267] imx219 30-0010: tegracam sensor driver:imx219_v2.0.6
[    3.498487] imx219 31-0010: tegracam sensor driver:imx219_v2.0.6

When I use

gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=1280, height=720, framerate=30/1, format=NV12' ! nvvidconv flip-method=0 ! 'video/x-raw,width=640, height=480, format=(string)UYVY' ! nvvidconv ! nvegltransform ! nveglglessink -e

is connected to dev/video0 only.

And pipeline for program

nvarguscamerasrc ! video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)NV12, framerate=(fraction)60/1 ! nvvidconv flip-method=0 ! video/x-raw, width=(int)640, height=(int)480, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink

How to write a parameter to change index the camera?
What pipeline should I use for both cameras?

Can I use the following code?

cv::VideoCapture cap1(pipeline1, cv::CAP_GSTREAMER); // pipeline1 for /dev/video0
cv::VideoCapture cap2(pipeline2, cv::CAP_GSTREAMER); // pipeline2 for /dev/video1

Use sensor-id to select another module like below command.

gst-launch-1.0 nvarguscamerasrc sensor-id=1 ! …

Thank You!

When I connect to the first or second camera, capture is always from the first camera, i.e., through “/proc/device-tree/host1x/i2c@546c0000/tca9546@70/i2c@0/rbpcv2_imx219_a@10”.

If I physically disconnect the first camera, then the second will be defined as “imx219 31-0010” and “/dev/video0”, i.e., all is OK. But if I connect to this camera there will be an error.

Work always CSI_A port and i2c@0.
What is wrong?

DTS:

tegra-camera-platform {
		compatible = "nvidia, tegra-camera-platform";
		status = "okay";
		num_csi_lanes = <0x4>;
		max_lane_speed = <0x16e360>;
		min_bits_per_pixel = <0xa>;
		vi_peak_byte_per_pixel = <0x2>;
		vi_bw_margin_pct = <0x19>;
		max_pixel_rate = <0x3a980>;
		isp_peak_byte_per_pixel = <0x5>;
		isp_bw_margin_pct = <0x19>;

		modules {

			module0 {
				badge = "porg_front_RBPCV2";
				position = "front";
				orientation = [31 00];

				drivernode0 {
					pcl_id = "v4l2_sensor";
					devname = "imx219 30-0010";
					proc-device-tree = "/proc/device-tree/host1x/i2c@546c0000/tca9546@70/i2c@0/rbpcv2_imx219_a@10";
				};

				drivernode1 {
					pcl_id = "v4l2_lens";
					proc-device-tree = "/proc/device-tree/lens_imx219@RBPCV2/";
				};
			};
			
			module1 {
				badge = "porg_rear_RBPCV2";
				position = "rear";
				orientation = [31 00];

				drivernode0 {
					pcl_id = "v4l2_sensor";
					devname = "imx219 31-0010";
					proc-device-tree = "/proc/device-tree/host1x/i2c@546c0000/tca9546@70/i2c@1/rbpcv2_imx219_f@10";
				};

				drivernode1 {
					pcl_id = "v4l2_lens";
					proc-device-tree = "/proc/device-tree/lens_imx219@RBPCV2/";
				};
			};		
		};
	};

I also edited next sections: vi, nvcsi and i2c@546c0000.
I can upload the full DTS file.

Image file - not changed.
If I change Image from Linux_for_Tegra/rootfs/boot the OS isn’t loading.

Regards!

No really understand your problem.
Can you access different sensor from sensor-id?
Did you mean sensor-id 1/0 always access to the same device?
Could you check the context of /proc/device-tree/tegra-camera-platform/modules/ exactly as your define.

1 Like

Yes, sensor-id 1/0 always access to the same device (it’s first physical camera).
I can even connect twice to the same physical camera through sensor-id 1/0.
This part of DTS (see above) is decompiled from tegra210-p3448-0000-p3449-0000-a02.dtb.
Maybe the “orientation” should be unique?

I do

...
module0 {
...
  orientation = [31 00];
...			
module1 {
...
  orientation = [32 00];
...

But nothing has changed.
Problem still exists.

  1. Enable the imx219 log and launch different sensor by --sensor-id = 0/1 and check if access the different sensor.
sudo su
echo file imx219.c +p > /sys/kernel/debug/dynamic_debug/control
  1. check the extracted_proc.dts from below command.

sudo dtc -I fs -O dts -o extracted_proc.dts /proc/device-tree