Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7512

Device Tree • Custom CM5 DTS, overlay for I2C

$
0
0
Hi. I have created a custom carrier board for the CM5 in which I need to use the I2C pin on GPIO38 and GPIO39. I am not using DSI or CSI ports. I asked the GPT for helping me create that .dts file and need some help to check whats wrong with it since I am not able to see my I2C devices that are connected to the related pins.
    I have created a file named dcpcb-i2c.dts with the following content:

    Code:

    /dts-v1/;/plugin/;/ {    compatible = "brcm,bcm2712";     fragment@0 {        target = <&gpio>;        __overlay__ {            i2c_gpio_pins: i2c_gpio_pins {                brcm,pins = <38 39>; // GPIO38 (SDA), GPIO39 (SCL)                brcm,function = <0>; // Configure as GPIO (input)                brcm,pull = <0>; // No pull-up/down            };        };    };    fragment@1 {        target-path = "/";        __overlay__ {            i2c_gpio: i2c-gpio {                compatible = "i2c-gpio";                gpios = <&gpio 38 0>, // SDA (GPIO38, active high)                         <&gpio 39 0>; // SCL (GPIO39, active high)                i2c-gpio,delay-us = <2>; // ~100 kHz                #address-cells = <1>;                #size-cells = <0>;                status = "okay";            };        };    };};

    Then I compiled using:

    Code:

    dtc -@ -I dts -O dtb -o dcpcb-i2c.dtbo dcpcb-i2c.dts
    I didn't get any error, so next step was copy the .dtbo file to /boot/firmware/overlays/ with:

    Code:

    sudo cp dcpcb-i2c.dtbo /boot/firmware/overlays/
    Then I edited the /boot/firmware/config.txt file including

    Code:

    dtoverlay=dcpcb-i2c
    Finally I rebooted my device and tryed this command to check the GPIO38 and GPIO39 configuration

    Code:

    pinctrl get 38
    38: no pd | hi // SDA0/GPIO38 = none

    I have sucessfully used the same sensors with GPIO2 and GPIO3 on the CM5IO but not in my custom CM5 Carrier board.

    I appretiate if someone can help me with that.

    Statistics: Posted by MANU-IOT — Tue Aug 19, 2025 5:14 pm



    Viewing all articles
    Browse latest Browse all 7512

    Trending Articles