felix808
Posts: 5
Joined: Mon Feb 08, 2021 3:43 pm

Two B102 TC358743 simultaneously on CM4

Mon Feb 08, 2021 4:25 pm

Hi,
I have two b102 connected to the CM4 and I'm able to get a preview (with raspivid -cs 0 or 1) either with the one or with the other module.
But not simultaneously. Both modules are recognized. All official step were made on cm4 for dualcam mode.
I'm able to run one b102 module and one picam v2 simultaneously.
But whenever I replace the picam with the second b102 module I'm getting this message:

Code: Select all

mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn't be enabled
mmal: main: Failed to create camera component
mmal: Failed to run camera app. Please check for firmware updates
This always is the output of the raspivid command which is called last.
I does not depend on specific module.
Same result when fireing up the two commands in different order.
But I guess the problem is more lowlevel.
Anyone any idea?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 13567
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Two B102 TC358743 simultaneously on CM4

Mon Feb 08, 2021 5:40 pm

viewtopic.php?f=38&t=281972
Firstly, use of raspivid with this chip is NOT supported. Any post saying that you're trying to use raspivid with this chip will get shut down very fast and abruptly, potentially to the extent of deleting the post.
Running dual TC358743's with the kernel drivers is possible.
viewtopic.php?p=1430266#p1430266
although if you're running on a CM4 then you want to use i2c_vc instead of i2c_arm.
I seem to recall another similar thread, but I'm not going searching for it.
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

felix808
Posts: 5
Joined: Mon Feb 08, 2021 3:43 pm

Re: Two B102 TC358743 simultaneously on CM4

Thu Feb 11, 2021 1:00 pm

Thank you 6by9 for your prompt answer.
Ok, so I won't use raspivid with this module, because it is not supported.

Regarding
Running dual TC358743's with the kernel drivers is possible.
viewtopic.php?p=1430266#p1430266
although if you're running on a CM4 then you want to use i2c_vc instead of i2c_arm.
I seem to recall another similar thread, but I'm not going searching for it.
My current kernel is 5.10 and TC358743 driver seems to be installed already into Raspberry Pi OS I have downloaded from official page.
Do I need to unload/deinstall this and reload TC358743 kernel driver manually to set it up the way it is described in the link above?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 13567
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Two B102 TC358743 simultaneously on CM4

Thu Feb 11, 2021 1:15 pm

Save the following as tct358743-cam0-overlay.dts

Code: Select all

// SPDX-License-Identifier: GPL-2.0-only
// Definitions for Toshiba TC358743 HDMI to CSI2 bridge on CAM0 of CMIO
/dts-v1/;
/plugin/;

/{
	compatible = "brcm,bcm2835";

	fragment@0 {
		target = <&i2c_vc>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			tc358743@0f {
				compatible = "toshiba,tc358743";
				reg = <0x0f>;
				status = "okay";

				clocks = <&tc358743_clk>;
				clock-names = "refclk";

				port {
					tc358743: endpoint {
						remote-endpoint = <&csi0_ep>;
						clock-lanes = <0>;
						clock-noncontinuous;
						link-frequencies =
							/bits/ 64 <486000000>;
					};
				};
			};
		};
	};

	fragment@1 {
		target = <&csi0>;
		__overlay__ {
			status = "okay";

			port {
				csi0_ep: endpoint {
					remote-endpoint = <&tc358743>;
				};
			};
		};
	};

	fragment@2 {
		target = <&tc358743>;
		__overlay__ {
			data-lanes = <1 2>;
		};
	};

	fragment@3 {
		target = <&tc358743>;
		__dormant__ {
			data-lanes = <1 2 3 4>;
		};
	};

	fragment@4 {
		target = <&i2c0if>;
		__overlay__ {
			status = "okay";
		};
	};

	fragment@5 {
		target = <&i2c0mux>;
		__overlay__ {
			status = "okay";
		};
	};

	fragment@6 {
		target-path = "/";
		__overlay__ {
			tc358743_clk: bridge-clk {
				compatible = "fixed-clock";
				#clock-cells = <0>;
				clock-frequency = <27000000>;
			};
		};
	};

	fragment@7 {
		target = <&csi0_ep>;
		__overlay__ {
			data-lanes = <1 2>;
		};
	};

	fragment@8 {
		target = <&csi0_ep>;
		__dormant__ {
			data-lanes = <1 2 3 4>;
		};
	};

	__overrides__ {
		4lane = <0>, "-2+3-7+8";
		link-frequency = <&tc358743>,"link-frequencies#0";
	};
};
Run

Code: Select all

sudo dtc -@ -I dts -O dtb -o /boot/overlays/tc3538743-cam0.dtbo tc358743-cam0-overlay.dts 
to compile it and copy it to the boot directory.
"sudo nano /boot/config.txt" and add the line

Code: Select all

dtoverlay=tc358743-cam0
(that should be in addition to your existing line "dtoverlay=tc358743").
Reboot.

(There should be a way to parameterise the overlays so that you can do "dtoverlay=tc358743,cam0" or similar to automatically switch it all over, but that's not been sorted yet. The above is the intermediate step until that is resolved, and the reason why I haven't merged a duplicate set of all the overlays for cam0).
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

felix808
Posts: 5
Joined: Mon Feb 08, 2021 3:43 pm

Re: Two B102 TC358743 simultaneously on CM4

Mon Feb 15, 2021 3:16 pm

Up to now I have removed dtblob.bin from /boot/ folder

I have compiled tc358743-cam0-overlay.dts like this

Code: Select all

sudo dtc -@ -I dts -O dtb -o /boot/overlays/tc358743-cam0.dtbo tc358743-cam0-overlay.dts 

and added

Code: Select all

dtoverlay=tc358743
dtoverlay=tc358743-cam0
The result is

Code: Select all

pi@raspberrypi:~ $ v4l2-ctl --list-devices
bcm2835-codec-decode (platform:bcm2835-codec):
	/dev/video10
	/dev/video11
	/dev/video12

bcm2835-isp (platform:bcm2835-isp):
	/dev/video13
	/dev/video14
	/dev/video15
	/dev/video16

unicam (platform:fe801000.csi):
	/dev/video0
	/dev/video1
This seems to look good

I can access csi port cam1 (/dev/video0) with yavta and gstreamer.
But still have no access to csi port cam0 (/dev/video1).

Adding

Code: Select all

dtparam=i2c_arm=on
dtparam=i2c_vc=on
to config.txt, I can access to both /dev/i2c-0 and /dev/i2c-1.
Otherwise only /dev/i2c-0 is available.

Code: Select all

pi@raspberrypi: $ ls /dev/i2*
/dev/i2c-0  /dev/i2c-1  /dev/i2c-10  /dev/i2c-11

pi@raspberrypi: $ i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- UU
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
pi@raspberrypi: $ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         

With that given raspi-gpio gives me:

Code: Select all

pi@raspberrypi:~ $  raspi-gpio get
BANK0 (GPIO 0 to 27):
GPIO 0: level=1 fsel=4 alt=0 func=SDA0 pull=UP
GPIO 1: level=1 fsel=4 alt=0 func=SCL0 pull=UP
GPIO 2: level=1 fsel=4 alt=0 func=SDA1 pull=UP
GPIO 3: level=1 fsel=4 alt=0 func=SCL1 pull=UP
GPIO 4: level=1 fsel=0 func=INPUT pull=UP
GPIO 5: level=1 fsel=0 func=INPUT pull=UP
GPIO 6: level=1 fsel=0 func=INPUT pull=UP
GPIO 7: level=1 fsel=0 func=INPUT pull=UP
GPIO 8: level=1 fsel=0 func=INPUT pull=UP
GPIO 9: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 10: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 11: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 12: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 13: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 14: level=1 fsel=0 func=INPUT pull=NONE
GPIO 15: level=1 fsel=0 func=INPUT pull=UP
GPIO 16: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 17: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 18: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 19: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 20: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 21: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 22: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 23: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 24: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 25: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 26: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 27: level=0 fsel=0 func=INPUT pull=DOWN
BANK1 (GPIO 28 to 45):
GPIO 28: level=1 fsel=2 alt=5 func=RGMII_MDIO pull=UP
GPIO 29: level=0 fsel=2 alt=5 func=RGMII_MDC pull=DOWN
GPIO 30: level=1 fsel=7 alt=3 func=CTS0 pull=UP
GPIO 31: level=1 fsel=7 alt=3 func=RTS0 pull=NONE
GPIO 32: level=1 fsel=7 alt=3 func=TXD0 pull=NONE
GPIO 33: level=1 fsel=7 alt=3 func=RXD0 pull=UP
GPIO 34: level=0 fsel=7 alt=3 func=SD1_CLK pull=NONE
GPIO 35: level=1 fsel=7 alt=3 func=SD1_CMD pull=UP
GPIO 36: level=1 fsel=7 alt=3 func=SD1_DAT0 pull=UP
GPIO 37: level=1 fsel=7 alt=3 func=SD1_DAT1 pull=UP
GPIO 38: level=1 fsel=7 alt=3 func=SD1_DAT2 pull=UP
GPIO 39: level=1 fsel=7 alt=3 func=SD1_DAT3 pull=UP
GPIO 40: level=1 fsel=0 func=INPUT pull=NONE
GPIO 41: level=1 fsel=0 func=INPUT pull=NONE
GPIO 42: level=0 fsel=1 func=OUTPUT pull=NONE
GPIO 43: level=1 fsel=0 func=INPUT pull=NONE
GPIO 44: level=1 fsel=0 func=INPUT pull=NONE
GPIO 45: level=1 fsel=0 func=INPUT pull=NONE
BANK2 (GPIO 46 to 53):
GPIO 46: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 47: level=0 fsel=0 func=INPUT pull=DOWN
GPIO 48: level=0 fsel=4 alt=0 func=SD0_CLK pull=DOWN
GPIO 49: level=0 fsel=4 alt=0 func=SD0_CMD pull=DOWN
GPIO 50: level=0 fsel=4 alt=0 func=SD0_DAT0 pull=DOWN
GPIO 51: level=0 fsel=4 alt=0 func=SD0_DAT1 pull=DOWN
GPIO 52: level=0 fsel=4 alt=0 func=SD0_DAT2 pull=DOWN
GPIO 53: level=0 fsel=4 alt=0 func=SD0_DAT3 pull=DOWN
Physically I did not connect any GPIO pins. Is this necessary for CM4?
Only Jumper 6 is bridged for Dual Cam setup. Nothing else.

Thanks in advance for your help 6by9
Last edited by felix808 on Mon Feb 15, 2021 9:27 pm, edited 2 times in total.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 13567
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Two B102 TC358743 simultaneously on CM4

Mon Feb 15, 2021 9:20 pm

Each tc358743 will report as two /dev/video devices (that needs to be cleaned up, but there you go). Two TC358743's will show up as /dev/video0 - /dev/video3.
Your TC358743 on CAM0 is detected via /dev/i2c-0 at address 0x0f. If you had the overlay loading correctly then it would report as UU to denote a kernel driver having been loaded.
CAM1 will be shown via /dev/i2c-10, and "sudo i2cdetect -y 10" should show you the UU at address 0f.

I've got a single overlay with parameterisation working. WIP patch is https://github.com/raspberrypi/linux/pull/4140 which will get updated tomorrow.
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

felix808
Posts: 5
Joined: Mon Feb 08, 2021 3:43 pm

Re: Two B102 TC358743 simultaneously on CM4

Mon Feb 15, 2021 9:46 pm

In your first example line:

Code: Select all

sudo dtc -@ -I dts -O dtb -o /boot/overlays/tc3538743-cam0.dtbo tc358743-cam0-overlay.dts 
there was a typo tc3538743-cam0.dtbo

and

Code: Select all

dtoverlay=tc358743-cam0
did not load correctly.

I have updated the results above

only

Code: Select all

dtparam=i2c_vc=on
is enabled

Now it looks like this:

Code: Select all


i@raspberrypi:~ $ ls /dev/i2c*
/dev/i2c-0  /dev/i2c-10  /dev/i2c-11

pi@raspberrypi:~ $ sudo i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- UU 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         


pi@raspberrypi:~ $ sudo i2cdetect -y 10
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- 0c -- -- 0f 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 2f 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- 51 -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         

pi@raspberrypi:~ $ sudo i2cdetect -y 11
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- UU 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- -- 
Still no luck with 2nd module.

felix808
Posts: 5
Joined: Mon Feb 08, 2021 3:43 pm

Re: Two B102 TC358743 simultaneously on CM4

Mon Feb 15, 2021 10:30 pm

Got it working now.
clock name problem in overlay file.
changed it.
now it's working.

Thank you for your help!!!

Return to “Compute Module”