From nobody Sat Dec 07 13:23:04 2024 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y582p5ntQz4kw55 for ; Sat, 07 Dec 2024 13:23:30 +0000 (UTC) (envelope-from darius@dons.net.au) Received: from midget.dons.net.au (midget.dons.net.au [IPv6:2403:580d:ae98:0:225:90ff:fe47:39b4]) by mx1.freebsd.org (Postfix) with ESMTP id 4Y582p12vmz4fs2 for ; Sat, 7 Dec 2024 13:23:29 +0000 (UTC) (envelope-from darius@dons.net.au) Authentication-Results: mx1.freebsd.org; none Received: from smtpclient.apple (unknown [IPv6:2403:580d:ae98:0:e580:69e6:c18e:182f]) by midget.dons.net.au (Postfix) with ESMTPSA id 54FEB74E342; Sat, 07 Dec 2024 23:53:15 +1030 (ACDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dons.net.au; s=default; t=1733577797; bh=xkctXBxZMVNEJsCVXts2S5/H+Dh10uuusQkpiR0Qkwc=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=bS6tiXY8KNCibKv6qsEgm8iQcIDYHq4HbNa9XPcbwZIRVbuAUV1ZPzSa3B7oDQWSh VA+oZDq6FhX51DtTKtWPxuic266YOL/UgY88QUF/8j4YHhz5SpdYdX09SAk1LZ/wW1 FQUNLWaUzDmyZaqQHxCIMn1q8Q9pmUIy8L6UwZjG3petUVbwxx+pg0/Bg9dDWJ8dnh pVZOZ4a2oCtBLsU8t1hwrY7f139Y7VKYvcgqsny1JDkeNDLcrc4hubZCnk+hwKu9BH jZH9ZQsHRcX9jOkg5XVhRCWatCkgeDyrYaRlmztHUrdebFWfL5PTjocWm9HBaE93Uy cluSxpjAx+vtQ== Content-Type: text/plain; charset=utf-8 List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.200.121\)) Subject: Re: DS1307 on rpi4B From: Daniel O'Connor In-Reply-To: Date: Sat, 7 Dec 2024 23:53:04 +1030 Cc: FreeBSD ARM List Content-Transfer-Encoding: quoted-printable Message-Id: <431FB386-F515-4D77-A855-18055A48E432@dons.net.au> References: To: =?utf-8?B?6aKo5L6G5pWj5Lq6?= X-Mailer: Apple Mail (2.3826.200.121) X-Rspamd-Action: no action X-Rspamd-Server: midget.dons.net.au X-Spam-Status: No, score=-1.10 X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:4764, ipnet:2403:5800::/27, country:AU] X-Rspamd-Queue-Id: 4Y582p12vmz4fs2 X-Spamd-Bar: ---- > On 7 Dec 2024, at 20:26, =E9=A2=A8=E4=BE=86=E6=95=A3=E4=BA=BA = 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. >=20 > 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. >=20 > dtoverlay=3Di2c-rtc,ds1307,i2c5,addr=3D0x68 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 =3D "brcm,bcm2835"; fragment@0 { target =3D <&i2c1>; __overlay__ { #address-cells =3D <1>; #size-cells =3D <0>; status =3D "okay"; ds1307: ds1307@68 { compatible =3D "maxim,ds1307"; reg =3D <0x68>; status =3D "okay"; }; }; }; __overrides__ { ds1307 =3D <&ds1307>,"status"; }; }; And in /boot/msdos/config.txt: [all] ... # DS1307 RTC dtoverlay=3Dds1307 [pi4] gpio=3D2,3=3Da0 I got the last line from = https://lists.freebsd.org/pipermail/freebsd-arm/2021-May/023713.html After that=20 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