Re: DS1307 on rpi4B
- Reply: 風來散人 : "Re: DS1307 on rpi4B"
- In reply to: 風來散人 : "DS1307 on rpi4B"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 07 Dec 2024 13:23:04 UTC
> On 7 Dec 2024, at 20:26, 風來散人 <furaisanjin@gmail.com> wrote: > I'm trying connect DS1307 on rpi4B (8M). I'm not sure how much I can rely on the description in https://github.com/raspberrypi/firmware/tree/master/boot/overlays because I don't know the difference between linux boot loader and FreeBSD one. > > I want to connect DS1307 on GPIO12/13 pin as i2c5 so I assumed i2c-rtc could be used so that I added one line in config.txt like below. > > dtoverlay=i2c-rtc,ds1307,i2c5,addr=0x68 I have the following in /boot/msdos/overlays/pijuice.dtso (which needs to be compiled to a dtbo): // Definition for RPi3 I2C based Real Time Clock /dts-v1/; /plugin/; / { compatible = "brcm,bcm2835"; fragment@0 { target = <&i2c1>; __overlay__ { #address-cells = <1>; #size-cells = <0>; status = "okay"; ds1307: ds1307@68 { compatible = "maxim,ds1307"; reg = <0x68>; status = "okay"; }; }; }; __overrides__ { ds1307 = <&ds1307>,"status"; }; }; And in /boot/msdos/config.txt: [all] ... # DS1307 RTC dtoverlay=ds1307 [pi4] gpio=2,3=a0 I got the last line from https://lists.freebsd.org/pipermail/freebsd-arm/2021-May/023713.html After that sudo i2c -f /dev/iic0 -m tr -s Shows the device. Also, be aware that currently the I2C frequency is quite a bit higher than it should be when the CPU is clocked at the maximum as the divisors are calculated based on the default clock. This doesn't seem to affect the DS1307 even though it is only rated for 100kHz. -- Daniel O'Connor "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum