Date: Sat, 7 Dec 2024 19:03:06 +0900 From: =?UTF-8?B?6aKo5L6G5pWj5Lq6?= <furaisanjin@gmail.com> To: FreeBSD ARM List <freebsd-arm@freebsd.org> Subject: Re: DS1307 on rpi4B Message-ID: <CAJzLSny3AicJS_Hy73pyuWnC92esfn0vTJNFwS1U==qzSwg9ag@mail.gmail.com> In-Reply-To: <CAJzLSnxOALkCztZUa-zpUH30g1O0nUfQb4X2=4o_VDv3WTEdaQ@mail.gmail.com> References: <CAJzLSnxOALkCztZUa-zpUH30g1O0nUfQb4X2=4o_VDv3WTEdaQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000ec99a60628ab3c73 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I forgot mentioning the FreeBSD version. I=E2=80=99m still using 14.1. 2024=E5=B9=B412=E6=9C=887=E6=97=A5=E5=9C=9F=E6=9B=9C=E6=97=A5 =E9=A2=A8=E4= =BE=86=E6=95=A3=E4=BA=BA <furaisanjin@gmail.com>: > Hello all, > > 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=3Di2c-rtc,ds1307,i2c5,addr=3D0x68 > > iic1 is detected at boot but it can't talk to DS1307. > > # dmesg | egrep iic\|ds1307 > iichb0: <BCM2708/2835 BSC controller> mem 0x7e804000-0x7e804fff irq 27 on > simplebus0 > iichb1: <BCM2708/2835 BSC controller> mem 0x7e205a00-0x7e205bff irq 52 on > simplebus0 > iicbus0: <OFW I2C bus> on iichb0 > iic0: <I2C generic I/O> on iicbus0 > iicbus1: <OFW I2C bus> on iichb1 > iic1: <I2C generic I/O> on iicbus1 > ds13070: <Dallas DS1307> at addr 0xd0 on iicbus1 > ds13070: is_dev_time_valid: cannot read from RTC: 35 > ds13070: WARNING: RTC clock stopped, check the battery. > ds13070: registered as a time-of-day clock, resolution 1.000000s > ds13070: ds1307_gettime: cannot read from RTC: 35 > ds13070: ds1307_settime: cannot write to RTC: 35 > > The command "i2c -s -v -f /dev/iic1" can't detect anything at all. The pi= n > function doesn't seem to be correct. > # sysctl -a dev.gpio.0.pin|grep 1[23] > dev.gpio.0.pin.13.function: input > dev.gpio.0.pin.12.function: input > > If I set alt5 on these pins by sysctl and change pin configuration by > gpioctl to enable internal pullup, iic1 works fine. > --- > for p in 12 13 > do > sysctl dev.gpio.0.pin.$p.function=3Dalt5 > gpioctl -c $p PU > done > i2c -s -v -f /dev/iic1 > /root/src/ds1307 -r -a 0x68 -f /dev/iic1 > --- > > I'm not familiar with dts stuff but I wrote overlay dts like this. > /dts-v1/; > /plugin/; > / { > > compatible =3D "raspberrypi,4-model-b", "brcm,bcm2711"; > fragment@0 { > target =3D <&i2c5>; > __overlay__ { > brcm,pins =3D <12 13>; > brcm,function =3D <2>; > brcm,pull =3D <2 2>; > status =3D "okay"; > }; > > }; > }; > However this doesn't work at all. How can I configure gpio12/13 for i2c5? > > Best regards, > furaisanjin > > > --000000000000ec99a60628ab3c73 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I forgot mentioning the FreeBSD version. I=E2=80=99m still using 14.1.<br><= br>2024=E5=B9=B412=E6=9C=887=E6=97=A5=E5=9C=9F=E6=9B=9C=E6=97=A5 =E9=A2=A8= =E4=BE=86=E6=95=A3=E4=BA=BA <<a href=3D"mailto:furaisanjin@gmail.com">fu= raisanjin@gmail.com</a>>:<br><blockquote class=3D"gmail_quote" style=3D"= margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"= ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div>Hello all,</div><div><br></div>= <div>I'm trying connect DS1307 on rpi4B (8M). I'm not sure how much= I can rely on the description in <a href=3D"https://github.com/raspberrypi= /firmware/tree/master/boot/overlays" target=3D"_blank">https://github.com/<= wbr>raspberrypi/firmware/tree/<wbr>master/boot/overlays</a> because I don&#= 39;t know the difference between linux boot loader and FreeBSD one.</div><d= iv><br></div><div>I want to connect DS1307 on GPIO12/13 pin as i2c5 so I as= sumed i2c-rtc could be used so that I added one line in config.txt like bel= ow.</div><div><br></div><div>dtoverlay=3Di2c-rtc,ds1307,i2c5,<wbr>addr=3D0x= 68</div><div><br></div><div>iic1 is detected at boot but it can't talk = to DS1307.</div><div><br></div><div># dmesg | egrep iic\|ds1307<br>iichb0: = <BCM2708/2835 BSC controller> mem 0x7e804000-0x7e804fff irq 27 on sim= plebus0<br>iichb1: <BCM2708/2835 BSC controller> mem 0x7e205a00-0x7e2= 05bff irq 52 on simplebus0<br>iicbus0: <OFW I2C bus> on iichb0<br>iic= 0: <I2C generic I/O> on iicbus0<br>iicbus1: <OFW I2C bus> on ii= chb1<br>iic1: <I2C generic I/O> on iicbus1<br>ds13070: <Dallas DS1= 307> at addr 0xd0 on iicbus1<br>ds13070: is_dev_time_valid: cannot read = from RTC: 35<br>ds13070: WARNING: RTC clock stopped, check the battery.<br>= ds13070: registered as a time-of-day clock, resolution 1.000000s<br>ds13070= : ds1307_gettime: cannot read from RTC: 35<br>ds13070: ds1307_settime: cann= ot write to RTC: 35</div><div><br></div><div>The command "i2c -s -v -f= /dev/iic1" can't detect anything at all. The pin function doesn&#= 39;t seem to be correct.</div><div></div><div># sysctl -a dev.gpio.0.pin|gr= ep 1[23]</div><div>dev.gpio.0.pin.13.function: input<br>dev.gpio.0.pin.12.f= unction: input</div><div><br></div><div>If I set alt5 on these pins by sysc= tl and change pin configuration by gpioctl to enable internal pullup, iic1 = works fine.</div><div></div><div>---<br></div><div>for p in 12 13<br>do<br>= =C2=A0 sysctl dev.gpio.0.pin.$p.function=3D<wbr>alt5<br>=C2=A0 gpioctl -c $= p PU<br>done<br>i2c -s -v -f /dev/iic1<br>/root/src/ds1307 -r -a 0x68 -f /d= ev/iic1</div><div>---</div><div><br></div><div>I'm not familiar with dt= s stuff but I wrote overlay dts like this.</div><div>/dts-v1/;<br>/plugin/;= <br>/ =C2=A0{<br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 compatible =3D "raspb= errypi,4-model-b", "brcm,bcm2711";<br>=C2=A0 =C2=A0 =C2=A0 = =C2=A0 fragment@0 {<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 target =3D <&i2c5>;<br>=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 _= _overlay__ {<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 brcm,pins =3D <12 13>;<br>=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 brcm,fun= ction =3D <2>;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 brcm,pull =3D <2 2>;<br>=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 s= tatus =3D "okay";<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 };<br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 };<br>};</div><div>Howe= ver this doesn't work at all. How can I configure gpio12/13 for i2c5?</= div><div><br></div><div>Best regards,</div><div>furaisanjin</div><div><br><= /div><div><br></div></div> </div> </div> </blockquote> --000000000000ec99a60628ab3c73--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJzLSny3AicJS_Hy73pyuWnC92esfn0vTJNFwS1U==qzSwg9ag>