CM5 I2C4, I2C6
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.
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
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.
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.
Re: CM5 I2C4, I2C6
Thanks Phil; that's at least one port I've gained.PhilE wrote: ↑Mon Nov 03, 2025 3:21 pmOn 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.
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
https://github.com/raspberrypi/linux/bl ... #L677-L754
sorry, which signals are that? on a CM5IO; could not spot them from the schematics in the data sheet.PhilE wrote: However, GPIOs 34 & 35 are connected to CD0_IO_MICCLK and CD0_IO_MICDATA
- 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
This is where I have to tread carefully because the Pi 4/CM4/Pi 5/CM5 differences are confusing (to me, at least).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.
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.
Yes, I think that should be do-able. I can't see any second uses, pulls etc. that would prevent that.Your comment suggests that it might be possible to create an overlay to get I2C onto GPIOs 34 & 35
Re: CM5 I2C4, I2C6
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 pmThis is where I have to tread carefully because the Pi 4/CM4/Pi 5/CM5 differences are confusing (to me, at least).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.
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 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
There is a bit more work to do for i2c4. The basic declaration of the RP1 2c4 interface is:
The Pi 5 dts has this bit:
i2c3-pi5-overlay.dts is:
Comparing those, it is possible to see (if not obvious) that with a minimal change to i2c-pi3, you would end up without:
Fortunately for you, I was thorough in declaring the pinmux options, so rp1_i2c4_34_35 already exists:
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";
};
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";
};
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";
};
};
Code: Select all
pinctrl-names = "default";
Code: Select all
rp1_i2c4_34_35: rp1_i2c4_34_35 {
function = "i2c4";
pins = "gpio34", "gpio35";
drive-strength = <12>;
bias-pull-up;
};
Re: CM5 I2C4, I2C6
Thanks Phil; I'll give it a go once I've got my ducks in a row.
Jump to
- Community
- General discussion
- Announcements
- Other languages
- Deutsch
- Español
- Français
- Italiano
- Nederlands
- 日本語
- Polski
- Português
- Русский
- Türkçe
- User groups and events
- Raspberry Pi Official Magazine
- Using the Raspberry Pi
- Beginners
- Troubleshooting
- Advanced users
- Assistive technology and accessibility
- Education
- Picademy
- Teaching and learning resources
- Staffroom, classroom and projects
- Astro Pi
- Mathematica
- High Altitude Balloon
- Weather station
- Programming
- C/C++
- Java
- Python
- Scratch
- Other programming languages
- Windows 10 for IoT
- Wolfram Language
- Bare metal, Assembly language
- Graphics programming
- OpenGLES
- OpenVG
- OpenMAX
- General programming discussion
- Projects
- Networking and servers
- Automation, sensing and robotics
- Graphics, sound and multimedia
- Other projects
- Media centres
- Gaming
- AIY Projects
- Hardware and peripherals
- Camera board
- Compute Module
- Official Display
- HATs and other add-ons
- Device Tree
- Interfacing (DSI, CSI, I2C, etc.)
- Keyboard computers (400, 500, 500+)
- Raspberry Pi Pico
- General
- SDK
- MicroPython
- Other RP2040 boards
- Zephyr
- Rust
- AI Accelerator
- AI Camera - IMX500
- Hailo
- Software
- Raspberry Pi OS
- Raspberry Pi Connect
- Raspberry Pi Desktop for PC and Mac
- Beta testing
- Other
- Android
- Debian
- FreeBSD
- Gentoo
- Linux Kernel
- NetBSD
- openSUSE
- Plan 9
- Puppy
- Arch
- Pidora / Fedora
- RISCOS
- Ubuntu
- Ye Olde Pi Shoppe
- For sale
- Wanted
- Off topic
- Off topic discussion