From owner-freebsd-arm@freebsd.org Mon Aug 12 00:06:13 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 DBA05C96FD for ; Mon, 12 Aug 2019 00:06:13 +0000 (UTC) (envelope-from darius@dons.net.au) Received: from ipmail02.adl2.internode.on.net (ipmail02.adl2.internode.on.net [150.101.137.139]) by mx1.freebsd.org (Postfix) with ESMTP id 466GN45qtvz4c5p for ; Mon, 12 Aug 2019 00:06:12 +0000 (UTC) (envelope-from darius@dons.net.au) Received: from ppp14-2-65-131.adl-apt-pir-bras31.tpg.internode.on.net (HELO midget.dons.net.au) ([14.2.65.131]) by ipmail02.adl2.internode.on.net with ESMTP; 12 Aug 2019 09:31:09 +0930 Received: from midget.dons.net.au (localhost [127.0.0.1]) by midget.dons.net.au (8.15.2/8.15.2) with ESMTPS id x7C00qnb023377 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Mon, 12 Aug 2019 09:31:05 +0930 (ACST) (envelope-from darius@dons.net.au) Received: (from mailnull@localhost) by midget.dons.net.au (8.15.2/8.15.2/Submit) id x7BNdooK005307 for ; Mon, 12 Aug 2019 09:09:50 +0930 (ACST) (envelope-from darius@dons.net.au) X-Authentication-Warning: midget.dons.net.au: mailnull set sender to using -f Received: from [10.0.2.38] ([10.0.2.38]) by ns.dons.net.au (envelope-sender ) (MIMEDefang) with ESMTP id x7BNdi59005304; Mon, 12 Aug 2019 09:09:50 +0930 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: Is it a good idea to use a usb-serial adapter for PPS input? Yes, it is. From: "O'Connor, Daniel" In-Reply-To: Date: Mon, 12 Aug 2019 09:09:44 +0930 Cc: "usb@freebsd.org" , "freebsd-arm@FreeBSD.org" Content-Transfer-Encoding: quoted-printable Message-Id: <61B1AAF3-40F6-47BC-8F05-7491C13BF288@dons.net.au> References: To: Ian Lepore X-Mailer: Apple Mail (2.3445.104.11) X-Spam-Score: -1 () No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.1 X-Scanned-By: MIMEDefang 2.83 on 10.0.2.1 X-Rspamd-Queue-Id: 466GN45qtvz4c5p X-Spamd-Bar: ++++++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of darius@dons.net.au has no SPF policy when checking 150.101.137.139) smtp.mailfrom=darius@dons.net.au X-Spamd-Result: default: False [6.94 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; HAS_XAW(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(2.67)[ip: (8.04), ipnet: 150.101.0.0/16(3.64), asn: 4739(1.66), country: AU(0.01)]; R_DKIM_NA(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[139.137.101.150.list.dnswl.org : 127.0.5.1]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; SUBJECT_HAS_QUESTION(0.00)[]; ARC_NA(0.00)[]; ASN(0.00)[asn:4739, ipnet:150.101.0.0/16, country:AU]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_SPAM_SHORT(0.94)[0.943,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-arm@freebsd.org]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.97)[0.972,0]; DMARC_NA(0.00)[dons.net.au]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(0.95)[0.955,0]; R_SPF_NA(0.00)[]; GREYLIST(0.00)[pass,body] X-Spam: Yes 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: Mon, 12 Aug 2019 00:06:13 -0000 > On 6 Aug 2019, at 00:12, Ian Lepore wrote: > On Mon, 2019-08-05 at 15:28 +0930, O'Connor, Daniel wrote: >>> Most people are not worried about their kernel clock being 200 >>> microseconds off from UTC, even if they're using the PPS signal from = a >>> GPS receiver. So I think most people should feel completely at ease >>> using a USB serial adapter as the input device for a PPS signal. =20 >>=20 >> Does the USB clock derive from the 10MHz Rb clock? If so that would = mean you would see a lot less jitter than a 'normal' user where the USB = clock is not locked too GPS. >>=20 >=20 > No, usb is derived from the same 24mhz crystal that clocks the cpus. = I > think usb and its need for clocks at 48 and 480mhz is why so many = small > arm systems use a 24mhz main clock. OK, I thought when you used the external clock it was being used to = derive the USB clock (eg via a PLL) hence the jitter would be low - if = not that is even better. >> Do you have a more detailed write up of things like the NTP = configuration file? I think I could replicate your test here although I = have a Beaglebone Black, not a Wanboard so I will need to check if it = can take an external clock. (We have GPS modules & Rb oscillators at = work to create reference clock for bi-static meteor applications). >>=20 > The same setup should be possible on a BBB. There is a TCLKIN pin > mentioned in the manual. Some searching on the web yields a few clues > that it might be possible to mux that to a pin on the P9 header [1].=20= > There is already a dmtpps capture driver for TI, but I'm afraid it may > have bitrotted over the past couple years. Also, even when it last > worked, it just barely worked, because the reduction of kernel > timecounters from 10 to 2 timehands causes the PPS capture to almost > always get lost on single-core processors which are in cpu_idle() at > the time the hardclock interrupt happens. (But that's fixable by just > increasing the number of timehands, I think at least 4 are required.) OK, how do I increase the number of clock hands? I have am335x_dmtpps setup from last year when I tried this previously = :) > So all in all, it's doable, but it'll take a bit of work. I can help > with the driver stuff. >=20 > The ntp config is pretty simple, it uses instances of the "atom" = clock, > which is a bare-PPS refclock which needs to be paired with any network > peer to operate. The network peer is used to obtain the initial time > of day, then the PPS signal is used to steer phase. The network peer > must be marked 'prefer' for some reason, it's just an ntp rule. In my > test setup I forced ntp to steer to the "perfect" pps signal by = marking > all the others as "noselect", otherwise any of the atom clocks would = be > eligible to be the system peer. Thanks. My current setup uses gpsd but I think that is complicating things = unnecessarily so I'll try it without that and see if I can get it = working. -- Daniel O'Connor "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum