From owner-freebsd-stable@freebsd.org Sat Mar 5 06:54:44 2016 Return-Path: Delivered-To: freebsd-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 930219DA646 for ; Sat, 5 Mar 2016 06:54:44 +0000 (UTC) (envelope-from peter@pean.org) Received: from system.jails.se (system.jails.se [IPv6:2001:470:6c08::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BF45187 for ; Sat, 5 Mar 2016 06:54:43 +0000 (UTC) (envelope-from peter@pean.org) Received: from system.jails.se (system.jails.se [172.31.20.14]) by system.jails.se (Postfix) with SMTP id CF20339A1 for ; Sat, 5 Mar 2016 07:54:40 +0100 (CET) Received: from [10.1.253.44] (c-5eeaaa89-74736162.cust.telenor.se [94.234.170.137]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by system.jails.se (Postfix) with ESMTPSA id 46E52399C; Sat, 5 Mar 2016 07:54:38 +0100 (CET) Content-Type: multipart/signed; boundary=Apple-Mail-0307F1A2-4FAC-40ED-BC1A-2A8F9D7D194A; protocol="application/pkcs7-signature"; micalg=sha1 Mime-Version: 1.0 (1.0) Subject: Re: PPS input on a generic GPIO pin on Raspberry Pi. From: =?utf-8?Q?Peter_Ankerst=C3=A5l?= X-Mailer: iPhone Mail (13D15) In-Reply-To: <1457114408.13785.150.camel@freebsd.org> Date: Sat, 5 Mar 2016 07:54:36 +0100 Cc: Karl Denninger , freebsd-stable@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: References: <8C90C80B-AC5F-4B12-8E84-84193B8C55C4@pean.org> <56D9BDB6.6040903@denninger.net> <1457114408.13785.150.camel@freebsd.org> To: Ian Lepore X-DSPAM-Result: Innocent X-DSPAM-Processed: Sat Mar 5 07:54:40 2016 X-DSPAM-Confidence: 0.9899 X-DSPAM-Probability: 0.0000 X-DSPAM-Signature: 56da82b0177761480015848 X-DSPAM-Factors: 27, and+#+#+#+the, 0.01000, From*Peter_Ankerst%c3%a5l, 0.01000, From*Peter_Ankerst%c3%a5l, 0.01000, Content-Disposition*filename, 0.01000, for, 0.01000, for, 0.01000, is, 0.01000, is, 0.01000, to, 0.01000, to, 0.01000, Content-Transfer-Encoding*quoted-printable, 0.01000, Content-Transfer-Encoding*base64, 0.01000, To*freebsd.org, 0.01000, Content-Disposition*smime.p7s, 0.01000, Content-Disposition*attachment, 0.01000, on, 0.01000, on, 0.01000, Content-Disposition*filename+smime.p7s, 0.01000, and, 0.01000, and, 0.01000, the, 0.01000, the, 0.01000, it, 0.01000, it, 0.01000, hours+Oh+so+#+is, 0.40000, 03+04+at, 0.40000, attractive+#+#+#+Pi, 0.40000 X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Mar 2016 06:54:44 -0000 --Apple-Mail-0307F1A2-4FAC-40ED-BC1A-2A8F9D7D194A Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > On 4 mars 2016, at 19:00, Ian Lepore wrote: >=20 >> On Fri, 2016-03-04 at 10:54 -0600, Karl Denninger wrote: >>> On 3/3/2016 12:57, Peter Ankerst=C3=A5l wrote: >>> Hi! >>>=20 >>> I have sort of exactly the same question as Erik: >>> http://lists.freebsd.org/pipermail/freebsd-questions/2014-July/2590 >>> 55.html >>>=20 >>> I have bought a https://learn.adafruit.com/adafruit-ultimate-gps an >>> d want to use the PPS output to discipline my clock. >>>=20 >>> But the only source of information on how PPS works in FreeBSD I >>> could find is this:=20 >>> https://docs.freebsd.org/doc/8.0-RELEASE/usr/share/doc/ntp/pps.html >>> and it clearly states the two ways to provide a PPS signal. "The >>> PPS signal can be connected in either of two ways: via the data >>> carrier detector (DCD) pin of a serial port or via the acknowledge >>> (ACK) pin of a parallel port=E2=80=9D >>>=20 >>> Since the Pi doesn=C2=B4t have any DCD pin i would like to use a generic= >>> GPIO for this. There is a linux kernel module for this: http://lxr. >>> free-electrons.com/source/drivers/pps/clients/pps-gpio.c?v=3D3.6 >> GPIO is supported on the Pi, I'm using it on 11-Current on my home >> control software to drive relays on my pool hardware (e.g. valves, >> heater, VFD motor drive, etc) and it is working very well. I don't >> believe tapping into that at the kernel level to expose a pps signal >> (e.g. on /dev/pps or something of the like) would be very difficult >> at >> all, since the low-level driver capability is already present. >>=20 >> If I get some free time I'll dig around a bit and see if I can cobble >> something up. It's of some interest to me as well since I have a GPS >> clock here that currently talks to a serial port on an Intel-based >> machine and being able to move that to a $35 "appliance" for NTP >> using >> the Adafruit setup looks sort of attractive given that the Pi plus >> the >> module would be under $100 all-in. >=20 > Don't "cobble something up" just yet... there is "a right way" to fix > this, which is a generic gpio-pps driver. The problem is that it > requires support from the new INTRNG, and the rpi hasn't been converted > to that yet. I'm checking around to see if someone has done the > conversion for rpi and it just hasn't been reveiwed/committed yet; if > not, I guess I'll try to do it myself. >=20 > Writing the actual gpio-pps driver will be pretty quick and easy once > we have the intrng support, I think it'll take me a couple hours. >=20 Oh, so there is hope. Thanks for looking into it.=20 Im not a programmer myself but im willing to help if I can.=20 > Also, FYI, another option with PPS is to use a usb-serial adapter and > feed the PPS in on the CTS or DCD pin. I tested that on rpi a few > months ago and it worked fine. There's surpisingly little jitter even > when the usb bus is heavily loaded with other traffic such as disk or > network IO. >=20 Yes that was going to be my plan B. Good to know that it works. /Peter.=20= --Apple-Mail-0307F1A2-4FAC-40ED-BC1A-2A8F9D7D194A Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGHDCCBhgw ggUAoAMCAQICAwyt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