From nobody Fri Feb 18 22:52:01 2022 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 1DB9219C94D9 for ; Fri, 18 Feb 2022 22:52:43 +0000 (UTC) (envelope-from darius@dons.net.au) Received: from midget.dons.net.au (2403-5800-5200-4700-225-90ff-fe47-39b4.ip6.aussiebb.net [IPv6:2403:5800:5200:4700:225:90ff:fe47:39b4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "dons.net.au", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4K0n5h6FVGz3PwJ for ; Fri, 18 Feb 2022 22:52:40 +0000 (UTC) (envelope-from darius@dons.net.au) Received: from midget.dons.net.au (localhost [127.0.0.1]) by midget.dons.net.au (8.17.1/8.16.1) with ESMTPS id 21IMqJVo071219 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO) for ; Sat, 19 Feb 2022 09:22:23 +1030 (ACDT) (envelope-from darius@dons.net.au) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=dons.net.au; s=default; t=1645224746; bh=XUAPU3WD0clXHTCfpy5SmRin7GWFYzAqwxhSB5gDYXs=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=kovzbfvLmsSWYESGdBOslqQqvKauHYkNLfInNrnxyTi9Q3c5AxAmLCr0czFaMSJwI 4s4Y9NQxdAVX/5nw9gK/iZAr86otgEG62JGVPlNFUmdFnPEnXZheXlkWEXB+jw8eA8 FTyuLC9juJuZ5nLAn9FO0Og86RdLilPfoXNQVe0c= Received: (from mailnull@localhost) by midget.dons.net.au (8.17.1/8.16.1/Submit) id 21IMq1G4071212 for ; Sat, 19 Feb 2022 09:22:01 +1030 (ACDT) (envelope-from darius@dons.net.au) X-MIMEDefang-Relay-0ce1a11234c790b6ab6410cd70c6fdb820520472: 2403:5800:5200:4700:985d:2478:209b:f77a Received: from smtpclient.apple (2403-5800-5200-4700-985d-2478-209b-f77a.ip6.aussiebb.net [2403:5800:5200:4700:985d:2478:209b:f77a]) by 2403-5800-5200-4700-225-90ff-fe47-39b4.ip6.aussiebb.net (envelope-sender ) (MIMEDefang) with ESMTP id 21IMq1IZ071207; Sat, 19 Feb 2022 09:22:01 +1030 Content-Type: text/plain; charset=us-ascii 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 15.0 \(3693.40.0.1.81\)) Subject: Re: DS3231 RTC module not detected From: "Daniel O'Connor" In-Reply-To: Date: Sat, 19 Feb 2022 09:22:01 +1030 Cc: freebsd-arm@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <2DF482A7-FEFC-4833-A16B-A7A01B8713DD@dons.net.au> References: To: Archimedes Gaviola X-Mailer: Apple Mail (2.3693.40.0.1.81) X-Spam-Score: 0.6 () No, score=0.6 required=5.0 tests=KHOP_HELO_FCRDNS, PDS_RDNS_DYNAMIC_FP,RDNS_DYNAMIC,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.5 X-Scanned-By: MIMEDefang 2.83 on 10.0.2.1 X-Rspamd-Queue-Id: 4K0n5h6FVGz3PwJ X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=dons.net.au header.s=default header.b=kovzbfvL; dmarc=pass (policy=quarantine) header.from=dons.net.au; spf=pass (mx1.freebsd.org: domain of darius@dons.net.au designates 2403:5800:5200:4700:225:90ff:fe47:39b4 as permitted sender) smtp.mailfrom=darius@dons.net.au X-Spamd-Result: default: False [-3.03 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[dons.net.au:s=default]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+mx]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-arm@freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[dons.net.au:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[dons.net.au,quarantine]; NEURAL_HAM_SHORT(-0.53)[-0.531]; MLMMJ_DEST(0.00)[freebsd-arm]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:4764, ipnet:2403:5800:5000::/36, country:AU]; MID_RHS_MATCH_FROM(0.00)[] X-ThisMailContainsUnwantedMimeParts: N Status: O Content-Length: 2219 Lines: 52 > On 19 Feb 2022, at 00:52, Archimedes Gaviola = wrote: > Thanks for the info! I followed similar with your DS1307 RTC by = creating a ds3231.dtso file and then compiling it with dtc to generate a = ds3231.dtbo. The result is it is detected as MAX77620 RTC on 0xd0 = address but when I run an i2c scan, the address detected is 68. Does = this should match? Mine was detected similarly: iic0: on iicbus0 rtc0: at addr 0xd0 on iicbus0 usbus0: 5.0Gbps Super Speed USB v3.0 rtc0: registered as a time-of-day clock, resolution 1.000000s I am not sure why it shows up like that but it does seem to work. > With this setup I could update the date and time now by initiating an = ntpdate to match our time plus invoking tzsetup command for my timezone = which is doing well without any issue. Now, the moment I shutdown the = system and plug back the power cable (with disconnected Ethernet cable = just to make sure NTP servers are not called for updates upon restart) = the time remains as it was before shutting down and then upon bootup = system clock continues. I am expecting that it should be real time even = if the RPi4 system is shutdown or detached from power due to the battery = that will sustain the continuity of the clock. I'm sure that I'm having = good DS3231 modules as I also tested my existing and another new spare = and it is tested with OpenBSD too. Below are the system info. Is there = anything I've missed? FreeBSD 13.0-RELEASE have the same outcome and = behavior. That is strange, I tested powering mine off and it kept time but I am = not 100% sure it was advancing correctly - I didn't take a precise note = of when I powered it off etc.. Unfortunately it's not physically with me so I can't test it right now. I do note this sysctl: machdep.rtc_save_period: Save system time to RTC with this period (in = seconds) Which suggests to me that the clock could be up to 30 minutes off if the = power is removed (I believe it gets flushed out on a clean shutdown = though). Perhaps that is the problem? -- Daniel O'Connor "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum