We use some essential cookies to make our website work.

We use optional cookies, as detailed in our cookie policy, to remember your settings and understand how you use our website.

8 posts • Page 1 of 1
stevend
Posts: 947
Joined: Fri Oct 11, 2013 12:28 pm

CM5 I2C4, I2C6

Mon Nov 03, 2025 2:55 pm

I'm trying to configure a CM5, and running out of pins!

GPIO34, GPIO35, GPIO38, GPIO39 are assigned to the camera interface, which I do not need.
pinctrl shows that these pins can be configured as i2c4 and i2c6.
Is there anything about these ports which would preclude use as "ordinary" i2c ports?

There's nothing about these two ports in the device tree readme in the boot directory (assuming they would be referred to as i2c4-pi5, i2c6-pi5), so is the device tree entry shown in the first post of viewtopic.php?t=389831 correct (other than changing instance numbers)?

Thanks

Note: There seems to be very little information on I2C as a topic in the official documentation; most of what I've found is from snippets in these (and other) forums, and Pi5/CM5-related information seems particularly scarce.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6874
Joined: Mon Sep 29, 2014 1:07 pm

Re: CM5 I2C4, I2C6

Mon Nov 03, 2025 3:21 pm

On CM5, the I2C on GPIOs 38 & 39, that you have identified as i2c6, is also know as i2c_csi_dsi0. As such, it can be enabled with "dtparam=i2c_dsi_dsi0=on", and it will appear as /dev/i2c10.

However, GPIOs 34 & 35 are connected to CD0_IO_MICCLK and CD0_IO_MICDATA and not used for I2C.i2c_csi_dsi1, the equivalent I2C for the other CAM/DISP connector, is wired to I2C0 on GPIOs 0 & 1. (On a Pi 5 it uses I2C4 on GPIOs 40 & 41.) The result of this is that there is currently no overlay or dtparam to enable I2C4 on GPIOs 34 & 35, even though that should be a legal configuration.

stevend
Posts: 947
Joined: Fri Oct 11, 2013 12:28 pm

Re: CM5 I2C4, I2C6

Mon Nov 03, 2025 5:10 pm

PhilE wrote:
Mon Nov 03, 2025 3:21 pm
On CM5, the I2C on GPIOs 38 & 39, that you have identified as i2c6, is also know as i2c_csi_dsi0. As such, it can be enabled with "dtparam=i2c_dsi_dsi0=on", and it will appear as /dev/i2c10.

However, GPIOs 34 & 35 are connected to CD0_IO_MICCLK and CD0_IO_MICDATA and not used for I2C.i2c_csi_dsi1, the equivalent I2C for the other CAM/DISP connector, is wired to I2C0 on GPIOs 0 & 1. (On a Pi 5 it uses I2C4 on GPIOs 40 & 41.) The result of this is that there is currently no overlay or dtparam to enable I2C4 on GPIOs 34 & 35, even though that should be a legal configuration.
Thanks Phil; that's at least one port I've gained.

From what you say there may be a couple of incomplete definitions/errors in the CM5 data sheet; it says that GPIOs 34 & 35 are CAM_GPIO0 and CAM_GPIO1.

Your comment suggests that it might be possible to create an overlay to get I2C onto GPIOs 34 & 35 - or is there something that cannot be disabled using the pins already?

aBUGSworstnightmare
Posts: 13432
Joined: Tue Jun 30, 2015 1:35 pm

Re: CM5 I2C4, I2C6

Mon Nov 03, 2025 5:33 pm

https://github.com/raspberrypi/linux/bl ... #L677-L754
PhilE wrote: However, GPIOs 34 & 35 are connected to CD0_IO_MICCLK and CD0_IO_MICDATA
sorry, which signals are that? on a CM5IO; could not spot them from the schematics in the data sheet.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6874
Joined: Mon Sep 29, 2014 1:07 pm

Re: CM5 I2C4, I2C6

Mon Nov 03, 2025 5:35 pm

From what you say there may be a couple of incomplete definitions/errors in the CM5 data sheet; it says that GPIOs 34 & 35 are CAM_GPIO0 and CAM_GPIO1.
This is where I have to tread carefully because the Pi 4/CM4/Pi 5/CM5 differences are confusing (to me, at least).

Assuming my CM5IO schematic is correct, what would be called cam_gpio and wired to pin 17 of both camera connectors on CM4IO, on CM5IO only goes to pin17 of CAM0 (the trace is called CD0_IO_MICCLK, which is one of the alt function names). This ultimately can be traced back to GPIO34.

GPIO35 is wired to a 100-way connector pin that was nEXTRST on CM4, which on CM5IO is connected to pin18 of the CAM0.

pin17 of CAM1 (what would have been cam_gpio1) is tied high, and pin 18 on the same connector is not connected.
Your comment suggests that it might be possible to create an overlay to get I2C onto GPIOs 34 & 35
Yes, I think that should be do-able. I can't see any second uses, pulls etc. that would prevent that.

stevend
Posts: 947
Joined: Fri Oct 11, 2013 12:28 pm

Re: CM5 I2C4, I2C6

Mon Nov 03, 2025 5:42 pm

PhilE wrote:
Mon Nov 03, 2025 5:35 pm
From what you say there may be a couple of incomplete definitions/errors in the CM5 data sheet; it says that GPIOs 34 & 35 are CAM_GPIO0 and CAM_GPIO1.
This is where I have to tread carefully because the Pi 4/CM4/Pi 5/CM5 differences are confusing (to me, at least).

Assuming my CM5IO schematic is correct, what would be called cam_gpio and wired to pin 17 of both camera connectors on CM4IO, on CM5IO only goes to pin17 of CAM0 (the trace is called CD0_IO_MICCLK, which is one of the alt function names). This ultimately can be traced back to GPIO34.

GPIO35 is wired to a 100-way connector pin that was nEXTRST on CM4, which on CM5IO is connected to pin18 of the CAM0.

pin17 of CAM1 (what would have been cam_gpio1) is tied high, and pin 18 on the same connector is not connected.
I've been looking at the pinout table of the CM5 (Chapter 4, page 25 in the data sheet) which shows CAM_GPIO0 on pin 97 and CAM_GPIO1 on pin 100.

PhilE wrote:
Mon Nov 03, 2025 5:35 pm
Your comment suggests that it might be possible to create an overlay to get I2C onto GPIOs 34 & 35
Yes, I think that should be do-able. I can't see any second uses, pulls etc. that would prevent that.
I've had a look at the overlay for i2c3-pi5, and it appears relatively trivial to change the numbers and recompile (even speaking as a total beginner with device tree, so no doubt I'll be proved wrong!).

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6874
Joined: Mon Sep 29, 2014 1:07 pm

Re: CM5 I2C4, I2C6

Mon Nov 03, 2025 8:36 pm

There is a bit more work to do for i2c4. The basic declaration of the RP1 2c4 interface is:

Code: Select all

		rp1_i2c4: i2c@80000 {
			reg = <0xc0 0x40080000 0x0 0x1000>;
			compatible = "snps,designware-i2c";
			interrupts = <RP1_INT_I2C4 IRQ_TYPE_LEVEL_HIGH>;
			clocks = <&rp1_clocks RP1_CLK_SYS>;
			i2c-scl-rising-time-ns = <65>;
			i2c-scl-falling-time-ns = <100>;
			status = "disabled";
		};
The Pi 5 dts has this bit:

Code: Select all

i2c_csi_dsi1: &i2c4 { // Note: This is for MIPI1 connector only
	pinctrl-0 = <&rp1_i2c4_40_41>;
	pinctrl-names = "default";
	clock-frequency = <100000>;
	symlink = "i2c-4";
};
i2c3-pi5-overlay.dts is:

Code: Select all

/dts-v1/;
/plugin/;
/{
	compatible = "brcm,bcm2712";
	fragment@0 {
		target = <&i2c3>;
		frag0: __overlay__ {
			status = "okay";
			clock-frequency = <100000>;
			pinctrl-0 = <&rp1_i2c3_6_7>;
		};
	};
	__overrides__ {
		pins_6_7 = <&frag0>,"pinctrl-0:0=", <&rp1_i2c3_6_7>;
		pins_14_15 = <&frag0>,"pinctrl-0:0=", <&rp1_i2c3_14_15>;
		pins_22_23 = <&frag0>,"pinctrl-0:0=", <&rp1_i2c3_22_23>;
		baudrate = <&frag0>, "clock-frequency:0";
	};
};
Comparing those, it is possible to see (if not obvious) that with a minimal change to i2c-pi3, you would end up without:

Code: Select all

			pinctrl-names = "default";
Fortunately for you, I was thorough in declaring the pinmux options, so rp1_i2c4_34_35 already exists:

Code: Select all

			rp1_i2c4_34_35: rp1_i2c4_34_35 {
				function = "i2c4";
				pins = "gpio34", "gpio35";
				drive-strength = <12>;
				bias-pull-up;
			};

stevend
Posts: 947
Joined: Fri Oct 11, 2013 12:28 pm

Re: CM5 I2C4, I2C6

Tue Nov 04, 2025 1:02 pm

Thanks Phil; I'll give it a go once I've got my ducks in a row.

8 posts • Page 1 of 1

Return to "Compute Module"

AltStyle によって変換されたページ (->オリジナル) /