From owner-freebsd-arm@freebsd.org Tue Nov 26 22:28:18 2019 Return-Path: Delivered-To: freebsd-arm@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2AC9D1C3487 for ; Tue, 26 Nov 2019 22:28:18 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47Mz7j4WSCz4LWm for ; Tue, 26 Nov 2019 22:28:17 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1574807296; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=IQ4WsXu3Re9KgZlEPXI6yvPRQwwtT+5A0au0Cdp2XqCRf++MqCV9Zv2OOTEa/6Z6Ihjum6XdqKNmv ny7y97q+e123k1/eu3ajQhFaSgR9EgB8oiSHozXFaMBr7T/1vpsQMGjYWMeK4XjckBGoPutxhzvjxU no6HnQBLarWzJLN3jVh+B1e7B1kvVhlys+seBROaj1GJz+n2oEqbu/sRVfPbxjrCmUIdltxJZbVwlC CAvCj9Da/YC8zsFftSWYiwOJ5HKapKs39br3G11OhWCbGcIn9Hgsty28gT0tmJJPSa4YdXX04FrNmF NUJxseBFm05fqDsCX2PR7EK+CunAVpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=ZNg7FSjkx9Y4iJb6prTw9kp/7mCuvOq0JRTr4W90goA=; b=gD7W+J4MI4hecFrmirAhx4T6Mk+9Wqu8IfoEmmgwu6UiqQPOi3eDSt+VSOevEawKS1whHf+gcqNWX zmRx1xuFYm1v2xhateQ5kpJzxl8MtFb8qRSbpwtA3lUdL58p6glQTq+uMB6A+l7JPKLdCBDHpOkBgy 8GJO67bH9O0wHV/4ghwHkfFeHEqCkmpD3qyvC5WN0xMAXE9HSCNyoT0CmNi4OUUYpQ3MCyXDbjp7ra xH6uvjfVziELwjdU8YX1HYewXAcp6reZjsQO8XBqJIOp5YQ+8xEY/9ECFP1pcEf5l5keQtiNYprySN /57abZc3JM60tbs5X0zOptSrjLSMU1Q== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=ZNg7FSjkx9Y4iJb6prTw9kp/7mCuvOq0JRTr4W90goA=; b=uKz6IM56YPq6qzas13PmV5G3vt0YFtk0FpTxNEbbOZ1t58XCBb2l/JrEX+/SIsv9+a/TZgeFny/c6 uP/qNMCm1BfJ2gz9UVgLQyzq/PZBi9gnmye46t2eK59VpHQ+47V9j2aVnGUZD/IRp+OED1nqfPPZXl pmybOWNkzSw9MSSH7Lpvo8erFRTkKu/fdBV2mYn3SfqSrUd3WvyLAigJd77lZeDM++3hX0ECRtZZVj 5i/kJ6A8hePEbrJYaI+69xBsC5MgepUMjmLRYQn2uFaEjS9gdROYPBzjQ4CLM128yOCt9fFe5z4rCa Z46yCxan+qWQW3rXDQUfc9fqa+ReMkg== X-MHO-RoutePath: aGlwcGll X-MHO-User: 0888287c-109c-11ea-b80c-052b4a66b6b2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id 0888287c-109c-11ea-b80c-052b4a66b6b2; Tue, 26 Nov 2019 22:28:14 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id xAQMSDtn073974; Tue, 26 Nov 2019 15:28:13 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: rpi3 clock drift From: Ian Lepore To: James Shuriff , "freebsd-arm@freebsd.org" Date: Tue, 26 Nov 2019 15:28:13 -0700 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47Mz7j4WSCz4LWm X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.67 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.81)[-0.808,0]; NEURAL_HAM_LONG(-0.87)[-0.866,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US] X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Nov 2019 22:28:18 -0000 On Tue, 2019-11-26 at 22:03 +0000, James Shuriff wrote: > My Raspberry Pi 3 Model B is having some serious clock drift issues. > Ntpd doesn't function even with ntpd_sync_on_start, which calls ntpd > with -g and allows the initial adjustment to exceed the panic > threshold. This doesn't help me much because the system will continue > to drift very quickly and that option only helps for the initial > adjustment. > > I was thinking of ordering an I2C RTC but I'm unsure how to make > FreeBSD aware of the clock. > > There is a file in the Raspberry Pi firmware repo called i2c-rtc.dtbo > and it contains defs for clocks like DS1307 so I am assuming I can > add this to config.txt, build U-Boot with CONFIG_RTC_DS1307 (or > whatever model), and build the kernel with device support for the > clock but I'm not completely sure if I'm going about this the right > way. Beyond just getting FreeBSD to see the clock I'm unsure how to > tell FreeBSD to use it. Any advice? > > Thanks, > > - James Shuriff > You're on the right basic track for the RTC... you need to enable the overlay for the model you choose in config.txt, and add the right driver to your /boot/loader.conf (such as nxprtc_load=YES). The ds1307 is about the most generic you can get. I prefer the ones that can do sub-second precision; most of the NXP chips can do so (PCF85x3 or PCx2129). This is a nice rpi-ready one: https://www.sunfounder.com/pcf8563-real-time-clock.html But adding an rtc isn't going to fix the ntpd clock drift at all. There are 3 things I can think of that might cause that: - actual hardware trouble (some clock running too fast/slow). - bad data somewhere (clock isn't running at speed we think it is). - somehow a bad value got into /var/db/ntp/ntpd.drift It would be interesting to know what's in the ntpd.drift file now. If it's the problem, it's easy to fix, you can just rename the file to ntpd.drift.bad and restart ntpd so it'll regenerate the file. It would also be interesting to see the output of sysctl kern.timecounter from that system. -- Ian