PPS input on a generic GPIO pin on Raspberry Pi.

Peter Ankerstål peter at pean.org
Sat Mar 5 06:54:44 UTC 2016

> On 4 mars 2016, at 19:00, Ian Lepore <ian at freebsd.org> wrote:
>> On Fri, 2016-03-04 at 10:54 -0600, Karl Denninger wrote:
>>> On 3/3/2016 12:57, Peter Ankerstål wrote:
>>> Hi!
>>> I have sort of exactly the same question as Erik:
>>> http://lists.freebsd.org/pipermail/freebsd-questions/2014-July/2590
>>> 55.html
>>> I have bought a https://learn.adafruit.com/adafruit-ultimate-gps an
>>> d want to use the PPS output to discipline my clock.
>>> But the only source of information on how PPS works in FreeBSD I
>>> could find is this: 
>>> 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”
>>> Since the Pi doesn´t 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=3.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.
>> 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.
> 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.
> 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.
Oh, so there is hope. Thanks for looking into it. 

Im not a programmer myself but im willing to help if I can. 

> 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.
Yes that was going to be my plan B. Good to know that it works.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2505 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20160305/7c4a5174/attachment.bin>

More information about the freebsd-stable mailing list