Re: DS1307 on rpi4B

From: 風來散人 <furaisanjin_at_gmail.com>
Date: Sun, 08 Dec 2024 02:05:38 UTC
Hello Daniel.

Thank you for the suggestion. I created dtso file for my HW configuration
like this.

/dts-v1/;
/plugin/;

/ {
        compatible = "brcm,bcm2835";

        fragment@0 {
                target = <&i2c5>;
                __overlay__ {
                        #address-cells = <1>;
                        #size-cells = <0>;
                        status = "okay";
                        ds1307: ds1307@68 {
                                compatible = "dallas,ds1307";
                                reg = <0x68>;
                                status = "okay";
                        };
                };
        };
        __overrides__ {
                ds1307 = <&ds1307>,"status";
        };
};

I modified config.txt to load this dtbo and add one more line to set GPIO
pins in [pi4]

gpio=12,13=a5,pu

This works fine and RTC starts working. One strange thing is that "gpioctl
-l -v" doesn't show correct pin setting somehow. I assumed there should be
PU on pin 12 and 13.

pin 12: 1       pin 12<>,
caps:<IN,OUT,PU,PD,INTRLL,INTRLH,INTRER,INTREF,INTREB>
pin 13: 1       pin 13<>,
caps:<IN,OUT,PU,PD,INTRLL,INTRLH,INTRER,INTREF,INTREB>

Best regards,
furaisanjin